socrob / autonomous_systems

Material used for learning ROS and robotics, as part of the Autonomous Systems course at Instituto Superior Tecnico
34 stars 9 forks source link

Example launch file #27

Open oscar-lima opened 6 years ago

oscar-lima commented 6 years ago

You can use this as an example launch file for your projects, it has a bit of most common features used in launch file programming/design:

<?xml version="1.0"?>
<launch>

    <!-- load values from shell environment variables (check your bashrc and make sure both ROBOT and ROBOT_ENV are set) -->
    <arg name="robot" default="$(optenv ROBOT !!ROBOT env NOT SET!!)" />
    <arg name="robot_env" default="$(optenv ROBOT_ENV !!ROBOT_ENV env NOT SET!!)" />

    <!-- common navigation launch files -->
    <include file="$(find mbot_2dnav)/ros/launch/nav_common.launch">
        <arg name="robot_env" value="$(arg robot_env)" />
    </include>

    <node pkg="move_base" type="move_base" respawn="true" name="move_base" output="screen">
        <param name="base_local_planner" value="dwa_local_planner/DWAPlannerROS" />
        <rosparam file="$(find mbot_2dnav)/ros/config/dwa/move_base_params.yaml" command="load" />
        <rosparam file="$(find mbot_bringup)/ros/config/$(arg robot)/robot_footprint.yaml" command="load"/>

        <rosparam file="$(find mbot_2dnav)/ros/config/dwa/costmap_common_params.yaml" command="load" ns="global_costmap"/>
        <rosparam file="$(find mbot_bringup)/ros/config/$(arg robot)/robot_footprint.yaml" command="load" ns="global_costmap"/>
        <rosparam file="$(find mbot_2dnav)/ros/config/dwa/global_costmap_params.yaml" command="load" />

        <rosparam file="$(find mbot_2dnav)/ros/config/dwa/costmap_common_params.yaml" command="load" ns="local_costmap" />
        <rosparam file="$(find mbot_bringup)/ros/config/$(arg robot)/robot_footprint.yaml" command="load" ns="local_costmap"/>
        <rosparam file="$(find mbot_2dnav)/ros/config/dwa/local_costmap_params.yaml" command="load" />    

        <rosparam file="$(find mbot_2dnav)/ros/config/dwa/dwa_local_planner_params.yaml" command="load" ns="DWAPlannerROS" />

        <!-- Upload recovery behavior parameters-->    
        <rosparam file="$(find mbot_2dnav)/ros/config/recovery_behaviors/force_field_parameters.yaml" command="load" ns="force_field_recovery"/>    
        <rosparam file="$(find mbot_2dnav)/ros/config/recovery_behaviors/clear_costmap_parameters.yaml" command="load" ns="clear_costmap_recovery"/>    

        <!-- Remap cmd_vel to a medium priority to allow joypad override control + publish constantly for some small amount of time -->
        <remap from="cmd_vel" to="/cmd_vel_constant"/>
        <remap from="~force_field_recovery/cmd_vel" to="/cmd_vel_prio_medium"/>
    </node>

</launch>