ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to simulate multi-robots transportation in gazebo?

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

pinxian gravatar image

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

Hi all,

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

https://dev.px4.io/en/simulation/mult...

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?

Thanks!!

edit retag flag offensive close merge delete

Comments

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

Alireza_msb gravatar image Alireza_msb  ( 2021-06-15 11:32:17 -0600 )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 -0600 )edit

@jayess Thanks, I made a new question here as you mentioned: https://answers.ros.org/question/3803...

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

2 Answers

Sort by ยป oldest newest most voted
0

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

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)"/>
 </include>  

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

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

then for robot.launch:

<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"/>

</launch>
edit flag offensive delete link more
0

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

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

Comments

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 -0600 )edit

I think my problem is very similar to this https://answers.ros.org/question/2026... . Have you ever solved this kind of problem?

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

Question Tools

2 followers

Stats

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

Seen: 677 times

Last updated: Jun 15 '21