Correct position error with feedback

Feedback uses the distance to the one-meter target to choose the next speed command. The robot keeps correcting its position even when the drive is weaker.

Browser walkthrough·Beginner·About 10 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 1.000 meters. Maximum overshoot 0.021 meters. The dashed line is the 1 meter target.Target 1 m1.2-0.10 s12 s
At 12 s: position 1.000 m; target minus position 0.000 m; maximum overshoot 0.021 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 timed-command lesson
  • A browser with JavaScript enabled

You will be able to

  • Calculate a proportional speed request
  • Explain command saturation
  • Compare feedback with a fixed timer

The timed command stopped after two seconds even when the robot had not gone far enough. A controller checks the measured position repeatedly. It can keep commanding motion while the robot is short of the target, reduce the request as it approaches, and reverse the request if it passes the target.

The target is still 1 meter. Define position error as target minus measured position. A proportional controller multiplies that error by a gain called . Here the error is in meters and Kp is in inverse seconds, so the requested command is in meters per second.

Rendering diagram…
Feedback. The measured position returns to the controller, which recomputes the command at every step.

The browser starts with Kp = 2 and drive efficiency = 0.60. There is no measurement delay or disturbance in this lesson. Allow about 10 minutes.

Try it

Press Run experiment to watch the robot. Kp changes how strongly the robot responds to its remaining position error. 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 the lesson and leave the defaults unchanged.
  2. Compare the final position with the previous lesson's 0.600-meter result for the same drive efficiency.
  3. Scrub the time slider. Observe how the limited command changes as the error shrinks. The robot's velocity follows the command with a lag.
  4. Set efficiency to 0.40. Predict whether the robot will stop at 0.40 meters or keep correcting its position, then inspect the 12-second result.
  5. Reset again. Reduce Kp to 0.50 and compare the early part of the motion with Kp = 2.00. Restore Kp = 2 for the worked calculation below.
Checkpoint 1 of 2

Drive efficiency drops to 0.40. With the timer, the robot stopped at 0.40 meters. What does the feedback controller do?

Commit to an answer. Every choice explains itself.

Calculate a command

At position 0.75 meters, the error is 1.00 − 0.75 = 0.25 meters. With Kp = 2, the requested speed is 2 × 0.25 = 0.50 m/s. At position 1.10 meters, the error is −0.10 meters, so the request is −0.20 m/s, back toward the target.

The drive accepts at most 0.80 m/s in either direction. At the start, Kp × error = 2 m/s, so the limiter sends only 0.80 m/s. This is saturation. Increasing Kp cannot make an already command larger.

Check the expected results

With the reset settings, the final position rounds to 1.000 meters after 12 seconds. The maximum is about 0.021 meters. At drive efficiency 0.40, the final position also rounds to 1.000 meters, although the approach takes longer.

The weaker drive changes the response, but feedback keeps using the remaining error. Unlike the timer, it has no fixed two-second stopping decision. A position close to the target at 12 seconds does not imply that the earlier motion was equally good: compare the curves and overshoot as well.

Predict another position

For Kp = 2 and a measured position of 1.30 meters, calculate the command before you choose.

Checkpoint 2 of 2

Kp = 2, target = 1.00 meter, measured position = 1.30 meters. Which command does the drive receive?

Commit to an answer. Every choice explains itself.

If you instead use Kp = 4, the request becomes −1.20 m/s and the applied command is limited to −0.80 m/s.

You are done when you can explain why a weaker drive can still reach the target and why an unlimited calculation may differ from the command sent to it.

Troubleshooting

If the result looks like a fixed two-second move, reopen this lesson or reset its controls. This page uses feedback mode throughout. A small overshoot is expected because the drive retains velocity while the command changes. If you inspect exactly time zero, the displayed state is the initial state before the first command update.

The PID lesson examines that overshoot and introduces velocity damping.

Can you do each of these?

  • Calculate a proportional speed request
  • Explain command saturation
  • Compare feedback with a fixed timer

0 of 2 checkpoints solved. Try checkpoint 1

Previous: Move a robot with a timed command
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.