Building a simple robot in VREP and controlling it through ROS

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ก.พ. 2025
  • In this demostration a simple two wheel differential drive robot is made in VREP. The robot consist of two powered wheels and a castor wheel. Furthermore, the robot is equipped with an ultra-sonic sensor. The associated Lua script with the robot publishes a topic "/frontUS" on which it sends ultra-sonic range measurements. The robot subscribes to a topic "/cmd_vel" over which it recieves the left and right wheel velocity commands.

ความคิดเห็น • 26

  • @jn8194
    @jn8194 4 ปีที่แล้ว

    Thank you for that tutorial. It pushed me with learning LUA, ROS and V-Rep. Have a nice day :)

  • @ahmadkamalnasir6290
    @ahmadkamalnasir6290  6 ปีที่แล้ว +2

    function cmdVel_Subscriber(msg)
    -- Command velocity callback function
    local V = msg.linear.x
    local W = msg.angular.z
    local Vl = V + L/2 * W
    local Vr = V - L/2 * W
    sim.setJointTargetVelocity(hLeftMotor, Vl)
    sim.setJointTargetVelocity(hRightMotor, Vr)
    end
    function sysCall_init()
    -- do some initialization here:
    hLeftMotor = sim.getObjectHandle('LeftMotor')
    hRightMotor = sim.getObjectHandle('RightMotor')
    L = 0.06
    hFrontUS = sim.getObjectHandle('FrontUS')
    hRosPubFrontUS = simROS.advertise('/frontUS', 'std_msgs/Float32')
    hRosSubCmdVel = simROS.subscribe('/cmd_vel', 'geometry_msgs/Twist', 'cmdVel_Subscriber')
    end
    function sysCall_actuation()
    -- put your actuation code here
    end
    function sysCall_sensing()
    -- put your sensing code here
    local result, distance, detectedPoint = sim.readProximitySensor(hFrontUS)
    local msg = {}
    if (distance ~= nil) then
    --print(result , distance, detectedPoint, '
    ')
    msg['data'] = distance
    simROS.publish(hRosPubFrontUS, msg)
    end
    end
    function sysCall_cleanup()
    -- do some clean-up here
    simROS.shutdownPublisher(hRosPubFrontUS)
    end

  • @jaisonjoseph9691
    @jaisonjoseph9691 3 ปีที่แล้ว

    Hi. Can you please help me with faking gripper action in coppeliasim through MATLAB with remote API? If not possible, is there a way to call a script in coppeliasim through MATLAB that would fake the gripping. thanks in advance

  • @furien3181
    @furien3181 6 ปีที่แล้ว

    After writing rostopic list in terminal, "frontUS" does not show. What could be the problem?

    • @ahmadkamalnasir6290
      @ahmadkamalnasir6290  6 ปีที่แล้ว

      The following line create the topic
      hRosPubRobotUS = simROS.advertise('/robotUS', 'geometry_msgs/Vector3')
      and the following lines publish the message on the topic, if they found non nil values (e.g. when you place some obstacle infront of the US)
      resultfront,distancefront=sim.readProximitySensor(hFrontUS)
      resultleft,distanceleft=sim.readProximitySensor(hFrontUSleft)
      resultright,distanceright=sim.readProximitySensor(hFrontUSright)
      local msg = {}
      if(distancefront~=nil or distanceleft~=nil or distanceright~=nil) then
      --print(result , distance, detectedPoint, '
      ')
      --msg['data'] = distance
      simROS.publish(hRosPubRobotUS,{x=distancefront, y=distanceleft, z=distanceright})
      end

  • @ashoksurabhi5731
    @ashoksurabhi5731 6 ปีที่แล้ว

    Hi, Can you please share the script that you use...Thanks in advance

  • @FireSymphoney
    @FireSymphoney 4 ปีที่แล้ว

    nice tutorial, but plz share the code

  • @andrewmagdy5470
    @andrewmagdy5470 5 ปีที่แล้ว +1

    could you upload the code ?

  • @fifield1978
    @fifield1978 7 ปีที่แล้ว

    Hello, I am new to ROS. Can you share the code that you used? thanks

    • @ahmadkamalnasir6290
      @ahmadkamalnasir6290  7 ปีที่แล้ว

      You may download the accompanied code from the following URL
      we.tl/xijwQS9Nyz

    • @guillermocastillo3711
      @guillermocastillo3711 7 ปีที่แล้ว +1

      Hello, great demonstration!!! Please, could you upload the code again. It is not available anymore. Also, would you think VREP is a better option to work with robotic simulation than Gazebo. Thank you for your help.

    • @thanhbinhdo6290
      @thanhbinhdo6290 7 ปีที่แล้ว

      Can you upload the code again? Thanks in advance

    • @natrahmansur5212
      @natrahmansur5212 7 ปีที่แล้ว

      the code has been deleted..can you upload it back or send it through my email zealousanne@gmail.com..thx in advance

    • @leonardoramos2228
      @leonardoramos2228 6 ปีที่แล้ว

      hello...did u get the code? could u email me? lcarvalho1972@yahoo.com.br

  • @ravindraprasad8159
    @ravindraprasad8159 6 ปีที่แล้ว

    Watch for more V-Rep tutorials: bit.ly/2LzOuae