Driving with the Keyboard - Tina-1/Husky-A200-Balto GitHub Wiki

Driving Balto with the Keyboard

Two ways to drive balto from a keyboard. Both publish to the same topic:

  • Topic: /a200_0681/cmd_vel
  • stamped:=true is required — balto's cmd_vel is TwistStamped, so without it the robot ignores everything.
  • The robot cannot move sideways; only forward speed and rotation matter.

Go through the Safety Checklist first.

Option 1: teleop_twist_keyboard (recommended)

The standard package, no custom build. Run it on the onboard PC (with the venv activated):

ros2 run teleop_twist_keyboard teleop_twist_keyboard \
  --ros-args -r /cmd_vel:=/a200_0681/cmd_vel -p stamped:=true
u    i    o      forward-left,  forward,  forward-right
j    k    l      rotate CCW,    STOP,     rotate CW
m    ,    .      back-left,     reverse,  back-right
Key Action
i / , straight forward / reverse
j / l spin in place (no linear motion — the robot turns about its center)
u o m . arcs (linear and angular together)
k or Ctrl-C stop
q / z raise / lower both speeds by 10%
w / x linear speed only
e / c angular speed only

Option 2: Arrow keys from a laptop (optional)

Our package husky_key_teleop (entry point arrow_teleop) lives in ~/ros2_ws/src in WSL Ubuntu-24.04 with ROS 2 Jazzy — the same ROS 2 version as balto.

Note: if the laptop can't talk to the robot, the teleop script can also be run on the onboard PC itself.

Laptop setup: WSL networking

WSL2's default NAT networking blocks ROS 2 (DDS) discovery, so the laptop won't see the robot's topics. Fix it once in C:\Users\<you>\.wslconfig:

[wsl2]
networkingMode=mirrored

Then run wsl --shutdown in PowerShell and reopen Ubuntu. The laptop and balto must be on the same network and use the same ROS_DOMAIN_ID.

Steps

  1. Build (only needed after code changes):

    cd ~/ros2_ws
    colcon build --packages-select husky_key_teleop
    source install/setup.bash
  2. Start the teleop, pointing it at the robot's cmd_vel topic:

    ros2 run husky_key_teleop arrow_teleop --ros-args -p cmd_vel_topic:=/a200_0681/cmd_vel -p stamped:=true

Keys

Key Action
↑ / ↓ drive forward / back
← / → turn left / right
Space stop now
w / x change linear speed (±10%)
a / d change angular speed (±10%)
q or Ctrl-C quit

Hold an arrow to move, let go to stop (the robot stops ~0.35 s after the last keypress).

Parameters

Parameter Default Meaning
cmd_vel_topic /cmd_vel Topic to publish to
stamped false Publish TwistStamped instead of Twist
linear_speed 0.3 m/s
angular_speed 0.6 rad/s
publish_rate 20.0 Hz
hold_timeout 0.35 s without a keypress before stopping

Check the message type with ros2 topic info /a200_0681/cmd_vel.

References

⚠️ **GitHub.com Fallback** ⚠️