Change the Flight control algorithm

I would like to ask about some advice in changing the flight code, or more specific how to change the PID algorithm to something like a MPC (model predictive control) or any other control algorithm.

This is more or less about gathering information and not about how to do this specific
(at least up to now… maybe I will consider doing so in the future)

Is it plausible to change the internal code directly and build a custom px4 flight code? On the one hand it would be great to test flight control algorithms without conflicts by some px4-pid-controls. On the other hand it sounds like a lot of works and an easy way to ruin your drone upon errors… Would the px4-sitl still work if the px4 code is changed?

Or should I stick with the offboard control mode and use velocities and position for a custom position control (c++ ros node). But then I would lose my control influence - because the px4 position control pid would do something on top of that…

Also I would like to change some parameters while in flight - like the max velocity of my drone - is it possible to do so by some mavros commands?

Kind regards

1 Like