-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Profile the RobotInterface::YarpRobotControl::setReferences method #270
Comments
Ok, but just to understand why you profiled Position instead of PositionDirect? I guess that for the actual walking you want to use PositionDirect, right? |
You're right, in the walking we use position direct. However, I started to profiling with the position control. When the position direct is used I have the following results
In the first If I comment I got the following performances
Notice that when position direct is used the joints' positions are retrieved only for a safety check. So if we want to run the controller at 1khz we may think to remove the check. I don't know if it can be moved in the firmware. |
I noticed that the current implementation of the
RobotInterface::YarpRobotControl::setReferences
is particularly slow. I wrote this simple main where I used thestd::chrono::steady_clock::now()
to profileRobotInterface::YarpRobotControl::setReferences()
.blf
is compiled in release.The application prints
This is unacceptable in our use-case. I also ran
callgrind
. In particular I edited the previous main withCALLGRIND_START_INSTRUMENTATION; robotControl.setReferences(Eigen::VectorXd::Zero(23), RobotInterface::IRobotControl::ControlMode::Position); CALLGRIND_STOP_INSTRUMENTATION; CALLGRIND_DUMP_STATS;
and I call
callgrind
(valgrind --tool=callgrind --instr-atstart=no ./blf-time-profiling
).Here I noticed that
setRefSpeed
is called 23 times..
This is actually a bug
https://github.com/dic-iit/bipedal-locomotion-framework/blob/d6d20969ce617af8510e8d1abb1985a6048107c0/src/RobotInterface/YarpImplementation/src/YarpRobotControl.cpp#L455-L468
Ineed
this->positionInterface->setRefSpeeds();
should be outside the for loopClick me if you want to check the full valgrind tree
callgrind_slow.out.zip
I fixed the bug and I ran again the test. Now the output of the application is
Click me if you want to check the full valgrind tree
callgrind_fast.out.zip
The text was updated successfully, but these errors were encountered: