Teleoperation

Teleoperation is basically controlling a vehicle remotely.

First learned from F1TENTH.

The joystick is constantly publishing, even though we don’t tell it to.

Repos in ROS:

joy teleop_twist_joy

I think the other pipeline is to use joy_teleop, in which case you don’t need to go through the teleop_twist_joy. I learned from here: https://articulatedrobotics.xyz/mobile-robot-14b-adv-teleop/

Teleop with Mux

To deal with the problem of both enabling Teleoperation and autonomous navigation, people from F1TENTH have come up with this implementation: https://github.com/f1tenth/ackermann_mux.

The config file with the mappings is here:

You can see a mapping of all controls used by the car in f110_system/racecar/racecar/config/racecar-v2/joy_teleop.yaml. For example, in the default configuration, axis 1 (left joystick’s vertical axis) is used for throttle, and axis 2 (right joystick’s horizontal axis) is used for steering. If you need to check which axis correspond to what buttons/axis on the joystick, run the joy node, when the joystick is connected, you can see the index of the button/axis that’s changed.”

One day, for some reason, the telop stopped working. When your joystick is plugged in, you should be able to see it under /dev/input/js0. If you don’t see it, you need to switch the mode and check again.

  • D (Direct) Mode: Older version, I think I upgraded and then this mode DID NOT work again
  • X Mode: Newer version, this one works

If you want to change the behavior of the F1TENTH, use the following commands

vim /f1tenth_ws/src/f1tenth_system/f1tenth_stack/config/joy_teleop.yaml
colcon build --packages-select f1tenth_stack && . install/setup.bash && ros2 launch f1tenth_stack bringup_launch.py

See https://github.com/ros-teleop/teleop_tools/blob/master/joy_teleop/config/joy_teleop_example.yaml

This is the my version of joy_teleop.yaml, you’ll notice that I have set stick_buttons to true.

I’ve also increased the joystick max velocity to 10 because why not??

joy:
  ros__parameters:
    device_name: /dev/input/js0
    deadzone: 0.01
    autorepeat_rate: 20.0
    coalesce_interval: 0.01
  	sticky_buttons: true
 
joy_teleop:
  ros__parameters:
    default:
      type: topic
      interface_type: ackermann_msgs/msg/AckermannDriveStamped
      topic_name: teleop
      axis_mappings:
        drive-speed:
          axis: 1
          scale: 0.0
          offset: 0.0
        drive-steering_angle:
          axis: 2
          scale: 0.0
          offset: 0.0
 
    human_control:
      type: topic
      interface_type: ackermann_msgs/msg/AckermannDriveStamped
      topic_name: teleop
      deadman_buttons: [4]
      axis_mappings:
        drive-speed:
          axis: 1
          scale: 10.0 
          offset: 0.0
        drive-steering_angle:
          axis: 2
          scale: 0.34
          offset: 0.0

I enabled sticky buttons, so you don’t have to run for the car.

The autonomous code publishes to /drive, regardless of whether you hold the deadman switch

However, if you look at the teleop topic, the command is only published when you hold the deadman’s switch for control.