robotology / whole-body-estimators

YARP devices that implement estimators for humanoid robots.
27 stars 12 forks source link

Analyze the time profiling of WBD methods #141

Open GiulioRomualdi opened 2 years ago

GiulioRomualdi commented 2 years ago

I'm trying to run WBD at 1khz. As discussed in https://github.com/ami-iit/robots-configuration/pull/10 I increased the rate of all the devices used by wbd.

In the context of xprize I wrote a simple time profiler for wbd https://github.com/robotology/whole-body-estimators/commit/e44b223b3fc1890b8454863d270141c6ed2b5180. Running the profiler with wbd at 1khz I obtain the following result

timer name average time (s) deadline misses last deadline miss time (s)
publish 0.000395487473 0 0
compute forces 0.000179018516 0 0
calibration 4.18783e-07 0 0
kinematics 2.4863994e-05 0 0
remove offset 0.000285472475 0 0
contact points 1.5841566e-05 0 0
read sensors 2.9965689e-05 0 0
all 0.000937095005 8351 0.001013504

Accordingly to the table there seems that wbd spends considerably amount of time in publishing and removing offsets (low pass filtering). Checking with @prashanthr05 we noticed that a a possible bottleneck is due to yarp-to-idyntree copy

https://github.com/robotology/whole-body-estimators/blob/bf7d5ff892c38ed2346857477b603a3dd386e36e/devices/wholeBodyDynamics/WholeBodyDynamicsDevice.cpp#L2183-L2292

To avoid these copies we could replace the yarp vectors in ctrLibRT filters with eigen refs/vectors.

cc @prashanthr05 @HosameldinMohamed @traversaro @isorrentino @S-Dafarra

traversaro commented 2 years ago

Checking with @prashanthr05 we noticed that a a possible bottleneck is due to yarp-to-idyntree copy

Not sure if that copy can be so expensive, even considering that the buffers are already allocated and of the right size. Anyhow, worth investigating.