ADVRHumanoids / modularbots_fraunhofer

0 stars 0 forks source link

Different execution time depending on selected schedule type #7

Open MarcoMagriDev opened 10 months ago

MarcoMagriDev commented 10 months ago

Hi,

I am encountering a strange behavior in the execution time of a function if the thread in which the function is run is scheduled using fifo.

Setup description

Problem description

If the scheduling type of the thread in which the plugins runs is set to fifo the execution time result ~100 micros. If instead the scheduling type is set to other the execution time result in ~5 micros (same execution time that i get on other PCs)

Note: no rebuild is performed between the change of scheduling type so the difference of behavior must be introduced by this setting

@EdoardoRomiti @alaurenzi have you ever encountered a similar problem? have you any idea how to solve this?

alaurenzi commented 10 months ago

I don't know what could cause this. I'd try not to use linux clock though, as Xenomai has its own wrappers. XBot::chrono::steady_clock provides an API for this.

MarcoMagriDev commented 10 months ago

Unfortunately I don't think the issue is related with the way in which execution time is measured since even If I leave only my_test_function() in the code the execution time difference can be noticed by the robot behavior and from the bar next to the plugin in the xbot2-gui.

I noticed this using a different function that normally takes more, like ~200 micros (in a non patched PC or under schedule: other) but generates overruns if scheduled using fifo

alaurenzi commented 10 months ago

Can you share the content of this function? Have you seen this behavior only with this specific function?