ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A answers.ros.org
Ask Your Question

JSYoo5B's profile - activity

2015-12-28 19:01:53 -0500 received badge  Famous Question (source)
2015-10-21 09:12:17 -0500 received badge  Popular Question (source)
2015-10-21 09:12:17 -0500 received badge  Notable Question (source)
2015-07-20 17:50:42 -0500 received badge  Student (source)
2015-07-20 17:50:30 -0500 asked a question How can I run multiple turtlebots in gazebo?

Q1. Can I run multiple robots in gazebo at once? (In my case, it was turtlebot, but it can be PR2 or something else.)

Q2. If it works, how can I send messages to each robot?


Hi, I'm trying to run multiple turtlebots in gazebo.

I'm making new package and writing .launch file based on turtlebot_gazebo. These are some of following launch files that I wrote.

launch/robots.launch
:
<group ns="robot1">
  <param name="tf_prefix" value="robot1_tf" />
  <include file="$(find multi_turtlebot_gazebo)/launch/single_robot.launch" >
    <arg name="base" value="kobuki" />
    <arg name="stacks" value="hexagons" />
    <arg name="3d_sensor" value="kinect" />
  </include>
</group>

<group ns="robot2">
  <param name="tf_prefix" value="robot2_tf" />
  <include file="$(find multi_turtlebot_gazebo)/launch/single_robot.launch" >
    <arg name="base" value="roomba" />
    <arg name="stacks" value="circles" />
    <arg name="3d_sensor" value="kinect" />
  </include>
</group>

<group ns="robot3">
  <param name="tf_prefix" value="robot3_tf" />
  <include file="$(find multi_turtlebot_gazebo)/launch/single_robot.launch" >
    <arg name="base" value="roomba" />
    <arg name="stacks" value="circles" />
    <arg name="3d_sensor" value="asus_xtion_pro" />
  </include>
</group>
:

launch/single_robot.launch

<launch>
  <arg name="base" default="$(optenv TURTLEBOT_BASE kobuki)"/>
  <arg name="battery" value="$(optenv TURTLEBOT_BATTERY /proc/acpi/battery/BAT0)"/>
  <arg name="stacks" default="$(optenv TURTLEBOT_STACKS hexagon)"/>
  <arg name="3d_sensor" default="$(optenv TURTLEBOT_3D_SENSOR kinect)"/>

  <include file="$(find multi_turtlebot_gazebo)/launch/includes/$(arg base).launch.xml">
    <arg name="base" value="$(arg base)"/>
    <arg name="stacks" value="$(arg stacks)"/>
    <arg name="3d_sensor" value="$(arg 3d_sensor)"/>
  </include>

  <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
    <param name="publish_frequency" type="double" value="30.0" />
  </node>

  <!-- Fake laser -->
  <node pkg="nodelet" type="nodelet" name="laserscan_nodelet_manager" args="manager"/>
  <node pkg="nodelet" type="nodelet" name="depthimage_to_laserscan"
        args="load depthimage_to_laserscan/DepthImageToLaserScanNodelet laserscan_nodelet_manager">
    <param name="scan_height" value="10"/>
    <param name="output_frame_id" value="/camera_depth_frame"/>
    <param name="range_min" value="0.45"/>
    <remap from="image" to="/camera/depth/image_raw"/>
    <remap from="scan" to="/scan"/>
  </node>
</launch>

From this trial, I can see 2 different (hexagon stack & circle stack) turtlebots in gazebo. But, I tried to run 3 turtlebots. In terminal, I can see error log like this.

[ERROR] [14......, 3.19.....]: SpawnModel: Failure - model name turtlebot already exists.

Is there no any way to run same turtlebots in gazebo?


After grouping each nodes, I can see same nodes in different group. But, I cannot use existing turtlebot packages to interact each robot. Do I need to write all existing turtlebot packages in each group?