-
Notifications
You must be signed in to change notification settings - Fork 197
vrx_classic_driving_teleop_tutorial
This guide explains how to manually control (teleoperate) the WAM-V using either a keyboard or a gamepad.
We first start the simulation with the command:
roslaunch vrx_gazebo sydneyregatta.launch
This launches an environment with a WAM-V, two articulated aft thrusters, controlled by the following topics:
/wamv/thrusters/left_thrust_angle
/wamv/thrusters/left_thrust_cmd
/wamv/thrusters/right_thrust_angle
/wamv/thrusters/right_thrust_cmd
Note: some customization is required to support teleoperation of other thruster configurations.
Next, follow the steps below to control the WAM-V using either keyboard or gamepad teleoperation.
To try out keyboard teleoperation, use the included example launch file:
roslaunch vrx_gazebo usv_keydrive.launch
Read the onscreen instructions for the relevant keyboard mappings for controlling the thruster speed and thruster articulation.
- We use the teleop_twist_keyboard package, along with a custom twist2thrust.py node to convert the Twist messages to two Float32 messages for the left and right thrusters.
- The
i
/,
keys command forward/reverse velocity (twist.linear.x) which is mapped to axial thrust (right+left) - The
j
/l
keys command counter-clockwise/clockwise rotational velocity (twist.linear.z) which is mapped to differential thrust (usvdrive.right-usvdrive.left). - Thruster articulation is enabled by default (see the Thruster Articulation page for configuration details)
Reading from the keyboard and Publishing Thrust Angles!
---------------------------
Change Thrust Angle clockwise: h
Change Thrust Angle counter-clockwise: ;
- See the Keydrive Details page for the details of how keyboard teleop is setup for the example WAM-V configurations.
To enable teleoperation using a gamepad, run:
roslaunch vrx_gazebo usv_joydrive.launch
The gamepad drives the left and right thrusters directly - similar to a differential drive wheeled robot.
- the left stick up/down axis (axis 1) is mapped to the left thruster forward/reverse,
- the right stick up/down axis (axis 3) is mapped to the right thruster forward/reverse
- the right stick left/right axis (axis 2) is mapped to rotating the thrusters clockwise/counter-clockwise
Therefore, pushing both sticks forward should cause the WAM-V to drive forward.
You can activate the ball shooter with the lower left trigger.
If you are using the default configuration:
- Make sure the Mode light is unlit.
- The switch on the bottom of the controller must be set to "D", not "X".
- We use the joy and joy_teleop packages, along with a custom twist2thrust.py node to convert Twist messages from the standard teleop to two Float32 messages for the thruster plugin.
- If you are using a different input device compatible with the joy package, you can edit the diffdrive.yaml configuration file so that the pertinent axis of your device are used.