Ask Your Question
1

How can I run multiple turtlebots in gazebo?

asked 2015-07-20 14:40:02 -0500

JSYoo5B gravatar image

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?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-07-21 06:30:39 -0500

updated 2015-07-21 06:31:26 -0500

The model name MUST be unique in your spawn command!

There is a --model <name>, where you spawn the robot in Gazebo.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2015-07-20 14:40:02 -0500

Seen: 851 times

Last updated: Jul 21 '15