get maximum computational available time

Firmware/software/electronics/mechanics
Post Reply
Maximiliandio
Beginner
Posts: 8
Joined: Sun Oct 18, 2020 1:51 pm

get maximum computational available time

Post by Maximiliandio »

Hi,

I want to implement a new MPC control architecture based on an online optimization (the lib is designed for embedded so it should work :D ) However I would like to check how much computational time I have left in the stabilizer loop. Any Ideas how to do this and get the remaining computational time?

cheers Max
arnaud
Bitcraze
Posts: 2538
Joined: Tue Feb 06, 2007 12:36 pm

Re: get maximum computational available time

Post by arnaud »

Hi,

This is not an easy question since the computation time or your algorithm will depend of the platform, so the best approach might be to actually test and see if there is any processing power left.

There is a way to get a task dump in the console tab of the client, when standing on the ground with a lighthouse deck installed (EKF is used as estimator) it looks like:

Code: Select all

SYSLOAD: Task dump
SYSLOAD: Load	Stack left	Name
SYSLOAD: 3.19 	172 	Tmr Svc
SYSLOAD: 75.33 	128 	IDLE
SYSLOAD: 1.12 	214 	CRTP-RX
SYSLOAD: 5.93 	163 	SENSORS
SYSLOAD: 0.0 	75 	PWRMGNT
SYSLOAD: 0.0 	252 	LOG
SYSLOAD: 0.0 	114 	USBLINK
SYSLOAD: 0.0 	92 	PARAM
SYSLOAD: 0.01 	125 	LH
SYSLOAD: 0.05 	116 	SYSTEM
SYSLOAD: 0.03 	62 	CRTP-TX
SYSLOAD: 4.73 	351 	STABILIZE
SYSLOAD: 5.10 	285 	KALMAN
SYSLOAD: 2.07 	175 	SYSLINK
SYSLOAD: 2.38 	93 	LEDSEQCMD
SYSLOAD: 0.0 	255 	CMDHL
SYSLOAD: 0.0 	217 	MEM
So it seems that about 75% of the time is left (IDLE). We do not know the distribution in time of these 75% though, this would only be possible by tracing but as far as I know there is not ready-to-go tracing in the Crazyflie (at time we have been experimenting with freeRTOS tracing but nothing has been pushed in the firmware). So I think testing and checking that your controller actually runs at the right rate might be the best.
Post Reply