Skip to content

Example Setup

Nate Koenig edited this page Mar 22, 2021 · 2 revisions

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 competition.ign worldName:=tunnel_circuit_practice_01 circuit:=tunnel 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

    • If you are using a robot with flippers, such as the CTU CRAS NORLAB Absolem Sensor Config 1, then you can use the D-pad to control the flippers.

      • ↑: raises the front flippers
      • ↓: lowers the front flippers
      • ←: raises the rear flippers
      • →: lowers the rear flippers.