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

how to deal multiple erratic robots in gazebo?

asked 2012-04-19 13:37:27 -0500

abdullah gravatar image

updated 2012-04-19 13:45:44 -0500

Hi, I am stuck in a problem. I want to use two/three erratic robots in gazebo. I have got help from link here. I am successful in spawning two erratic robots. I am using this two_robots.launch

<launch>
    <param name="use_sim_time" value="true" />
 <node name="gazebo" pkg="gazebo" type="gazebo" args="$(find gazebo_worlds)/worlds/empty.world" respawn="false" output="screen"/>

<group ns="robot1">

    <param name="tf_prefix" value="robot1"/>

    <!-- send the erratic robot XML to param server -->

<param name="robot_description" command="$(find xacro)/xacro.py '$(find erratic_world)/urdf/erratic_laser.urdf.xacro'" />

    <!-- push robot_description to factory and spawn robot in gazebo -->

   <node name="spawn_robot1" pkg="gazebo" type="spawn_model"
          args="-param robot_description
                -urdf
                -z 0.01
                -model robot1"
          respawn="false" output="screen" /> 




    <!-- start robot state publisher -->
    <node pkg="robot_state_publisher" type="state_publisher" name="robot_state_publisher1" output="screen" >
        <param name="publish_frequency" type="double" value="50.0" />
    <remap from="odom" to="beta/odom" /> 

    </node>

<!-- Filter for base laser shadowing/veiling -->
<node pkg="laser_filters" type="scan_to_cloud_filter_chain" respawn="true" name="base_shadow_filter" >
    <remap from="scan" to="base_scan/scan" />
    <remap from="cloud_filtered" to="base_scan/shadow_filtered_old" />
    <param name="target_frame" value="base_footprint" />
    <param name="high_fidelity" value="false" />
    <rosparam command="load" file="$(find erratic_description)/params/shadow_filter.yaml" />
</node>



</group>

<group ns="robot2">
    <param name="tf_prefix" value="robot2"/>

    <!-- send the erratic robot XML to param server -->
    <param name="robot_description" command="$(find xacro)/xacro.py '$(find erratic_world)/urdf/erratic_laser.urdf.xacro'" />

    <!-- push robot_description to factory and spawn robot in gazebo -->
    <node name="spawn_robot2" pkg="gazebo" type="spawn_model"
          args="-param robot_description
                -urdf
                -x 1.00
                -z 0.01
                -model robot2"
          respawn="false" output="screen" />

    <!-- start robot state publisher -->
    <node pkg="robot_state_publisher" type="state_publisher" name="robot_state_publisher2" output="screen" >
        <param name="publish_frequency" type="double" value="50.0" />
    </node>


<!-- Filter for base laser shadowing/veiling -->
<node pkg="laser_filters" type="scan_to_cloud_filter_chain" respawn="true" name="base_shadow_filter" >
    <remap from="scan" to="base_scan/scan" />
    <remap from="cloud_filtered" to="base_scan/shadow_filtered_old" />
    <param name="target_frame" value="base_footprint" />
    <param name="high_fidelity" value="false" />
    <rosparam command="load" file="$(find erratic_description)/params/shadow_filter.yaml" />
</node>


</group>
</launch>

Its working very fine. But I have a problem here I can not publish separate topic /odom and subscribe separate topic /cmd_vel for each robot. Here I can do one thing that I can change code "erratic_gazebo_plugins/src/diffdrive_plugin.cpp" for each robot, but its not a good approach.

Is it possible that I can overcome that problem in my launch file? Thanks

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
3

answered 2012-04-21 20:53:07 -0500

arebgun gravatar image

This should be fixed in erratic_robot trunk version (specifically revision 1554, the latest trunk has Fuerte fixes that will break all earlier ROS version compatibility). There's an example launch file that shows how to launch multiple erratic robots in gazebo.

edit flag offensive delete link more

Comments

Thanks a lot.

abdullah gravatar image abdullah  ( 2012-04-23 07:11:08 -0500 )edit

To have separate topic /odom for each robot we have to manually change the diffdrive_plugin.cpp code e.g. for alpha robot, we have to write alpha/odom in this code. Its not a good approach but its working.

abdullah gravatar image abdullah  ( 2012-07-11 07:30:02 -0500 )edit
0

answered 2012-04-19 23:43:48 -0500

bootsman gravatar image

I am not sure how or whether it will even solve the issue, but can't you use a different namespace for each robot as described here:

http://www.ros.org/wiki/Nodes#Command-line_Remapping_Arguments

edit flag offensive delete link more

Comments

@bootsman Thanks for your reply. its working only when there is one node. If we want to change the name of multiple topics, we can initialize our nodes in launch file in groups, you can see the code above. Its working for all topics but I have problem in /odom and /cmd_vel topics.

abdullah gravatar image abdullah  ( 2012-04-20 04:12:25 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2012-04-19 13:37:27 -0500

Seen: 827 times

Last updated: Apr 21 '12