PART 13 / Intermediate

Robotics: estimation, planning & control

How can uncertain sensing produce stable movement?

Guided illustrated lesson

What you will learn

Simulate a closed-loop rover with bounded commands, state estimates, and documented failure conditions.

Before you begin: Foundations: matter, mathematics & computation; From neurons to brains

START WITH A QUESTION

Picture this.

You turn a shower tap, feel the water, and adjust again. That is feedback: act, observe the consequence, correct. A robot does something similar, except its measurements have units, coordinate frames and timestamps that must agree.

Plant
The system whose behavior a controller is trying to influence.
Feedback
Using observed consequences to adjust subsequent actions.
Coordinate frame
The reference axes and origin used to describe a quantity.

Read for the idea first. Work through the numbers next. Try answering the questions before opening the explanations.

Goal, estimate, command, consequence

A controller compares a target with an estimated state. The difference is the error. The plant is the process being controlled, such as a cart. A sensor reports information about the resulting motion, closing the loop. An open-loop command does not use the consequence to correct itself. Feedback can compensate for some disturbances, but it can also amplify a wrong sign or act on stale measurements. Draw the entire loop before concentrating on the neural component.

Start with a very simple plant

Let position be x in meters, and let the command u directly specify velocity in meters per second. Then x_next = x + dt*u. A proportional controller sets u = Kp*(target−x). With a positive gain, a position below the target requests positive motion. This plant has no inertia or motor lag, which makes it easy to calculate by hand. A command representing force or acceleration would require different dynamics. Units tell you which model you have actually written.

Why an eager controller can overshoot

Substitute the command into the update. For a fixed target, the next error is (1−dt*Kp) times the old error. At dt*Kp = 0.2, 80% of the error remains each step. At 1.5, the error changes sign and shrinks. At 2.5, it changes sign and grows. This connects directly to the recurrent scalar model in Part 3. A mathematical condition for this ideal plant does not automatically survive sensor delay or inertia, but it teaches what to look for in a trace.

Where learning can help

A neural model might estimate obstacles or motion from observations. A separate controller can use that estimate to stabilize the plant. Keep perception uncertainty and timestamps attached to the output. Integral control accumulates error over time; derivative control responds to its rate of change. Those extensions solve different problems and need their own tests. First log target, estimated state, command and actual simulated state. A single successful trajectory does not reveal how the system handles noise, delay or missing observations.

SEE THE RELATIONSHIPS

From structure to behavior.

Control: a labelled conceptual diagram
Figure 13.1 · Control. Original educational diagram; synthetic, not a measured result.
The reasoning pathTarget & estimate then Controller then Plant/body then Sensor feedback1. Target & estimate2. Controller3. Plant/body4. Sensor feedback
A learning flow for this part. Follow the assumptions through to an observable result.

MAKE THE IDEA PRECISE

The mathematics.

e = x_target - x; u = Kp e; x_next = x + dt u
Symbols and units
SymbolMeaning
x, x_targetActual and desired position, meters
ePosition error, meters
KpGain, inverse seconds for this velocity-input model
uCommanded velocity, meters per second
dtStep duration, seconds

Build the equation, step by step

  1. Define error as target minus current position. A positive proportional gain then commands motion toward a fixed target in this ideal model.
  2. Treat u as a velocity command and multiply by dt to get a position increment. If u were acceleration or motor torque, the plant equation would be different.
  3. Substitute the controller into the update. For a fixed target, next error is (1 − dt Kp) times current error. This ideal scalar model converges when 0 < dt Kp < 2; real delays and dynamics change that condition.

WORK THROUGH THE NUMBERS

Worked example

Starting at 0 m with a 1 m target, Kp = 2 per second and dt = 0.1 s, the first command is 2 m/s and the state becomes 0.2 m. The next state becomes 0.36 m as the error decreases.

A small Python experiment.

Python 3 · Standard library only · Synthetic educational example. Run this in your own notebook or a local file.

x, target, gain, dt = 0.0, 1.0, 2.0, 0.1
for _ in range(2):
    velocity = gain*(target-x)
    x += dt*velocity
    print(f"{x:.2f} m")

Read the code as a story

At each step the program recalculates error from the current position. It converts error to velocity, multiplies by dt, and updates position. The second command is smaller because the first step reduced the error. A common mistake is to calculate velocity once outside the loop, which turns this example into a different, open-loop behavior.

