Home▸Robotics & Kinematics▸Precise Positioning — PID Point-to-Point Control (2D)

Precise Positioning — PID Point-to-Point Control (2D)

A point-mass robot is driven to a click-set target by a real discrete PID controller acting on the position error. Tune proportional, integral and derivative gains and the robot's mass, toggle a random disturbance force, and watch live error, speed, overshoot and settling-time readouts respond exactly as a real closed-loop control system would.

Robotics & Kinematics2DModerate60 FPS📱 Mobile-adapted⇄ 3D version
2d-precise-positioning ↗ Open standalone

This 2D companion replaces the original page's decorative "AI training lab" dashboard — a shared cross-domain template whose reward/loss numbers were driven by a generic learning-progress counter, not by anything specific to positioning — with a real closed-loop control simulation that actually matches the title: a point-mass robot driven by a genuine discrete PID controller (Kp/Ki/Kd) toward a target you click anywhere on the field. Tune the gains and the robot's mass, toggle a wandering disturbance force, and read live position error, speed, overshoot and settling time exactly as a control engineer would measure them on a real system.

⚙ Under the hood

2D companion: a real PID controller (Kp/Ki/Kd, tunable mass and disturbance) drives a point robot to a click-set target, with live error, overshoot and settling-time readouts.

pid controlclosed-loop controlovershootsettling timerobotics2d

2D · HTML5 Canvas 2D · 60 FPS target · runs fully client-side, no install

Why does raising Kp alone make the robot overshoot the target?

A pure proportional term produces a control force proportional to the current error, so the robot keeps accelerating right up until it reaches the target — at that point it still has velocity and coasts past it before the (now reversed) error pulls it back. Adding derivative gain (Kd) counteracts this by braking in proportion to the current velocity, reducing overshoot without slowing the initial approach as much as lowering Kp would.

What does the integral term (Ki) actually fix?

Viscous friction and the disturbance force both act like a small steady bias the proportional and derivative terms alone can't fully cancel, leaving a persistent offset from the target. The integral term accumulates error over time and keeps pushing until that residual offset is driven to zero — at the cost of extra lag and, if Ki is set too high, oscillation.

How are overshoot and settling time measured here?

Overshoot is the distance the robot travels past the target along its original approach direction, expressed as a percentage of the initial distance to the target. Settling time is the elapsed time from when a new target is set until the position error stays continuously inside a small tolerance band — the same definitions used to characterise real PID-controlled systems.

What did you find?

Add reproduction steps (optional)