Wiki

Clone wiki

subt / tutorials / ExampleSetup

Back to How-to Guides

This tutorial will walk you through running a tunnel environment, robot team, and joystick control.

NOTE: Teams are not allow to spawn their own robots. Instead, teams must choose from four(4) robot types and their defined payload configurations.

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.

  1. 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/js0 if it's the only joystick controller connected to you computer. You can also run jstest to make sure the joystick device is working properly, e.g.

    jstest /dev/input/js0
    
  2. Open a terminal and launch the teleop file

    # Source ROS distro and SubT setup files
    source /opt/ros/melodic/setup.bash
    source ~/subt_ws/install/setup.bash
    
    roslaunch subt_example teleop.launch
    
  3. Open another terminal and launch the tunnel practice environment

    # Source ROS distro and SubT setup files
    source /opt/ros/melodic/setup.bash
    source ~/subt_ws/install/setup.bash
    
    ign launch -v 4 tunnel_circuit_practice.ign robotName1:=X1 robotConfig1:=X1_SENSOR_CONFIG_1
    

    NOTE: When you test with the joystick using the teleop.launch, you can ONLY use X1 / X2 / X3 / X4 as the robot name (e.g. robotName1:=X1). This does NOT apply to custom controllers, where you can use a custom name as long as it unique.

  4. 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. If you launched more than one robot, the press the A button to select the X1 robot.

  5. Press and hold the LB button (dead man's switch) and use the left joystick to move the X1 robot. You can also use the the RB button as dead man's switch - the difference is that this moves the robot at a higher speed.

    NOTE: If the robot doesn't respond to the joystick commands, then check that the teleop.launch file has the "config" arg set to logitech_config.yaml. If you open another terminal (source the setup files) and run one of the commands below, then yu should see non-zero values when moving the stick:

    rostopic echo /X1/cmd_vel
    
    # or
    
    ign topic -e -t /model/X1/cmd_vel_relay
    
  6. Trying turning on/off X1's flashlights by pressing LT/RT.

  7. Now try flying one of the drones. Press the Y button 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.

Back to How-to Guides

Updated