Practice the ROS2 PID Controller for Velocity coding problem in Control. Browser-based execution with automated grading — no local ROS install required. 0% of engineers pass this challenge.
Implement a PID velocity controller as a ROS2 node that drives a robot's actual velocity to a configurable target.
Your node must:
target_vel (default 0.5) — the desired linear velocity in m/s/current_velocity (std_msgs/Float32) for the measured velocity feedbackPIDController class with method compute(setpoint, measurement, dt) → floatkp * errorki * error * dt — clamp to [-1.0, 1.0] (anti-windup)kd * (error - prev_error) / dtcreate_timer(0.05, ...) (20 Hz) control loop that:target_vel parameter each cycle (allows runtime updates via ros2 param set)pid.compute(target, measured, 0.05)geometry_msgs/Twist to /cmd_vel with linear.x = clamped_outputInput: std_msgs/Float32 on /current_velocity (measured speed)
Output: geometry_msgs/Twist on /cmd_vel
The ros2_control stack internally runs PID controllers for every hardware joint. Understanding how to implement one from scratch is essential before using the framework. Tune kp=1.0, ki=0.1, kd=0.05 and observe the step response — underdamped (oscillates), overdamped (slow), or critically damped (fast + smooth).
Input: /target_vel, /current_vel | Output: /cmd_vel
It is a hands-on Control 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 Medium problem focuses on Control skills used in robotics interviews and production systems.