I’ve been modifying the code to add different logs, and no matter what I try I have been unable to log anything at > 50 Hz, regardless of how often the function is called. I have tried both the “easy way” and “hard way” outlined in the documentation, and I have tried both calling my logging function at a high frequency from the scheduler as well as calling it from within another function that updates at a high frequency. Nothing seems to work so far. I’m using a Pixhawk 1 board if that makes a difference. Does this mean the code is failing to run at high frequencies or is it updating at a high frequency and just failing to log fast enough?
Additionally, the logging frequency does not seem precise. E.g. when trying to record at 25 Hz, I get frequency ranges from 24.5 to 25.5 which is undesirable.
on plane the main loop is only 50Hz, you could up the loop rate.
± 0.5 Hz is not too bad, logging gets quite a low priority in the scheduler.
Ah, alright that is helpful. Is there any reason the main loop is at 50 Hz by default even though some tasks are called at frequencies up to 400 Hz in the scheduler?
After upping the frequency I get an error as large ±10 Hz for the logging. While error in the logging frequency isn’t too bad like you’re saying, for the work I’m doing I want to be able to ensure that the low level control responds at precisely the desired frequency. It seems testing this through logging is not the best way, is there a better way you recommend?
thinking about it again I guess it makes sense that upping the loop rate make the logging less consistent it will have less ‘spare’ time.
The loop rate is 50hz by default because that is all that is needed, Quadplanes and copters run at 400hz.
Why is the exact frequency so important? you could just do faster logging and interpolate to down to the frequency you need?