I'm trying to control multiple robots on Gazebo. Right now I'm using turtlebot for that purpose, and have succeeded in spawning multiple robots and making those robots move with the same/single /turtlebot_node/cmd_vel
message so that all of them move in the same way.
However, I want to give different cmd_vel
to each robot so that each one moves differently. Any idea would be appreciated. I know the topic in use is specified in turtlebot_gazebo_plugins/src/gazebo_ros_create.cpp
, but still I haven't figured out how to apply to my purpose.
Turtlebot is preferred but other robots are fine too as long as they meet my request and teleop source code is available, since for now I'm only interested in controlling feature of robots. Also, though I prefer permanent solution, ad-hoc way is fine this time. Thanks.
How I am advertising a msg:
nodeHandleInstance_.advertise<geometry_msgs::Twist>("/turtlebot_node/cmd_vel", 1);
Environment: Ubuntu 11.04, ROS electric
Update 10/12/2011) Although I tried @karthikdesingh 's suggestion, I still can't control multiple robots separately, or I even can't control any robot with it unfortunately. Robot nodes successfully publish the separate messages with the namespace at the beginning of the topic name, but gazebo is not subscribing to any of them, which I suppose necessary (I'm not sure about this though), and instead it still subscribes to the normal /turtlebot_node/cmd_vel
. Here's gazebo's subscription copied from rxgraph's side window (crowd{ 1, 2 }
are the namespaces I assigned):
/gazebo
Subscriptions:
* /crowd1/set_update_rate [unknown type]
* /gazebo/set_model_state [unknown type]
* /gazebo/set_link_state [unknown type]
* /crowd2/set_hfov [unknown type]
* /crowd1/set_hfov [unknown type]
* /clock [rosgraph_msgs/Clock]
* /turtlebot_node/cmd_vel [unknown type]
* /crowd2/set_update_rate [unknown type]
Now I'm wondering it might depend on the behavior of the node? Here's the code of the node: http://pastebin.com/7mNprFqu
Two .launch files in use (that are called from parent .launch file): http://pastebin.com/WKD2mBi6 and http://pastebin.com/GKDA4uMh
Update 10/18/2011) As in the comment area in the selected answer, I assume the root cause is that in the launch file I didn't surround the subscriber node by group tag.
Originally posted by 130s on ROS Answers with karma: 10937 on 2011-10-11
Post score: 3