ROS2 Two-Wheel Differential Drive Kinematics

Easy Kinematics 0% pass rate

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.

Problem Statement

Implement diff_drive_kinematics(v_left, v_right, wheel_base) that computes a differential drive robot's body velocities from its wheel velocities.

Requirements

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)
  • Returns (v, omega):
    • v: robot linear velocity (m/s) — positive = forward
    • omega: robot angular velocity (rad/s) — positive = counter-clockwise

Equations

v     = (v_right + v_left) / 2
omega = (v_right - v_left) / wheel_base

Test Cases

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

🤖 Why This Matters in Real Robots

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.

Frequently asked questions

What is the ROS2 Two-Wheel Differential Drive Kinematics practice problem?

It is a hands-on Kinematics challenge on SimuCode where you implement and run ROS2 code in the browser with runtime-verified tests.

How do I practice ROS2 Two-Wheel Differential Drive Kinematics online?

Open this page, sign in, and solve the problem in the built-in IDE. Your solution is graded against real ROS2 execution checks.

What skills does ROS2 Two-Wheel Differential Drive Kinematics test?

This Easy problem focuses on Kinematics skills used in robotics interviews and production systems.