Lighthouse-Crazyflie States and Parameterized Controller

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
Posts: 13
Joined: Sun Feb 02, 2020 5:24 pm

Lighthouse-Crazyflie States and Parameterized Controller

Post by mouhyemen »

Items: Crazyflie 2.1 Starter Kit and Lighthouse Deck w/ HTC cameras
Goal: Autonomously control Crazyflie using attitude based control and parameter estimates (mass/inertia).
  • State Estimation: I am interested in getting the following state information:
    linear position, velocity, acceleration in world frame [WF], and angular position, velocity, acceleration in body-frame [BF].
    I believe Lighthouse will provide WF linear position and orientation of the system. WF velocities is provided from state estimator. I am not sure how/where I can extract angular body-rate velocities and body-rate accelerations as well as and linear acceleration in the world frame . Also, if my understanding is wrong on one of these points, do correct me.
  • Control Design: I want to design a control input that generates the commanded thrust as a function of the mass. Taeyoung Lee's controller for instance uses the mass property. Assuming I have an external estimator for the mass, I want to incorporate this into my thrust calculation. Please advise which controller currently in the API can do this. If not, where do I make my changes.
  • Items: The equipment that I listed above, are they enough for the goals listed in this thread? Let me know what more is required from my end.
I have more questions but this is my starting point.
Posts: 523
Joined: Fri Jul 06, 2018 11:13 am

Re: Lighthouse-Crazyflie States and Parameterized Controller

Post by kimberly »


Thank you for your structured forum post :) In general we do like if there is one forum thread per question, since this will be easier for us to answer an other people to comment on it, but I will answer them here now. Just remember it for the future.

State estimation
It is not entirely correct that the lighthouse provides X Y Z position just like that. It actually provides sweep angles, which is the angle on where the lighthouse deck is detected in the lighthouse horizontal and vertical axis. The measurement model inputs this into the Kalman filter, which turns this into a position estimate very roughly said. But to understand that you would need to know how Kalman filter work and dig into the code.

Second of all, the state estimator outputs velocity in BF, but this gets transformed to WF before it goes to the stabilizer (that happens here. If you look into this function, it becomes clear which values are in BF or WF, and you can read those values from the logging parameters of the estimator_kalman file (or from stabilizer.c). You can read out the logging variables from either the cfclient or through a script in the CFlib (check examples in the github repo).

For some, like angular rate and such, you might need to read the raw sensor data, which should al have their own logging variables.

Control design
The Mellinger controller uses a mass varibable that can be tuned.

As long if you have all the means to callibrate the HTC vive basestations, than yes :)
Post Reply