Adding an external flight mode from the fcu

I’m trying to add my own flight mode which uses neural networks for control instead of classical PD and P controllers.

I’m registering the flight mode by using the same uORB channels as the ROS2 interface.

In SITL everything works fine, and has in several configurations. I have finally found a way to make the mode registration without any error messages in HITL, but the mode still does not show up, neither with commander status, nor in QGC. Is there anyone who can see something I’m missing?

The code can be found here:

Log from SITL:
https://review.px4.io/plot_app?log=9d82295d-cb4e-4078-a6e4-275e3fbdbbe2

Log from HITL:
https://review.px4.io/plot_app?log=649d0204-cde9-4d6f-a487-6dc90b2196fe