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

Revision history [back]

click to hide/show revision 1
initial version

These are my launch files working well in simulation with P3-DX robot. They was made by following this question. At first I got the same problem as this question and I successfully managed to fix this. Hope these can help you.

multiple_robot.launch <launch>

  <param name="/use_sim_time" value="true"/>

  <!-- Run GAZEBO World -->
  <include file="$(find multi_robot_scenario)/launch/gazebo_world.launch">
    <arg name="gui" value="false"/>
  </include>

  <!-- Robot1 with diff drive -->
  <include file="$(find multi_robot_scenario)/launch/pioneer3dx.gazebo.launch">
    <arg name="robot_name" value="r1" />
    <arg name="robot_position" value="-x 0.0 -y -0.5 -z 0.0 -R 0 -P 0 -Y +1.57" />
  </include>

  <!-- Robot2 with diff drive -->
  <include file="$(find multi_robot_scenario)/launch/pioneer3dx.gazebo.launch">
    <arg name="robot_name" value="r2" />
    <arg name="robot_position" value="-x 0.0 -y 0.5 -z 0.0 -R 0 -P 0 -Y -1.57" />
  </include>

  <node pkg="tf" type="static_transform_publisher" name="odom_to_odom_r1" args="0.0 0.0 0.0 0.0 0.0 0.0 odom r1/odom 100" />
  <node pkg="tf" type="static_transform_publisher" name="odom_to_odom_r2" args="0.0 0.0 0.0 0.0 0.0 0.0 odom r2/odom 100" />
  <node pkg="tf" type="static_transform_publisher" name="map_to_odom" args="0.0 0.0 0.0 0.0 0.0 0.0 map odom 100" />

  <!-- Run the map server -->
  <node name="map_server" pkg="map_server" type="map_server" args="$(find robot_setup_tf)/maps/map.yaml" output="screen">
    <param name="frame_id" value="/map" />
  </node>

  <!-- Robot 1 Localization & Navigation -->
  <include file="$(find multi_robot_scenario)/launch/navigation.launch">
    <arg name="tf_prefix" value="r1"/>
    <arg name="initial_pose_x" value="0.0"/>
    <arg name="initial_pose_y" value="-0.5"/>
    <arg name="initial_pose_a" value="1.57"/>
  </include>

  <!-- Robot 2 Localization & Navigation -->
  <include file="$(find multi_robot_scenario)/launch/navigation.launch">
    <arg name="tf_prefix" value="r2"/>
    <arg name="initial_pose_x" value="0.0"/>
    <arg name="initial_pose_y" value="-0.5"/>
    <arg name="initial_pose_a" value="-1.57"/>
  </include>

  <!-- RVIZ -->
  <node pkg="rviz" type="rviz" name="rviz" args="-d $(find multi_robot_scenario)/rviz_cfg/multi_robot.rviz"/>

</launch>

pioneer3dx.gazebo.launch

<launch>

  <arg name="robot_name" default="r1" />
  <arg name="model" default="$(find multi_robot_scenario)/xacro/p3dx/pioneer3dx.xacro" />
  <arg name="robot_position" default="-x 0.0 -y 0.0 -z 0.0" />

  <group ns="$(arg robot_name)">
    <param name="tf_prefix" type="string" value="$(arg robot_name)"/>

    <!-- Load the URDF into the ROS Parameter Server -->
    <param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />

    <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
    <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" args="-urdf -model $(arg robot_name) -param robot_description $(arg robot_position)" />

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

</launch>

navigation.launch

<launch>

    <param name="/use_sim_time" value="true"/>
    <arg name="tf_prefix" default="r1"/>
    <arg name="initial_pose_x" default="0.0" />
    <arg name="initial_pose_y" default="0.0" />
    <arg name="initial_pose_a" default="0.0" />

    <group ns="$(arg tf_prefix)">
        <param name="tf_prefix" type="string" value="$(arg tf_prefix)"/>

        <include file="$(find multi_robot_scenario)/launch/amcl.launch">
            <arg name="scan_topic" value="front_laser/scan" />
            <!-- <arg name="global_frame_id" value="/map" /> -->
            <arg name="initial_pose_x" value="$(arg initial_pose_x)"/>
            <arg name="initial_pose_y" value="$(arg initial_pose_y)"/>
            <arg name="initial_pose_a" value="$(arg initial_pose_a)"/>
        </include>

        <include file="$(find multi_robot_scenario)/launch/move_base.launch">
            <arg name="global_frame_id" value="/map" />
        </include>
    </group>

</launch>

amcl.launch

