0
$\begingroup$

Rosanswers logo

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?


Originally posted by ncw000 on ROS Answers with karma: 109 on 2011-04-03

Post score: 11

$\endgroup$

3 Answers 3

0
$\begingroup$

Rosanswers logo

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.


Originally posted by hsu with karma: 5780 on 2011-05-23

This answer was ACCEPTED on the original site

Post score: 5


Original comments

Comment by cybodroid on 2015-12-27:
The Link for empty gazebo plugin template doesn't work.

$\endgroup$
0
$\begingroup$

Rosanswers logo

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.


Originally posted by Bart with karma: 856 on 2011-04-03

This answer was NOT ACCEPTED on the original site

Post score: 5


Original comments

Comment by ncw000 on 2011-04-09:
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?

Comment by Pablo Iñigo Blasco on 2011-04-05:
More about /cmd_vel and Twist Messages in car-like robots here -> http://answers.ros.org/question/585/cmd_vel-and-move_base

Comment by joq on 2011-04-03:
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.

Comment by Bart on 2011-04-03:
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.

Comment by joq on 2011-04-03:
This is true and helpful, but keep in mind that Twist is not really a very useful or natural interface for car-like robots.

Comment by k2108 on 2021-08-09:
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

$\endgroup$
0
$\begingroup$

Rosanswers logo

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


Originally posted by Aidan1488 with karma: 46 on 2011-07-08

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by abraham on 2019-03-15:
hey am doing the same thing in 2019 ,can help me out how do you implement pr2 controller on your model

Comment by raj199322 on 2020-04-25:
@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?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.