Level 5 · Research Engineer · Introductory university. Calculus, programming, linear algebra and engineering physics. · about 55 min
Knowing where you are: state, estimation and fusion
State-space models, stability from eigenvalues, and fusing noisy sensors into one honest estimate.
You'll be able to
- Write a sampled control loop in state-space form x[k+1] = A·x[k] + B·u[k] and form the closed-loop matrix.
- Decide stability of scalar and 2×2 discrete-time systems from their eigenvalues.
- Fuse two independent measurements by inverse-variance weighting and state the fused uncertainty.
- Design a fair baseline comparison for a fused estimator and describe how a proposed study would use one.
01The problem
Every controller in this expedition has assumed something it can't really have: perfect knowledge of where the robot is. A real arm carrying an object with another arm sees through a camera that drops out whenever an arm crosses the lens, and it feels through joint encoders and force sensors that are always available but drift and wander.
Two questions now sit underneath "how does a robot get where it wants to go?" First: given a model of the robot and its controller, can we prove the loop settles, rather than hoping a simulation run is typical? Second: when every sensor is imperfect in a different way, how should a robot combine them into one estimate, and how certain should it be of that estimate?
And how would you show, convincingly, that a new combination of sensors is actually better? Answering that needs a model, an estimator, and a fair experiment.
Watch the idea in action
before you read on
The first video is the core one; the second is optional. Pause whenever you want, then carry on with the explanation below.
A quick official look at how a rover works out where it is with no GPS, using its own images.
→ Under two minutes: a real robot estimating where it is with no GPS.
1 min 35 s · captions on YouTube · source
Nothing loads from YouTube until you press play.
Builds intuition for estimating what you can't measure directly when your sensors are noisy.
→ The intuition behind estimating a state you can't measure directly from noisy sensors.
6 min 47 s · captions on YouTube · source
Nothing loads from YouTube until you press play.
02The idea
State: everything the future depends on
A system's state is the smallest set of numbers that, together with future inputs, determines its future. For a first-order joint it is one number, the angle. For a joint with inertia it is two, angle and angular velocity, because knowing where something is doesn't tell you where it will be unless you also know how fast it's moving.
Collecting the state into a vector x, a sampled linear system is written
x[k+1] = A·x[k] + B·u[k]
This state-space form covers every model in this expedition. The Level 4 sampled loop is the 1×1 case with A = a and B = K·(1 − a). A double-integrator joint with position and velocity is a 2×2 case. Feedback u = −F·x gives a closed-loop matrix A − B·F, and the whole question of stability becomes a question about that one matrix.
Stability from eigenvalues
In the scalar case the answer is immediate: x[k] = a^k · x[0], which decays exactly when |a| < 1. For a matrix the same role is played by its eigenvalues: special directions along which A just scales the state by a number λ. Any initial state is a combination of those directions, so the system decays if and only if every eigenvalue has |λ| < 1. The largest |λ| is the spectral radius; it sets the slowest decay rate. Complex eigenvalues come in conjugate pairs and mean the state rotates as it shrinks: an oscillation you can see in a step response.
This is a proof, not an observation. A simulation shows one run; the eigenvalues cover every initial condition.
Estimation: an honest best guess
The controller needs x, but sensors only give noisy, partial readings of it. An estimator maintains a best guess of the state and a measure of how uncertain that guess is, usually a variance.
When two independent sensors measure the same quantity, the best linear combination weights each by the inverse of its variance. A precise sensor gets a large weight, a noisy one a small weight, and the fused variance is smaller than either. Even a worse sensor adds information.
The Kalman filter applies this repeatedly. It predicts the state forward with the model, which increases the uncertainty, then updates with each measurement by inverse-variance weighting, which reduces it. When a sensor drops out, there is no update: the estimate runs on the model alone and its uncertainty grows until the sensor returns. A good filter also estimates slowly varying errors such as a sensor's bias, which is how the lab's filter corrects drifting odometry.
Evidence needs a baseline
Claiming that fusion "works" means nothing without a comparison. A fair baseline uses the same data, the same trials and the same metric, and differs only in the method being tested. For a fused estimator, natural baselines are each sensor on its own, for example the camera holding its last reading through dropouts. An ablation removes one ingredient, such as the bias estimate, to show which part matters. Results should be reported across several random seeds, because one lucky run proves little.
Recap
State-space models turn a control loop into a matrix, and its eigenvalues decide stability for every starting condition. Estimators fuse imperfect sensors by weighting them according to their uncertainty, keeping track of how much they know. Showing that a new estimator is better needs a fair baseline, ablations and repeated trials.
03See it move
Predict before you experiment
During a camera dropout, what do you expect the Kalman filter's uncertainty band to do?
04The maths
Scalar stability
For x[k+1] = a·x[k] + b·u[k] with u = −f·x, the closed loop is x[k+1] = (a − b·f)·x[k], stable when |a − b·f| < 1. The Level 4 result Kp_max = (1 + a) ÷ (K·(1 − a)) is this condition with b = K·(1 − a) and f = Kp.
A 2×2 joint model
A joint with inertia, error e and velocity v, sampled every T and integrated with a simple forward step:
e[k+1] = e[k] + T·v[k]
v[k+1] = v[k] + T·u[k]
u[k] = −Kp·e[k] − Kd·v[k] (PD control)So x = (e, v) and the closed-loop matrix is
A = [ 1 T ]
[ −T·Kp 1 − T·Kd ]Eigenvalues of a 2×2 matrix
The eigenvalues solve λ² − tr(A)·λ + det(A) = 0:
tr(A) = 2 − T·Kd
det(A) = 1 − T·Kd + T²·Kp
λ = (tr ± √(tr² − 4·det)) / 2If tr² < 4·det the pair is complex, λ and its conjugate, and since their product is det(A), each has |λ| = √det(A). The envelope of the error then shrinks by a factor |λ| every sample.
Inverse-variance fusion
Two independent unbiased readings z1, z2 with variances σ1², σ2²:
w1 = 1/σ1², w2 = 1/σ2²
ẑ = (w1·z1 + w2·z2) / (w1 + w2)
σ̂² = 1 / (w1 + w2)Writing the first reading as a prediction with variance P and the second as a measurement with variance R gives the scalar Kalman update: gain G = P ÷ (P + R), new estimate = prediction + G·(measurement − prediction), new variance = (1 − G)·P. It is the same calculation.
05Worked example
A joint uses the 2×2 model above with T = 0.1 s, Kp = 5 and Kd = 1. Is the closed loop stable? How many samples until the error envelope falls to 10 % of its starting size?
Show the worked solution
Matrix.
A = [ 1 0.1 ]
[ −0.5 0.9 ]Trace and determinant. tr = 2 − 0.1 = 1.9; det = 1 − 0.1 + 0.01 × 5 = 0.95.
Real or complex? tr² = 3.61 and 4·det = 3.80, so tr² < 4·det: the eigenvalues are a complex pair and the joint oscillates as it settles.
Size. |λ| = √0.95 ≈ 0.9747 < 1, so the loop is stable. A short check:
import cmath
T, kp, kd = 0.1, 5.0, 1.0
tr = 2 - T * kd # trace of A
det = 1 - T * kd + T * T * kp # determinant of A
lam = (tr + cmath.sqrt(tr * tr - 4 * det)) / 2
print(round(lam.real, 3), round(lam.imag, 3), round(abs(lam), 4))0.95 0.218 0.9747Decay time. Solve 0.9747^k = 0.1: k = ln 0.1 ÷ ln 0.9747 ≈ 89.8, so about 90 samples, or 9 s at T = 0.1 s. Stable, but slow: more damping would help.
06Your experiment
- Open the fusion lab and press Reset (Kalman filter, camera noise 3 cm, 25 % dropout, odometry bias 1.5 cm/s).
- Find a hatched dropout region and watch the uncertainty band through it. Note how its width changes.
- During a long dropout, compare the fused line with the dashed odometry line, which drifts further from the truth the longer it runs.
- Raise the dropout probability to 50 %. Record the RMSE of the camera alone, odometry alone and the fused estimate.
- Switch the fusion method to complementary and record the fused RMSE again. Then press Regenerate to try two more seeds, recording both methods each time.
Record: Record each RMSE for each method and seed. State the baseline you are comparing against, and write one sentence on whether the Kalman filter beat it in every seed you tried, not just on average. Note one ablation you would run next and what it would tell you.
07Guided practice
A camera reads 50.0 cm with σ = 2 cm and a force-based estimate reads 53.0 cm with σ = 5 cm. What is the inverse-variance fused estimate and its σ?
Hint
Weights are 1/4 and 1/25. The fused variance is 1 ÷ (sum of weights).
Answer
ẑ = (0.25 × 50.0 + 0.04 × 53.0) ÷ 0.29 ≈ 50.41 cm, σ̂ = 1 ÷ √0.29 ≈ 1.86 cm, better than the camera's 2 cm alone.
A scalar system x[k+1] = 1.05·x[k] + u[k] is unstable on its own. With feedback u = −f·x, which values of f make it stable?
Hint
You need |1.05 − f| < 1.
Answer
−1 < 1.05 − f < 1, so 0.05 < f < 2.05. Too little feedback leaves it growing; too much makes it oscillate with growing amplitude.
A team reports that their fused estimate has an RMSE of 1.2 cm and calls it “much better”. What is missing before you can judge that claim?
Hint
Better than what, on which data, over how many runs?
Answer
A baseline on the same trials (for example the camera alone holding its last reading), the same metric for it, and results over several seeds or trials with their spread. Without those, 1.2 cm is just a number.
08Check your understanding
09Technical challenge
Use the 2×2 PD joint model from this lesson with T = 0.1 s and Kp = 5. What derivative gain Kd makes the closed-loop eigenvalues a complex pair with |λ| = 0.90 exactly?
10Engineering & research
State estimation and sensor fusion run inside almost every autonomous system: phones fuse gyroscopes and accelerometers, drones fuse inertial sensors with GPS, and mobile robots fuse wheel odometry with cameras or laser scanners.
Tactiverge's proposed TV-01 study asks whether inexpensive local force sensing can compensate for intermittent visual information in cooperative manipulation of deformable materials. In this lesson's terms, the force sensors are a second, always-available sensor that could carry an estimate through camera dropouts. A credible test would follow the pattern you practised: decide the metric in advance, compare the fused system with a vision-only baseline on the same trials, deliberately create dropouts so conditions are controlled, ablate the force input, and report every trial with its spread.
TV-01 has not been carried out. It has no results, and nothing in this lesson is evidence for or against its hypothesis. It is a worked example of how a research question becomes a design.
Something unclear or not working here? Tell us.
Original Tactiverge material, not yet externally reviewed by educators. CC BY 4.0.