! { loop {} }\nuse physical_ai_hal::*;\n\n// Bang-bang: full power, then slam to zero. It overshoots and wobbles.\n// Rebuild forward as a PROPORTIONAL drive — effort shrinks with the error —\n// so the rover eases in and settles inside the tighter tolerance.\nfn control(p: &mut Peripherals) {\n let dist = p.goal.distance();\n let bearing = p.goal.bearing();\n let turn = 1.2 * bearing;\n let forward = if dist > 0.05 { 0.9 } else { 0.0 }; // <-- bang-bang; fix me\n p.motors.set(forward - turn, forward + turn);\n}\ncontrol_loop!(control);\n","task":{"goal":[1.2,1.2],"time":14.0,"tol":0.12},"title":"Timers, PWM & Proportional Drive"}">
PYTHON · NUMPY · IN-BROWSER
Timers, PWM & Proportional Drive
PWM duty + a proportional law in real Rust — smooth the rover into the pad.