Recover from disturbances and delayed measurements

A persistent disturbance can leave the robot short of its target. Integral action can remove that offset, while delayed measurements can make corrections arrive too late.

Browser walkthrough·Beginner·About 20 min

Try the controller

Run the robot. Change one setting and try again.

Go2 test lane

Paused · 0.0 / 12.0 s
More controls

Position 0.000 m · actual velocity 0.000 m/s · limited command 0.000 m/s

The robot is at 0.000 m at simulation time 0.0 s. The orange line marks the 1 m target; it is not a physical barrier. Run the experiment or scrub time below.

2D reference and fallback
Robot position over 12 secondsFinal position 0.925 meters. Maximum overshoot 0.075 meters. The dashed line is the 1 meter target.Target 1 m1.2-0.10 s12 s
At 12 s: position 0.925 m; target minus position 0.075 m; maximum overshoot 0.075 m. Overshoot is the largest distance beyond the target during the run.
Model, units, and limits

A one-dimensional model of the Go2's forward motion, integrated every 0.02 s. The drive approaches its requested speed with a 0.4 s lag: acceleration = (efficiency × command + disturbance − velocity) / 0.4. The command is limited to ±0.80 m/s. A timed command requests 0.50 m/s for 2 s, then zero. Feedback requests Kp × position error + Ki × accumulated error − Kd × measured velocity.

The accumulated error is clamped to ±2 meter-seconds. This simple clamp is not a complete anti-windup design. Delay applies to measured position and velocity; before a past sample exists, the measurement stays at the starting state. The disturbance is a speed bias, not a force in newtons. No friction, foot slip, sensor noise, or hardware safety system is modeled. The legs are animated from the distance covered, using the Go2's real link lengths; balance and walking are not simulated.

Optional reasoning check

Requirements and learning goals

Before you start

  • The proportional-feedback and velocity-damping lessons
  • A browser with JavaScript enabled

You will be able to

  • Explain proportional steady-state error under a persistent disturbance
  • Measure the tradeoff introduced by integral action
  • Recognize when delayed feedback worsens motion

A useful controller must handle more than its first approach on an ideal run. Here a persistent disturbance starts at 3 seconds. It adds a −0.15 m/s bias to the drive's velocity response, opposing forward motion. This is a simplified speed disturbance, not a measured force or a simulation of a particular slope.

The initial controller has = 2, = 0, = 0, efficiency = 1, and fresh measurements. We will first examine the offset it needs to oppose the disturbance, then test integral action and delay separately. Allow about 20 minutes and record each run's final error and maximum .

Try it

Press Run experiment to watch the robot. Ki changes how strongly accumulated position error contributes to the command. Open More controls for additional settings and Inspect time. The position trace is in 2D reference and fallback. Changing a setting pauses and resets the run.

  1. Reset. Inspect the position at 12 seconds and calculate target minus position.
  2. Keep all other settings fixed and set Ki to 0.60. Compare final error and maximum overshoot with the first run.
  3. Reset. Set disturbance to 0, Kp to 5, and measurement delay to 0.40 seconds. This isolates the effect of stale .
  4. Keep that delay and set Kp to 1. Compare both numeric metrics again.
  5. For a final experiment, choose your own gains with disturbance −0.15 and delay 0.20 seconds. Change one gain at a time. Record which setting meets the error budget below, or explain why your attempts do not.

A slider update reruns the experiment from the original starting state. It does not continue a previous trajectory. Use the time slider to inspect a run rather than treating the chart as a live robot.

Work through the lasting error

With proportional control alone, the robot must remain short of the target to keep requesting forward motion. At rest, the commanded speed contribution cancels the disturbance: 2 × error − 0.15 = 0. Solve for error to get 0.075 meters. The expected resting position is therefore 1 − 0.075 = 0.925 meters.

Checkpoint 1 of 2

With Kp = 2 the robot rests 0.075 meters short. Still without integral action, what lasting error does Kp = 4 leave?

Commit to an answer. Every choice explains itself.

An integral term can retain a forward contribution even when the position error becomes small. That reduces the lasting error, but accumulated error during the initial approach can create more overshoot. A small final error is not sufficient evidence of a good controller.

Check the expected results

The reset run finishes at about 0.925 meters with error +0.075 meters. Setting Ki to 0.60 brings the 12-second error to about −0.004 meters, but maximum overshoot rises from about 0.075 to 0.345 meters. Integral action improves one metric while worsening another.

For the separate delay experiment with zero disturbance and Kp = 5, a 0.40-second measurement delay produces about 0.398 meters of overshoot. Reducing Kp to 1 lowers it to about 0.184 meters. The controller acts on old position and velocity, so it may keep asking for motion after the robot has already passed the state it is reacting to.

Checkpoint 2 of 2

With a 0.40-second measurement delay, lowering Kp from 5 to 1 cut the overshoot from about 0.398 to 0.184 meters. Why?

Commit to an answer. Every choice explains itself.

Make a controller report

For the final combined experiment, aim for absolute final error below 0.02 meters and overshoot below 0.20 meters. These are classroom comparison thresholds, not robot safety limits. Record gains, disturbance, delay, error, and overshoot together. Report a failed budget honestly; changing the target criteria after seeing the result hides the tradeoff.

After your own attempts, compare Kp = 2, Ki = 0.20, and Kd = 1 at efficiency 1, disturbance −0.15 and delay 0.20. It produces about −0.015 meters final error and 0.091 meters overshoot in this model, meeting both classroom thresholds. This is one reproducible comparison, not an optimum.

You are done when you can explain the proportional offset, identify the cost of integral action, and support a controller comparison with both metrics.

Troubleshooting

Reset between the disturbance and delay comparisons so that effects do not get mixed. Delay is applied to position and velocity measurements, including the startup history; it is not a command delivery delay. If oscillation persists, reduce gain and inspect the full trace. None of these settings should be transferred directly to physical hardware without an appropriate model, instrumentation, and bounded testing.

Can you do each of these?

  • Explain proportional steady-state error under a persistent disturbance
  • Measure the tradeoff introduced by integral action
  • Recognize when delayed feedback worsens motion

0 of 2 checkpoints solved. Try checkpoint 1

Previous: Reduce overshoot with velocity damping
All lessons in this topic
  1. 1. Move a robot with a timed command
  2. 2. Correct position error with feedback
  3. 3. Reduce overshoot with velocity damping
  4. 4. Recover from disturbances and delayed measurements

Ask Wendy

Answers about Wendy and WendyOS

What would you like to know?

Ask about devices, development, and deployment.

Check linked docs for technical details.