Control Allocator Simulation

Hi! I am trying to run gazebo simulation of the control allocator module to simulate a motor failure on a multirotor (basically reproducing this demo).

In order to do that, I created a new gazebo model typhoon_ctrlalloc as described here and added the model in PX4-Autopilot/platforms/posix/cmake/sitl_target.cmake, then ran make px4_sitl_ctrlalloc gazebo_typhoon_ctrlalloc. The simulation started successfully. When I set CA_ACT0_MAX to 0 as suggested in the demo video, it sets the respective rows in the effectiveness matrix zero:

before setting CA_ACT0_MAX to 0:


after:

However, in my simulation, the multicopter crashes soon after (flight log) I am not sure what is causing the problem…

There seems to be quite a lot of changes to the control_allocator module after that demo was published. I wonder if we can do a similar simulation with the current code?

Thank you!

The PR you are referencing is work in progress by the author (@jlecoeur) and is not yet considered safe code to test unless you understand what the changes are doing.

What is your goal here, what are you trying to achieve? Perhaps there’s another way we can help you achieve that.

Thank you for the response!

I wanted to achieve fault tolerant control when motor failure is detected. I don’t think that can be achieved with the current static mixing table setup.

I just noticed there is a pr-control_allocation_testing branch available for testing and it seems to work fine! I will run tests on that branch first.