Launch files - FontysAtWork/ESA-PROJ GitHub Wiki

Launchfile structure

In order to simplify the startup of the robot in pre-competition and during the competition launch files have been created.

The structure of the launch files is divided into two separate categories (and also physical locations); generic and robot specific. Generic files are located in src/fontys_at_work/faw/launch and robot specific files are located in src/[robot name]/[robot name]/launch (for example src/youbot/youbot/launch). The primary reason is that we wanted our launch file structure to support multiple robot platforms. The launch files have the following content and goals:

Name Generic / Robot specific Description
map_create Generic Create a map by driving the robot around the arena
map_normal_save Generic Save the map to file when running map_create
pre_competition Generic Run the robot in navigation mode and run map_marker GUI to create markers and nogo zones
map_nogo_save Generic Save the nogo zones map when running pre_competition
competition Generic Run the robot in competition mode (with referee)
gamepad Generic Start-up gamepad interface to manually drive robot via cmd_vel
navigation Robot specific Start the robots autonomous navigation stack.
map_create Robot_specific Start-up the robot driver, mapping sensors and mapping algorithm.

The selection of the robot is made by exporting the ROBOT variable:

export ROBOT=youbot

Note that the robot value needs to match the [robot name] in the robot specific path mentioned earlier.

Adding a new robot platform

With the current launch file structure it is possible to add a new robot platform to the src folder. For this example we will add a robot platform called baxter. We need to add a folder into src called baxter. In this baxter folder we create the package baxter

mkdir baxter && cd baxter && catkin_create_pkg baxter rospy roscpp std_msgs

Next, in the baxter package, we need to create the launch folder add the necessary launch files.

  • launch/navigation.launch
  • launch/map_create.launch

What's in these launch files is up to the person(s) implementing it. But keep in mind that the original intention of the launch remains in tact. This creates a minimum implementation of the baxter robot. The next step is to extend the launch-files with robot specific nodes / launch files.

It is now possible to select the baxter robot by changing the ROBOT variable. Then source the setup.bash file to change to the new platform.

source devel/setup.bash

Pre-launch setup

Before we can use the launch files we need to prepare our environment (once), build the packages using catkin_make and start the robot hardware. For more information view the Robot controller setup page. Also we need to source the setup bash file using the following command (from the workspace):

source devel/setup.bash

Note: When using multiple systems we need to execute some extra commands so they are able to communicate with each other:

export ROS_IP=<local ip>
export ROS_MASTER_URI=http://<master_ip>:11311/

The first line publishes your own ip address to ROS. This is needed because we don't have hostnames (or DNS) setup. Otherwise the master cannot find us. The second line sets the URL of the ROS master. This master is located on the laptop running the navigation stack on the robot.

Creating a map

When creating a map we start the navigation stack in mapping mode using the following command:

roslaunch faw map_create.launch

This launches the navigation stack with gmapping_slam and enables the user to manually drive around the robot using a joypad. It is recommended to launch rviz using the command below (in a new terminal from the workspace). Please note that you need to source the setup bash file before running rviz. Otherwise the robot model is not correctly loaded. In rviz add the map and robotmodel to view the mapping progress clearly.

source devel/setup.bash &&
roslaunch faw rviz.launch

When the map looks good in rviz it's time to save it. To do so use the following commands (from the workspace in a separate terminal):

source devel/setup.bash &&
roslaunch faw map_normal_save.launch

Pre-competition

Now that we have a map of the arena we can start-up the robot in pre-competition mode. This means running the Navigation stack and starting our custom User interface. This mode enables us to create work areas and no-go zones.

Robot

On the robot we start the robot in pre-competition mode with the following launchfile:

source devel/setup.bash &&
roslaunch faw pre_competition.launch

When you are done create markers and no-go zones there is one last step, saving the no-go zones. This can be done with the following command (from a separate terminal).

source devel/setup.bash &&
roslaunch faw map_nogo_save.launch

Competition

Now that we have all the markers and no-go zones defined we can start the robot in competition mode. Note that currently this mode does not function. We did provide the launch file structure but didn't have time to implement the competition behaviour.

source devel/setup.bash &&
roslaunch faw competition.launch
⚠️ **GitHub.com Fallback** ⚠️