Hi guys, I’ve been having a problem recently where the Pixhawk seems to be “pausing” in midair during a mission. The reason why it feels like this is that in the log, there are periods of about 0.5 seconds or less where there is no new data point. See the picture below. This “pause” happens on ALL data in the log (battery data, etc), not just the ones associated with controller. Visually, during the time periods when this occur, the drone drifts out of position, as if the commands from the controller has not been updated for 0.5 seconds and the motors maintain their last value. Afterwards the drone tries to correct itself.
The firmware that I’m running is a modified version of PX4, with my own top level mission controller (custom mission module) that feeds position and velocity setpoints direction to the mc_pos_control module. This “pause” does not occur consistently, only happening about 3 times so far in over 100 flights.
Has anyone seen this kind of problem before? I’m currently suspecting that it either has to do with SD card or memory stacksize. Would a bad SD card slot/contact make this possible? Or would modules reaching their stacksize limit cause this? (Previously the entire autopilot freezes if the stacksize limit is exceeded, and can’t be recovered without a power cycle)
That looks like a dropout in the log caused by excessive latency in SD card writes.
I can see how logging dropout can cause what we see in the logs here, but I would think that dropout should only affect the logging thread, and not the controllers. The quadrotor shows instability in the air whenever these dropouts in logging happens, as if the controller is put on pause as well, and the motors are running on old inputs.
Since you are flying a modified version of the firmware you might be running into stack overflow issues. This causes undefined behavior, i.e. the symptoms are not the same every time. I have seen freezes in mid-air, dead drops (as if disarmed), and uncontrolled position hold behavior, all caused by the same stack overflow in the position control module.
Have a close look at your stack usage.
Increase the stack size for the module you are working on. Refer to Pixhawk: Stack size in CMakeLists.txt and in px4_task_create()
Can you reproduce this on the firmware version on top of which you are developing you on code?
Did you add print statements? Those can use quite a bit of stack depending on their complexity.
Yes hitting the stack limit is something I suspected as well. I will increase stacksize and see what happens. As this is a problem that happens only occasionally, it will be hard to verify if a fix works or not, Thanks for your help!