-
Notifications
You must be signed in to change notification settings - Fork 98
FormerTeamConfiguration
This tutorial explains how to configure the composition of your robot team. Make sure that you followed the Custom Control tutorial and you already have a controller for your robot.
Open the ~/subt_seed_ws/src/subt_seed/launch/x1.launch
file with your favorite editor and uncomment
the three commented blocks. We're modifying the launch file to load a small team of two X1 robots.
Your launch file should look like this:
<?xml version="1.0"?>
<launch>
<!-- Arguments -->
<arg name="robot_1_name" default="X1_1" />
<!-- Other potential robot names -->
<arg name="robot_2_name" default="X1_2" />
<!-- Spawn your team here. -->
<include file="$(find x1_gazebo)/launch/spawn_x1.launch">
<arg name="robot_namespace" value="$(arg robot_1_name)"/>
<arg name="x" value="1"/>
<arg name="y" value="1"/>
</include>
<!-- Other potential robots. -->
<include file="$(find x1_gazebo)/launch/spawn_x1.launch">
<arg name="robot_namespace" value="$(arg robot_2_name)"/>
<arg name="x" value="2"/>
<arg name="y" value="2"/>
</include>
<!-- Launch your controller nodes -->
<node name="$(arg robot_1_name)_control" pkg="subt_seed" type="subt_seed_node" args="$(arg robot_1_name)" />
<!-- Other potential controllers -->
<node name="$(arg robot_2_name)_control" pkg="subt_seed" type="subt_seed_node" args="$(arg robot_2_name)" />
</launch>
There are three main sections in this launch file. In the first section we declare the names of the robots. This will affect the topic names used to control the robots.
<!-- Arguments -->
<arg name="robot_1_name" default="X1_1" />
<!-- Other potential robot names -->
<arg name="robot_2_name" default="X1_2" />
In the second section we spawn each robot into the simulation.
<!-- Spawn your team here. -->
<include file="$(find x1_gazebo)/launch/spawn_x1.launch">
<arg name="robot_namespace" value="$(arg robot_1_name)"/>
<arg name="x" value="1"/>
<arg name="y" value="1"/>
</include>
<!-- Other potential robots. -->
<include file="$(find x1_gazebo)/launch/spawn_x1.launch">
<arg name="robot_namespace" value="$(arg robot_2_name)"/>
<arg name="x" value="2"/>
<arg name="y" value="2"/>
</include>
In the last step, we start each robot controller.
<!-- Launch your controller nodes -->
<node name="$(arg robot_1_name)_control" pkg="subt_seed" type="subt_seed_node" args="$(arg robot_1_name)" />
<!-- Other potential controllers -->
<node name="$(arg robot_2_name)_control" pkg="subt_seed" type="subt_seed_node" args="$(arg robot_2_name)" />
Launch your team with your sensor configuration. As described in the SubT API, the sensor configuration is selected via environment variables.
In this tutorial, we'll use the sensor configuration #2
.
-
Launch a SubT simulation environment in a terminal.
a. If you are using the docker installation method for SubT
roslaunch subt_gazebo competition.launch
b. If you are using the catkin workspace installation method for SubT
cd ~/subt_ws source install/setup.bash roslaunch subt_gazebo competition.launch
-
In another terminal, run your modified subt_seed example
source /opt/ros/melodic/setup.bash cd ~/subt_seed_ws source install/setup.bash X1_SENSOR_CONFIG_2=1 roslaunch subt_seed x1.launch