Expected output

0.20 m
0.36 m

Change one quantity, predict the result, and then run the code again. Explain any difference before adding complexity.

Test your understanding.

Try it: Try dt times Kp greater than 2. Explain the resulting behavior before adding saturation.

Self-check: Why is the same gain not automatically valid at a new update rate?

The effective discrete correction depends on dt Kp. Changing the time step changes how strongly each update acts and can introduce oscillation or instability. A real robot also has delays, saturation and dynamics absent from this example.

Where this model stops: The ideal plant ignores inertia, sensor lag and actuator bounds. Its stability analysis does not transfer directly to physical hardware.

A research question: Does the neural layer improve performance when sensing delay and uncertainty are matched?

Record evidence in your mastery worksheet →

PREDICT / TRY / EXPLAIN

Read stability from three traces

Use paper, a calculator or the Python example. Write your prediction before checking the result.

  1. For target 1 and initial position 0, use dt*Kp = 0.2. Calculate three positions.
  2. Repeat with products 1.5 and 2.5. Work with error first, then recover position as 1−error.
  3. Sketch the traces and label monotonic approach, alternating approach and alternating growth.
Compare with a worked solution

The positions are [0.2, 0.36, 0.488], [1.5, 0.75, 1.125] and [2.5, −1.25, 4.375]. The second trace overshoots but converges in this ideal model. The third grows away from the target. These conclusions follow from the error multipliers 0.8, −0.5 and −1.5.

CLOSE YOUR NOTES

Can you explain it back?

These questions test the reasoning, not just a remembered phrase. Say your answer out loud or write a sentence first.

01Why must Kp have units of inverse seconds here?

Reveal the reasoning for question 1

Position error is in meters and the command is in meters per second, so the gain must supply the per-second factor.

02Will clipping an unstable command always fix the controller?

Reveal the reasoning for question 2

No. Saturation changes the dynamics and may bound commands while leaving oscillation or large tracking errors. Analyze and test the resulting closed loop.

TAKE THE IDEA WITH YOU

Three things to remember.

  • Name the plant and command units before choosing a control law.
  • Feedback uses fresh consequences to adjust actions.
  • The product of gain and timestep shapes this ideal discrete response.

Next we apply the same discipline to a flying vehicle, beginning with a force balance rather than a motor command.

Continue to Part 14 →

THE NEXT LAYER

Chapter depth map.

This introduction provides a first model. The following chapters are outlines for deeper future editions; their full treatments have not yet been published.

Geometry and dynamics

13.1 Where is the robot? · Outline
  1. 13.1.1 Coordinate systems and frame transforms
  2. 13.1.2 Rotation matrices and orientation conventions
  3. 13.1.3 Forward and inverse kinematics
  4. 13.1.4 Dynamics, forces and inertia
  5. 13.1.5 Units, timestamps and sensor extrinsics
13.2 Control and estimation · Outline
  1. 13.2.1 Feedback control and stability
  2. 13.2.2 PID, saturation and integral windup
  3. 13.2.3 State-space models and Kalman filters
  4. 13.2.4 IMU bias, sensor fusion and observability
  5. 13.2.5 Optical flow and uncertainty propagation

Perception to motion

13.3 Navigation systems · Outline
  1. 13.3.1 SLAM and map uncertainty
  2. 13.3.2 Planning and collision checking
  3. 13.3.3 Trajectory generation and tracking
  4. 13.3.4 Sensor dropouts and recovery
  5. 13.3.5 ROS 2 concepts as an optional integration layer
13.4 A neural controller interface · Outline
  1. 13.4.1 Camera to SNN to activity decoder
  2. 13.4.2 Descending-neuron-like output as an analogy
  3. 13.4.3 Command bounds, rate limits and watchdogs
  4. 13.4.4 Separate learned decisions from stabilization
  5. 13.4.5 Simulation comparisons with classical control

Read with the original sources.

These readings support the concepts and deeper investigation. The worked numbers and illustrations above are teaching examples.

Official engineering documentation

PX4 — official simulation guide ↗

Begin with simulation and versioned interfaces. Simulation success alone does not establish hardware flight readiness.

Complete source register →

Where next?