Skip to content

StateSpaceObserver::Update() correction step is incorrect #2

@calcmogul

Description

@calcmogul

This is with regard to https://github.com/frc1678/robot-code-public/blob/master/muan/control/state_space_observer.h and the corresponding .hpp for reference.

The correction step of a Luenberger observer is supposed to use measurements from the same timestep as the model prediction. Since the correction occurs first in StateSpaceObserver::Update(), the corresponding prediction occurs at the end of the previous timestep. If Update() is given measurements taken immediately before the call (that is, they are taken during the timestep after the prediction), a factor of A^-1 needs to be premultiplied onto the correction term to step it back one timestep.

In other words, plant().x() += L() * (y - plant().y()); should be changed to plant().x() += plant().Ainv() * L() * (y - plant().y()); where plant.Ainv() returns a cached version of the inverse of A.

I have a proof in section D.4 of https://file.tavsys.net/control/state-space-guide.pdf.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions