hello-robot / stretch_ros2

ROS 2 packages for the Stretch mobile manipulators from Hello Robot Inc.
https://docs.hello-robot.com/0.2/stretch-tutorials/ros2/
51 stars 19 forks source link

Feature/gamepad mode #87

Open hello-fazil opened 8 months ago

hello-fazil commented 8 months ago

This PR introduces the new gamepad mode to the stretch driver

Gamepad mode enables the provided gamepad with stretch to control the robot's motions with ros2 Stretch Driver. If the gamepad USB dongle is plugged out, the robot will stop making any motions in this mode and can be plugged back in real-time. Activate Gamepad Mode by calling the /switch_to_gamepad_mode service when the stretch driver is running.

Alternatively, in this mode, stretch driver also listens to /gamepad_joy topic for a valid Joy-type message from a remote gamepad to control stretch remotely in the network. The Joy message formats and helper functions are provided in the gamepad_conversion.py

Added the remote_gamepad.py which allows a user to plug-in the provided gamepad USB dongle to a remote workstation in network and teleop the robot remotely through ROS2.

Remote Gamepad Teleop

Published topics

Joy Message Reference Index Table

Axes

Index Gamepad Button Name Stretch motion Description Float Data range Default
0 left_stick_x Base Rotational speed -1 to +1 0
1 left_stick_y Base Linear speed -1 to +1 0
2 right_stick_x Arm Linear speed -1 to +1 0
3 right_stick_y Lift Linear speed -1 to +1 0
4 left_trigger_pulled Precision mode (if v>0.9) 0 to +1 0
5 right_trigger_pulled Fast Navigation mode (if v>0.9 and lift,arm is in stow pos) 0 to +1 0

Buttons

Index Gamepad Button Name Stretch motion Description Integer Data holding Default
0 left_stick_button_pressed Un-Assigned 0 or 1 0
1 right_stick_button_pressed Un-Assigned 0 or 1 0
2 bottom_button_pressed (A) Gripper Close 0 or 1 0
3 right_button_pressed (B) Gripper Open 0 or 1 0
4 left_button_pressed (X) Switch between Dex/Head 0 or 1 0
5 top_button_pressed (Y) Stow robot 0 or 1 0
6 left_shoulder_button_pressed Wrist_Yaw CCW rotate 0 or 1 0
7 right_shoulder_button_pressed Wrist_Yaw CW rotate 0 or 1 0
8 select_button_pressed (back) Long-press Shutdown 0 or 1 0
9 start_button_pressed (start) Home robot if not calibrated 0 or 1 0
10 bottom_pad_pressed (down) Wrist_Pitch / Head_Tilt CW rotate 0 or 1 0
11 top_pad_pressed (up) Wrist_Pitch / Head_Tilt CCW rotate 0 or 1 0
12 left_pad_pressed (left) Wrist_Roll / Head_Pan CW rotate 0 or 1 0
13 right_pad_pressed (right) Wrist_Roll / Head_Pan CCW rotate 0 or 1 0