Ask Your Question

How to simulate multi-robots transportation in gazebo?

asked 2019-01-14 11:57:24 -0500

pinxian gravatar image

updated 2019-01-14 11:58:09 -0500

Hi all,

I can use px4-sitl to spawn a drone and control it in gazebo by sending command to specific rostopics.

Now,I want to simulate a group of quadcopters to transport a payload cooperatively.

I think I have to spawn the payload and drones in a xacro file and define joints between them.Is it correct?

If it's not, how do I modify the XACRO file?

Can someone give me an alternative method?


edit retag flag offensive close merge delete


I'm facing the same issue, could you solve this problem?

Alireza_msb gravatar image Alireza_msb  ( 2021-06-15 11:32:17 -0500 )edit

@Alireza_msb this question is over 2 years old, you should create a new question and reference this one instead of commenting here. This will give your problem more visibility

jayess gravatar image jayess  ( 2021-06-15 14:38:05 -0500 )edit

@jayess Thanks, I made a new question here as you mentioned:

Alireza_msb gravatar image Alireza_msb  ( 2021-06-15 23:53:26 -0500 )edit

2 Answers

Sort by » oldest newest most voted

answered 2021-06-15 14:35:44 -0500

Youssef_Lah gravatar image

Here is the code that worked for me, and as steve said on the comment above, you have to pay attention for hardcoded topics. For namespace:

<arg name="model" default="$(find your_package)/urdf/robot.urdf.xacro"/>

<!-- Launch gazebo -->
<include file="$(find your_package)/launch/gazebo.launch">
  <arg name="model" value="$(arg model)"/>

<group ns="robot1">
        <param name="tf_prefix" value="robot1_tf" />

        <include file="$(find your_package)/launch/robot.launch" >
          <arg name="init_pose" value="-x 0 -y 1 -z 0" />
          <arg name="robot_name"  value="robot1" />

        <include file="$(find ira_laser_tools)/launch/laserscan_multi_merger.launch">
          <arg name="robot_name" value="robot1"/>

then for robot.launch:

    <arg name="robot_name" default="your_default_value"/>
    <arg name="init_pose" default="your_default_value"/>

<node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model"
     args="$(arg init_pose) -urdf -param /robot_description -model $(arg robot_name)"
     respawn="false" output="screen" />

    <node pkg="robot_state_publisher" type="robot_state_publisher" 
          name="robot_state_publisher" output="screen"/>

edit flag offensive delete link more

answered 2019-01-14 12:50:39 -0500

You can spawn multiple robot instances in gazebo by launching the xacro in different namespaces (and hopefully starting positions so they don't explode) as long as you don't hardcode any topics in the global namespace in your software. This would make it so a command to one would be sent to all. If you use a local namespace for all this should just work out of the box, although slow

edit flag offensive delete link more


Hi , Thank you for your reply. I have tried to give each of robots namespace.For example /robot1 /robot2 .... However,I found that I cant define the joint and link after spawing robots. So I have to predefine the robots and their relationship in xacro file and then spawn the model. Is it right?

pinxian gravatar image pinxian  ( 2019-01-14 20:40:39 -0500 )edit

I think my problem is very similar to this . Have you ever solved this kind of problem?

pinxian gravatar image pinxian  ( 2019-01-14 20:50:19 -0500 )edit

Your Answer

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

Add Answer

Question Tools



Asked: 2019-01-14 11:57:24 -0500

Seen: 419 times

Last updated: Jun 15