<launch>

    <arg name="scan_topic" default="scan" />
    <arg name="global_frame_id" default="map" />
    <arg name="initial_pose_x" default="0.0" />
    <arg name="initial_pose_y" default="0.0" />
    <arg name="initial_pose_a" default="0.0" />

    <node pkg="amcl" type="amcl" name="amcl" output="screen">
        <remap from="scan" to="$(arg scan_topic)"/>

        <param name="global_frame_id" value="$(arg global_frame_id)"/>
        <param name="use_map_topic" value="true"/>

        <param name="initial_pose_x" value="$(arg initial_pose_x)"/>
        <param name="initial_pose_y" value="$(arg initial_pose_y)"/>
        <param name="initial_pose_a" value="$(arg initial_pose_a)"/>

        <!-- Publish scans from best pose at a max of 10 Hz -->
        <param name="odom_model_type" value="diff"/>
        <param name="odom_alpha5" value="0.1"/>
        <param name="transform_tolerance" value="0.2" />
        <param name="gui_publish_rate" value="10.0"/>
        <param name="laser_max_beams" value="30"/>
        <param name="min_particles" value="500"/>
        <param name="max_particles" value="5000"/>
        <param name="kld_err" value="0.05"/>
        <param name="kld_z" value="0.99"/>
        <param name="odom_alpha1" value="0.2"/>
        <param name="odom_alpha2" value="0.2"/>
        <!-- translation std dev, m -->
        <param name="odom_alpha3" value="0.8"/>
        <param name="odom_alpha4" value="0.2"/>
        <param name="laser_z_hit" value="0.5"/>
        <param name="laser_z_short" value="0.05"/>
        <param name="laser_z_max" value="0.05"/>
        <param name="laser_z_rand" value="0.5"/>
        <param name="laser_sigma_hit" value="0.2"/>
        <param name="laser_lambda_short" value="0.1"/>
        <param name="laser_model_type" value="likelihood_field"/>
        <!-- <param name="laser_model_type" value="beam"/> -->
        <param name="laser_likelihood_max_dist" value="2.0"/>
        <param name="update_min_d" value="0.2"/>
        <param name="update_min_a" value="0.5"/>
        <param name="odom_frame_id" value="odom"/>
        <param name="resample_interval" value="1"/>
        <!-- <param name="transform_tolerance" value="0.1"/> -->
        <param name="recovery_alpha_slow" value="0.0"/>
        <param name="recovery_alpha_fast" value="0.0"/>
    </node>

</launch>

These are my launch files working well in simulation with P3-DX robot. They was made by following this question. At first I got the same problem as this question and I successfully managed to fix this. Hope these can help you.

multiple_robot.launch <launch>multiple_robot.launch

<launch>

  <param name="/use_sim_time" value="true"/>

  <!-- Run GAZEBO World -->
  <include file="$(find multi_robot_scenario)/launch/gazebo_world.launch">
    <arg name="gui" value="false"/>
  </include>

  <!-- Robot1 with diff drive -->
  <include file="$(find multi_robot_scenario)/launch/pioneer3dx.gazebo.launch">
    <arg name="robot_name" value="r1" />
    <arg name="robot_position" value="-x 0.0 -y -0.5 -z 0.0 -R 0 -P 0 -Y +1.57" />
  </include>

  <!-- Robot2 with diff drive -->
  <include file="$(find multi_robot_scenario)/launch/pioneer3dx.gazebo.launch">
    <arg name="robot_name" value="r2" />
    <arg name="robot_position" value="-x 0.0 -y 0.5 -z 0.0 -R 0 -P 0 -Y -1.57" />
  </include>

  <node pkg="tf" type="static_transform_publisher" name="odom_to_odom_r1" args="0.0 0.0 0.0 0.0 0.0 0.0 odom r1/odom 100" />
  <node pkg="tf" type="static_transform_publisher" name="odom_to_odom_r2" args="0.0 0.0 0.0 0.0 0.0 0.0 odom r2/odom 100" />
  <node pkg="tf" type="static_transform_publisher" name="map_to_odom" args="0.0 0.0 0.0 0.0 0.0 0.0 map odom 100" />

  <!-- Run the map server -->
  <node name="map_server" pkg="map_server" type="map_server" args="$(find robot_setup_tf)/maps/map.yaml" output="screen">
    <param name="frame_id" value="/map" />
  </node>

  <!-- Robot 1 Localization & Navigation -->
  <include file="$(find multi_robot_scenario)/launch/navigation.launch">
    <arg name="tf_prefix" value="r1"/>
    <arg name="initial_pose_x" value="0.0"/>
    <arg name="initial_pose_y" value="-0.5"/>
    <arg name="initial_pose_a" value="1.57"/>
  </include>

  <!-- Robot 2 Localization & Navigation -->
  <include file="$(find multi_robot_scenario)/launch/navigation.launch">
    <arg name="tf_prefix" value="r2"/>
    <arg name="initial_pose_x" value="0.0"/>
    <arg name="initial_pose_y" value="-0.5"/>
    <arg name="initial_pose_a" value="-1.57"/>
  </include>

  <!-- RVIZ -->
  <node pkg="rviz" type="rviz" name="rviz" args="-d $(find multi_robot_scenario)/rviz_cfg/multi_robot.rviz"/>

