I am curious about the cycle of Crazyflie.
I am currently studying RTOS inside the firmware, and I would like to know the execution cycle and time of each thread when I connect flow_deck, multi-ranger, and loco-position deck.
/* The stabilizer loop runs at 1kHz (stock) or 500Hz (kalman). It is the
* responsibility of the different functions to run slower by skipping call
* (ie. returning without modifying the output structure).
*/
I found the above contents in the stabilizer.c file.
If I use the three decks I mentioned, can I know the runtime of the stabilizer and the execution time of the other decks?
Crazyflie frequency(run time, frequency)
Re: Crazyflie frequency(run time, frequency)
hi!
You can manually put in a timer if you want. There is this headerfile called usec_time.h in the firmware repo. You start it with
at the very beginning of the driver (at startup of your crazyflie), than in the loop of your deck driver or where you want you can save the timestamps:
Or something like that (do double check is this runs though)
If you would like to know the complete run time (if it goes through all the other modules), you can calculate the start_time at the end of the while loop and the end_time at the beginning and than measure it, or you measure in the while loop of stabilizer.c
You can manually put in a timer if you want. There is this headerfile called usec_time.h in the firmware repo. You start it with
Code: Select all
initUsecTimer()
Code: Select all
uint64_t start_time,end_time;
while(){
start_time = usecTimestamp();
***code you want to test out**
end_time = usecTimestamp();
DEBUG_PRINT('code took %d usec to run, pend_time-start_time);
}
If you would like to know the complete run time (if it goes through all the other modules), you can calculate the start_time at the end of the while loop and the end_time at the beginning and than measure it, or you measure in the while loop of stabilizer.c