This tutorial will walk you through running a tunnel environment, robot team, and joystick control.
We have created an example team composed of four different generic robots: a large mobile robot called the X1, a small mobile robot called the X2, a small quadcopter called X3 and a large hexacopter named X4. See also the robots documentation.
Connect your USB joystick. We use a Logitech F310 (Walmart). Make sure it is in DirectInput (D) mode (the toggle switch is on the back of the device). You can check to see if your joystick device is detected, e.g. on Ubuntu, it may show up as
/dev/input/js0if it's the only joystick device connected to you computer. You can also run
jstestto make sure the joystick device is working properly, e.g.
Open a terminal and launch the first tunnel practice environment
# Source SubT setup file in new terminal source ~/subt_ws/install/setup.sh roslaunch subt_gazebo competition.launch scenario:=tunnel_practice_1
Open another terminal and launch the example team
# Source SubT setup file in new terminal source ~/subt_ws/install/setup.sh roslaunch subt_example team.launch # If your joystick is not `/dev/input/input0`, # specify it to the launch file with the `joy_dev` argument: roslaunch subt_example team.launch joy_dev:=/dev/input/input1
You can now tele-operate the robots using the joystick device. Only one robot can be tele-operated at a time. Each robot is assigned a button on the joystick. For testing, press the
Abutton and you should see the X1 robot's yellow LED lights turn on, which means you're now in control of X1.
Press and hold the
LBbutton (dead man's switch) and use the left joystick to move the X1 robot. You can also use the the
RBbutton as dead man's switch - the difference is that this moves the robot at a higher speed.
Trying turning on/off X1's flashlights by pressing
Now try flying one of the drones. Press the
Ybutton to switch to X4 and see its yellow LED lights turn on. With the dead man's switch pressed, the left joystick works the same way as the ground robots while the right joystick is used for side to side motion (strafing) and altitude control.
Here're all the controls:
* `A`: Switch to X1 * `B`: Switch to X2 * `X`: Switch to X3 * `Y`: Switch to X4 * `LB`/`RB`: Dead man switch * Left Joystick: Forward/backward movement, and left/right rotation * Right joystick (drones only): Altitude control and left/right movement * `LT`/`RT` to turn on/off the flashlights. * You can send a simple message from the selected robot to another by pressing arrow keys. The layout corresponds to the selection buttons (`A`, `B`, `X`, and `Y`). - ↓: sends a message to the robot assigned to `A` button. - →: sends a message to the robot assigned to `B` button. - ←: sends a message to the robot assigned to `X` button. - ↑: sends a message to the robot assigned to `Y` button. They flash their middle LED when they send or receive a message.