Understanding the Controller Structure

Firmware/software/electronics/mechanics
Post Reply
tnecniv
Beginner
Posts: 3
Joined: Fri Jun 07, 2019 3:18 pm

Understanding the Controller Structure

Post by tnecniv » Tue Jul 02, 2019 5:09 pm

Hi all!

I mentioned in a previous post that I'm playing around with the Crazyflie 2.1 for use in an educational setting. For one of the assignments, we want the students to implement an LQR controller to stabilize the quadrotor about the hover state. Since we want to limit the class to primarily be in Python, I determined that the best way to go about this assignment would be for the students to design the LQR controller in simulation using Python and then upload their gains to the Crazyflie for use in an onboard LQR controller that I write in C. Specifically, I am working with a linearization of the model in Mellinger's paper about the hover state and using the Flow Deck for positioning.

I've been digging around the source code and playing with a few things and I have a couple of questions:
  1. It seems that, for both the PID and Mellinger controller, there are a bunch of different modes the user can set that impact the structure of the feedback loop (e.g. the values in the stab_mode_t enum). A cursory search didn't provide me with very much documentation. Is there a reference for these modes, and which should I worry about implementing for my purposes?
  2. To confirm, the first three fields of the control_t struct, which are named roll, pitch, and yaw, are the moments about the three axes and the same as the inputs u_2, u_3, u_4 in the Mellinger paper, not commanded angles or something like that?
  3. Lookinging at state_t, it says that the attitude is given in a legacy CF2 body coordinate system. Is this coordinate system documented anywhere?
Thanks for the help!

As a side note, I've found that with the default gains, the CF2.1 hovers very nicely using the PID controller, but the default Mellinger gains have a lot of drift. Is this typical?

Post Reply