Multiple TurtleBots in gazebo [closed]
Hi all,
I want to spawn two TurtleBots in Gazebo. And also I wish to control each of the robots independently. Is there a way to do it ?
Thanks!
ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange |
Hi all,
I want to spawn two TurtleBots in Gazebo. And also I wish to control each of the robots independently. Is there a way to do it ?
Thanks!
Hi,
I tried to spawn two turtlebots taking a look to the above link and others. I tried to change line 36 of gazebo_ros_create.cpp as reported here [http://answers.ros.org/question/33981/multiple-turtlebots-in-gazebo/], i.e. line 36 to node_namespaceP_ = new ParamT<std::string>("robotNamespace","",0);
Then, I used two configuration file, one for each turtlebot. For each node inside this configuration file, I have added a namespace through the option "ns", I just report the first one below.
I still see /odom and /cmd_vel topics without any specification wrt the namespaces. Other topics, like scan, are actually modified accordingly to the namespace of the two robots.
Thank you
<launch>
<group ns="JOLLY">
<param name="robot_description" command="$(find xacro)/xacro.py '$(find turtlebot_description)/urdf/turtlebot.urdf.xacro'" />
</group>
<node name="spawn_turtlebot_model2" pkg="gazebo" type="spawn_model" args="$(optenv ROBOT_INITIAL_POSE) -unpause -urdf -param robot_description -x 2 -y 10 -z 0.05 -model turtlebot2" respawn="false" output="screen" ns="JOLLY"/>
<node pkg="diagnostic_aggregator" type="aggregator_node" name="diagnostic_aggregator" ns="JOLLY" >
<rosparam command="load" file="$(find turtlebot_bringup)/config/diagnostics.yaml" />
</node>
<node pkg="robot_state_publisher" type="state_publisher" name="robot_state_publisher" output="screen" ns="JOLLY">
<param name="publish_frequency" type="double" value="20.0" />
</node>
<!-- The odometry estimator -->
<node pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf" ns="JOLLY">
<param name="freq" value="30.0"/>
<param name="sensor_timeout" value="1.0"/>
<param name="publish_tf" value="true"/>
<param name="odom_used" value="true"/>
<param name="imu_used" value="false"/>
<param name="vo_used" value="false"/>
<param name="output_frame" value="odom"/>
<param name="output_frame" value="odom" />
</node>
<!-- throttling -->
<node pkg="nodelet" type="nodelet" name="pointcloud_throttle" args="load pointcloud_to_laserscan/CloudThrottle openni_manager" respawn="true" ns="JOLLY">
<param name="max_rate" value="20.0"/>
<remap from="cloud_in" to="/camera/depth/points"/>
<remap from="cloud_out" to="cloud_throttled"/>
</node>
<!-- Fake Laser -->
<node pkg="nodelet" type="nodelet" name="kinect_laser" args="load pointcloud_to_laserscan/CloudToScan openni_manager" respawn="true" ns="JOLLY">
<param name="output_frame_id" value="/camera_depth_frame"/>
<!-- heights are in the (optical?) frame of the kinect -->
<param name="min_height" value="-0.15"/>
<param name="max_height" value="0.15"/>
<remap from="cloud" to="/cloud_throttled"/>
</node>
<!-- Fake Laser (narrow one, for localization -->
<node pkg="nodelet" type="nodelet" name="kinect_laser_narrow" args="load pointcloud_to_laserscan/CloudToScan openni_manager" respawn="true" ns="JOLLY">
<param name="output_frame_id" value="/camera_depth_frame"/>
<!-- heights are in the (optical?) frame of the kinect -->
<param name="min_height" value="-0.025"/>
<param name="max_height" value="0.025"/>
<remap from="cloud" to="/cloud_throttled"/>
<remap from="scan" to="/narrow_scan"/>
</node>
</launch>
Start from here http://answers.ros.org/question/37582/multi-robot-simulation-in-ros/
Seems to be ok now, I do not have to set tf_prefix inside the robot_state_publisher node but I have to declare separately, like this
<group ns="robot1"> </group>
Tomorrow I'll continue trying to exploit a navigation stack for every robot.
Thanks for the suggestions
Thanks,
I had just solved it 5 minutes ago, I was writing a reply.
Do you know if there are problems with tf or related stuff? Now I am going to use the navigation stack for both of them.
Thank you again.
PS: I think it would be better to write a page that clearly states these issues, it is a waste of time and I guess it is an important feature for many researchers
Sorry but I didn't get: I use ros electric (we are having some problems with fuerte...). Are you referring to fuerte or electric? If this is just for fuerte, could you please provide the link to the patch? Probably your're referring to this https://code.ros.org/trac/ros-pkg/ticket/5511
I made the modifications reported in the patch related to gazebo_ros_laser.cpp (link text)
I can correctly see the laser footprints coming from both the turtlebots, but not at the same time. Basically in rviz, i can visualize just one robot model (and I am not even sure which of them it is: if I try to set TF prefix in robot model it complains saying "No transform from [/robot1/base_footprint] to [/base_link]" "No transform from [/robot1/base_link] to [/base_link]" and so on...
One thing more is needed. In the same gazebo_ros_create.cpp starting from line 157 you have to change the fully-qualified topic names to relative one i.e.
/cmd_vel -> cmd_vel
/odom -> odom
/joint_states -> joint_states
Recompile and that's it.
Asked: 2012-08-09 22:08:22 -0600
Seen: 2,626 times
Last updated: Aug 14 '12
Hello prasanna kumar, is it possible to tell me how to do it and what should I write in my launch file. Thank you