# virtual_joystick_teleop A ROS Noetic Python 3 GUI for driving a differential-drive robot from the keyboard or mouse. The virtual joystick shows the active arrow-key direction and can also be dragged for proportional control. The signed velocity controls follow the layout and interaction pattern of `rqt_robot_steering`, and the node publishes `geometry_msgs/Twist` on `/cmd_vel` by default. ## Controls | Input | Command | | --- | --- | | Up / Down | Positive / negative `linear.x` | | Left / Right | Positive / negative `angular.z` | | Drag joystick | Proportional linear and angular command | | Keyboard/joystick linear slider | Set the speed used by Up / Down | | Keyboard/joystick yaw slider | Set the speed used by Left / Right | | Vertical linear slider | Set signed `linear.x` directly | | Horizontal yaw slider | Set signed `angular.z` directly | | `+`, `0`, `-` / arrows | Step, zero, or reverse one velocity axis | | Min/max spin boxes | Change signed runtime limits, like rqt steering | | STOP, Space, or Esc | Immediately publish a zero command | | Restore defaults | Restore the startup speed values | Multiple arrow keys can be held together. For example, Up + Left commands forward motion while turning left. Dragging the joystick provides proportional control up to the configured speed. Keyboard and joystick inputs stop when they are released. While a non-zero command is active it is published at the configured rate. Releasing control publishes one zero `Twist`, then the node stays silent until the next command so another `/cmd_vel` publisher is not overwritten. Like `rqt_robot_steering`, the signed velocity sliders keep their command until an axis is reset to `0` or STOP is pressed. Moving focus away from the GUI, closing the window, or shutting down ROS still publishes a zero command. While a min/max field has focus, arrow keys only edit its number and do not control the robot. Press Enter or click outside the field to apply the value; focus then returns to the teleoperation window. ## Build and run ```bash cd /home/duongtd/T800_ws catkin_make --pkg virtual_joystick_teleop source devel/setup.bash roslaunch virtual_joystick_teleop virtual_joystick_teleop.launch ``` Keep the GUI window focused while using the arrow keys. To inspect the output: ```bash rostopic echo /cmd_vel ``` To remap the output topic or publish rate: ```bash roslaunch virtual_joystick_teleop virtual_joystick_teleop.launch \ cmd_vel_topic:=/robot/cmd_vel publish_rate:=30.0 ``` The initial speeds, adjustment steps, signed min/max limits, and UI limit ceilings are private ROS parameters in `launch/virtual_joystick_teleop.launch`. Linear values use m/s and yaw values use rad/s. The default linear range is `[-2.0, 2.0]` m/s. The spin boxes can expand it up to `linear_limit_ceiling`, which defaults to 5.0 m/s in either direction. For example, to allow the maximum-limit slider to reach 8.0 m/s while starting with a 3.0 m/s limit: ```bash roslaunch virtual_joystick_teleop virtual_joystick_teleop.launch \ min_linear_command:=-3.0 max_linear_speed:=3.0 linear_limit_ceiling:=8.0 ``` ## Safety note Do not let this node and a navigation controller command the same robot topic at the same time. Use a velocity multiplexer when several command sources must share control, and test with the drive wheels raised or the motor driver disabled before enabling motion on hardware.