Practice the ROS2 Two-Wheel Differential Drive Kinematics coding problem in Kinematics. Browser-based execution with automated grading — no local ROS install required. 0% of engineers pass this challenge.
Implement diff_drive_kinematics(v_left, v_right, wheel_base) that computes a differential drive robot's body velocities from its wheel velocities.
Implement a function:
def diff_drive_kinematics(v_left: float, v_right: float, wheel_base: float) -> tuple[float, float]:
Where:
v_left: left wheel velocity (m/s)v_right: right wheel velocity (m/s)wheel_base: distance between the two wheels, L (m)(v, omega):v: robot linear velocity (m/s) — positive = forwardomega: robot angular velocity (rad/s) — positive = counter-clockwisev = (v_right + v_left) / 2
omega = (v_right - v_left) / wheel_base
| v_left | v_right | wheel_base | v | omega |
|---|---|---|---|---|
| 0.5 | 0.5 | 0.5 | 0.5 | 0.0 |
| 0.0 | 0.0 | 0.5 | 0.0 | 0.0 |
| 0.0 | 1.0 | 0.5 | 0.5 | 2.0 |
| -0.5 | 0.5 | 0.5 | 0.0 | 2.0 |
| 0.3 | 0.7 | 0.4 | 0.5 | 1.0 |
These two lines of math are the entire forward kinematics of a differential drive robot. The TurtleBot3 driver, the Roomba ROS driver, and the Clearpath Husky all do exactly this calculation to publish odometry. If you get the sign wrong on omega, the robot turns the wrong direction.
It is a hands-on Kinematics challenge on SimuCode where you implement and run ROS2 code in the browser with runtime-verified tests.
Open this page, sign in, and solve the problem in the built-in IDE. Your solution is graded against real ROS2 execution checks.
This Easy problem focuses on Kinematics skills used in robotics interviews and production systems.