Offboard mode is not dropped

Hi!

I observed bizarre, unexpected behavior from the SDK (2.4.1) when it must drop the offboard mode, but it didn’t happen.

My mission computer sends SET_POSITION_TARGET_GLOBAL_INT messages by calling the Offboard plugin’s set_position_global method at a high rate of ~20Hz (this part works perfectly as expected).

At some point, this stream of messages is stopped (another app in the processing pipeline crashed).

I expect that one of the Failsafe modes will be activated according to the COM_OF_LOSS_T and COM_OBL_RC_ACT parameters, but it’s not. The drone continues to fly straight instead of doing RTL.

After digging around and turning on the MAVSDK_MESSAGE_DEBUGGING flag, I noticed messages continued to be sent even after the mission computer stopped sending them.

Can anyone explain the behavior? I hope this is not intentional behavior.

After digging into the source code of the Offboard plugin, I found out why it’s happening. Apparently, the Offboard plugin has an interesting approach to ensure a continuous flow of positions via a scheduling callback every 0.05 seconds. But this is not compatible with Failsafe modes. When the external caller stops calling plugin set methods, the plugin itself continues to send the last cached value.