0
$\begingroup$

Rosanswers logo

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!


Originally posted by prasanna.kumar on ROS Answers with karma: 1363 on 2012-08-09

Post score: 2


Original comments

Comment by Ramez on 2015-06-24:
Hello prasanna kumar, is it possible to tell me how to do it and what should I write in my launch file. Thank you

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

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 ParamTstd::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>

Originally posted by maurizio with karma: 76 on 2012-08-14

This answer was ACCEPTED on the original site

Post score: 2

$\endgroup$
0
$\begingroup$

Rosanswers logo

Start from here http://answers.ros.org/question/37582/multi-robot-simulation-in-ros/


Originally posted by Jakub with karma: 1821 on 2012-08-09

This answer was NOT ACCEPTED on the original site

Post score: 2

$\endgroup$

Your Answer

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