State estimation & Control
State estimation
Depending on the sensors connected, the Flapper Nimble+ uses either a complementary filter (no addon sensors attached) or an Extended Kalman Filter to estimate its states. Both of these filters are described in more detail in the crazyflie firmware documentation.
Should you want to implement your own estimator, a clean way of doing so is the "out-of-tree" build.
Complementary filter
With no external sensors attached, only a subset of states is estimated with a lightweight Complementary filter using the onboard IMU and barometric pressure sensor measurements.
Extended Kalman filter
The Extended Kalman Filter (EKF) requires additional sensors but can provide full 6 DOF state estimates. The default implementation assumes zero drag, and so its performance on the flapping-wing platforms with non-negligible drag is sub optimal. An updated EKF, with drag terms included, performs much better. Please consult this Pull Request by Stein Stroobants (TU Delft) if you would like to test it.
Setpoints & Commander framework
Depending on the needs of your application, the crazyflie firmware allows you to set setpoints to various controllers. This is done via the Commander framework.
The low level commands are handled by the Commander. They can be sent continuously from your remote controller (transmitter or Android/iOS app) or your PC (via Crazyradio and the CFlib) or from your custom onboard “app”. The High-level commander then includes a planner that generates setpoints onboard from individual trajectory segments (e.g. take off, go to, spiral, land) or full trajectories stored in the onboard memory.
Controller
Cascaded PID Controller
The default (and only officially supported) controller of the Nimble+ is a cascaded PID. It's structure and implementation is described in the crazyflie firmware documentation.
The control gains are stored in platform_defaults_flapper.h.
Your own Controller
Should you want to implement your own controller, a clean way of doing so is the "out-of-tree" build, with some more insights in this blogpost.