</launch>

pioneer3dx.gazebo.launch

<launch>

  <arg name="robot_name" default="r1" />
  <arg name="model" default="$(find multi_robot_scenario)/xacro/p3dx/pioneer3dx.xacro" />
  <arg name="robot_position" default="-x 0.0 -y 0.0 -z 0.0" />

  <group ns="$(arg robot_name)">
    <param name="tf_prefix" type="string" value="$(arg robot_name)"/>

    <!-- Load the URDF into the ROS Parameter Server -->
    <param name="robot_description" command="$(find xacro)/xacro.py $(arg model)" />

    <!-- Run a python script to the send a service call to gazebo_ros to spawn a URDF robot -->
    <node name="urdf_spawner" pkg="gazebo_ros" type="spawn_model" respawn="false" output="screen" args="-urdf -model $(arg robot_name) -param robot_description $(arg robot_position)" />

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

</launch>

navigation.launch

<launch>

    <param name="/use_sim_time" value="true"/>
    <arg name="tf_prefix" default="r1"/>
    <arg name="initial_pose_x" default="0.0" />
    <arg name="initial_pose_y" default="0.0" />
    <arg name="initial_pose_a" default="0.0" />

    <group ns="$(arg tf_prefix)">
        <param name="tf_prefix" type="string" value="$(arg tf_prefix)"/>

        <include file="$(find multi_robot_scenario)/launch/amcl.launch">
            <arg name="scan_topic" value="front_laser/scan" />
            <!-- <arg name="global_frame_id" value="/map" /> -->
            <arg name="initial_pose_x" value="$(arg initial_pose_x)"/>
            <arg name="initial_pose_y" value="$(arg initial_pose_y)"/>
            <arg name="initial_pose_a" value="$(arg initial_pose_a)"/>
        </include>

        <include file="$(find multi_robot_scenario)/launch/move_base.launch">
            <arg name="global_frame_id" value="/map" />
        </include>
    </group>

</launch>

amcl.launch

<launch>

    <arg name="scan_topic" default="scan" />
    <arg name="global_frame_id" default="map" />
    <arg name="initial_pose_x" default="0.0" />
    <arg name="initial_pose_y" default="0.0" />
    <arg name="initial_pose_a" default="0.0" />

    <node pkg="amcl" type="amcl" name="amcl" output="screen">
        <remap from="scan" to="$(arg scan_topic)"/>

        <param name="global_frame_id" value="$(arg global_frame_id)"/>
        <param name="use_map_topic" value="true"/>

        <param name="initial_pose_x" value="$(arg initial_pose_x)"/>
        <param name="initial_pose_y" value="$(arg initial_pose_y)"/>
        <param name="initial_pose_a" value="$(arg initial_pose_a)"/>

        <!-- Publish scans from best pose at a max of 10 Hz -->
        <param name="odom_model_type" value="diff"/>
        <param name="odom_alpha5" value="0.1"/>
        <param name="transform_tolerance" value="0.2" />
        <param name="gui_publish_rate" value="10.0"/>
        <param name="laser_max_beams" value="30"/>
        <param name="min_particles" value="500"/>
        <param name="max_particles" value="5000"/>
        <param name="kld_err" value="0.05"/>
        <param name="kld_z" value="0.99"/>
        <param name="odom_alpha1" value="0.2"/>
        <param name="odom_alpha2" value="0.2"/>
        <!-- translation std dev, m -->
        <param name="odom_alpha3" value="0.8"/>
        <param name="odom_alpha4" value="0.2"/>
        <param name="laser_z_hit" value="0.5"/>
        <param name="laser_z_short" value="0.05"/>
        <param name="laser_z_max" value="0.05"/>
        <param name="laser_z_rand" value="0.5"/>
        <param name="laser_sigma_hit" value="0.2"/>
        <param name="laser_lambda_short" value="0.1"/>
        <param name="laser_model_type" value="likelihood_field"/>
        <!-- <param name="laser_model_type" value="beam"/> -->
        <param name="laser_likelihood_max_dist" value="2.0"/>
        <param name="update_min_d" value="0.2"/>
        <param name="update_min_a" value="0.5"/>
        <param name="odom_frame_id" value="odom"/>
        <param name="resample_interval" value="1"/>
        <!-- <param name="transform_tolerance" value="0.1"/> -->
        <param name="recovery_alpha_slow" value="0.0"/>
        <param name="recovery_alpha_fast" value="0.0"/>
    </node>

</launch>