Lighthouse versus other state estimates: which one to log/pull?

Discussions related to positioning systems where the position is calculated outside the Crazyflie and sent to the device using radio, including MoCap systems
Post Reply
mouhyemen
Beginner
Posts: 13
Joined: Sun Feb 02, 2020 5:24 pm

Lighthouse versus other state estimates: which one to log/pull?

Post by mouhyemen »

I am confused with so many logging variables giving position, velocity, and attitude estimates.

There's lighthouse.x/y/z, kalman.stateX/Y/Z, stateEstimate.x/y/z. Similarly, for velocities and attitudes. Then there's also stabilizer.roll/pitch/yaw.

Which ones should I work with if i want:
  • Linear states:
    • position in world frame
    • velocity in world frame
    • acceleration in world frame
  • Angular states:
    • Roll/pitch/yaw angles
    • velocity in body frame
    • acceleration in body frame
It would be very helpful if there's a documentation/wiki explaining the differences.
PS: I am using a LH for localizing the cf.
kimberly
Bitcraze
Posts: 518
Joined: Fri Jul 06, 2018 11:13 am

Re: Lighthouse versus other state estimates: which one to log/pull?

Post by kimberly »

It depends which you would want. Position directly from lighthouse is a direct measurement, as from the state estimator is an estimate. Usually looking into the code of the firmware will do the trick but documentation is indeed a problem.
  • The lighthouse positioning won't work since now the position is only estimated within the kalmanfilter, unless you enable a flag that enables the 'old' way of positioning in the lighthouse deck driver.
  • Linear states:
    • position in world frame: stateEstimate.x/z/y (the kalman one would also do since that is already in world coordinates)
    • velocity in world frame: stateEstimate.vx/vz/vy
    • acceleration in world frame: stateEstimate.ax/az/ay
  • Angular states:
    • Roll/pitch/yaw angles: stateEstimate.pitch/roll/yaw
    • velocity in body frame: kalman.Px/Py/Pz (this function rotates the kalman estimates to world coordinates before it sends it to the stabilizer.
    • acceleration in body frame: there is no logging of this, but check out this variable accSnapshot. Here it is put into the externalize-state function, which rotates some variables from a body to a world coordinate system. You can make your own logging variable to read this out from estimator_kalman.c
Let us know if you are still confused
Post Reply