Skip to main content
Version: ROS 2 Humble

Driving a Robot

caution

Make sure you have successfully set up the robot before attempting to drive it.

There are several ways to drive a Clearpath robot using ROS 2.

Joystick Teleoperation

Make sure your controller is paired to the robot computer. Visit the controller pairing guide for details.

With the robot services running, turn on your controller. Press and hold either L1 or R1, and use the left joystick to publish a linear velocity and yaw command. The L1 button will drive the robot at slow speeds, while R1 will drive the robot at fast speeds (only supported on some robots).

PS4 Contoller

Keyboard Teleoperation

Install the teleop_twist_keyboard ROS 2 package on the robot computer or on an offboard computer:

sudo apt-get update
sudo apt-get install ros-humble-teleop-twist-keyboard

Once installed, run the node:

ros2 run teleop_twist_keyboard teleop_twist_keyboard

If your robot uses a namespace, the namespace should be applied to teleop_twist_keyboard:

ros2 run teleop_twist_keyboard teleop_twist_keyboard --ros-args -r __ns:=/j100_0001

Command Velocity

You can manually publish to the cmd_vel topic through the command line by calling:

ros2 topic pub /cmd_vel geometry_msgs/msg/Twist \
"linear:
x: 0.0
y: 0.0
z: 0.0
angular:
x: 0.0
y: 0.0
z: 0.0"

Set the linear.x value to drive the robot forwards or backwards, and the angular.z value to rotate left or right.