ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
11

Moving a robot in Gazebo

asked 2011-04-03 04:20:55 -0600

ncw000 gravatar image

updated 2014-01-28 17:09:28 -0600

ngrennan gravatar image

I'm trying to use the gazebo package to simulate a simple car-like robot moving around a field. Currently, I've been able to load a model of my robot into a simulation. However, I haven't had any luck understanding how to go about making the robot move via external commands (keyboard presses, etc.).

The documentation seems to gloss over this, or at least I can't find where it's described. How would I go about making a robot move in the a Gazebo simulation?

edit retag flag offensive close merge delete

3 Answers

Sort by » oldest newest most voted
5

answered 2011-05-23 11:50:27 -0600

hsu gravatar image

updated 2011-05-23 11:55:08 -0600

You can write a gazebo plugin to send torque or velocity commands to each wheel and the steering joint. Possibly wrapping a simple PID controller around each controlled joint. An empty gazebo_plugin template has been provided for your convenience. Also, please take a look at the diffdrive example for reference on how to construct a plugin that sends velocity commands to individual joints.

Alternatively, if you are familiar with pr2_mechanism control stacks, you can use some predefined robot mechanism controllers to control your joints. A simple controlled joint example can be found in the single link example as shown here.

edit flag offensive delete link more

Comments

1

The Link for empty gazebo plugin template doesn't work.

cybodroid gravatar image cybodroid  ( 2015-12-27 02:41:53 -0600 )edit
5

answered 2011-04-03 06:09:28 -0600

Bart gravatar image

In Gazebo, Stage and real-world navigation initiating movement usually involves some variant of the "cmd_vel" topic, which is based on the "Twist" message format. For simple testing there are a number of nodes in different stacks (turtlebot, pr2) that provide this function using keyboard commands, usually named something like "keyboard_teleop".

I suggest that you examine the turtlesim tutorial (http://www.ros.org/wiki/ROS/Tutorials/UnderstandingTopics) for a good start. It uses "rosrun turtlesim turtle_teleop_key". Use rxgraph to inspect the topics/messages in your simulation and be prepared to remap topic names as required.

edit flag offensive delete link more

Comments

This is true and helpful, but keep in mind that Twist is not really a very useful or natural interface for car-like robots.
joq gravatar image joq  ( 2011-04-03 13:52:42 -0600 )edit
If an appropriate message type doesn't already exist, it is straighforward to create a new message type and topic name (eg - front_wheel_angle, drive_wheel_velocity as "cmd_car"). Appropriate tutorial is ROS/Tutorials/CreatingMsgAndSrv. You still have to write some code at the receiving end to interpret this command.
Bart gravatar image Bart  ( 2011-04-03 14:36:54 -0600 )edit
I would support adding a standardized car command interface to `common_msgs` somewhere. We should be able to get that into E-turtle if we did an API review some time soon.
joq gravatar image joq  ( 2011-04-03 15:51:15 -0600 )edit
More about /cmd_vel and Twist Messages in car-like robots here -> http://answers.ros.org/question/585/cmd_vel-and-move_base
Pablo Iñigo Blasco gravatar image Pablo Iñigo Blasco  ( 2011-04-05 19:54:36 -0600 )edit
I understand that movement commands take that format and how turtlesim uses keyboard_teleop, but I'm still not sure how to actually interact with the Gazebo robot simulation. Is there a specific topic to publish to, or some other method that causes the robot to move? Where do I send move data to?
ncw000 gravatar image ncw000  ( 2011-04-09 16:53:30 -0600 )edit

There is a ros package called teleop_twist_keyboard (http://wiki.ros.org/teleop_twist_keyb...). This can be used to read from the keyboard and publish to /cmd_vel

k2108 gravatar image k2108  ( 2021-08-09 13:12:14 -0600 )edit
1

answered 2011-07-08 07:20:42 -0600

Aidan1488 gravatar image

If you're still interested this two tutorials helped me a lot in a very similar problem. I use the pr2 controllers 'cause I don't have the time to make my own so I just build my own stats over the pr2. Hope it helps you:

http://www.ros.org/wiki/pr2_controllers/Tutorials/Using%20the%20robot%20base%20controllers%20to%20drive%20the%20robot

http://www.ros.org/wiki/pr2_controllers/Tutorials/Using%20the%20base%20controller%20with%20odometry%20and%20transform%20information

edit flag offensive delete link more

Comments

hey am doing the same thing in 2019 ,can help me out how do you implement pr2 controller on your model

abraham gravatar image abraham  ( 2019-03-15 15:57:59 -0600 )edit

@abraham Hi, Even i am trying to develop similar model but no success as of now. Did you figure out any particular tutorial on this?

raj199322 gravatar image raj199322  ( 2020-04-25 17:15:36 -0600 )edit

Question Tools

6 followers

Stats

Asked: 2011-04-03 04:20:55 -0600

Seen: 20,335 times

Last updated: Jan 28 '14