Skip to content
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

[Base] check the execution time of main loop #578

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

Li-Jinjie
Copy link
Contributor

What is this

The real execution time for the main loop is super critical. However, some optimization-based methods (e.g. MPC) might take longer time to execute the loop once. So I add some code to monitor this time, and if the real execution time is longer than tolerance, ROS_WARN will be printed.

@tongtybj tongtybj self-requested a review November 27, 2023 07:59
aerial_robot_base/src/aerial_robot_base.cpp Outdated Show resolved Hide resolved
if (~e.last_real.isZero())
{
double dt_real = e.current_real.toSec() - e.last_real.toSec();
double tolerance = 0.05;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Li-Jinjie

Why is this value hard-coding. Does 50 ms have a special meaning?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tolerance is the ratio with main_loop rate, and the specific value is set by my experience. Normally the main_loop rate has slight variation in each loop, and I think 5% is a suitable threshold for normal execution. Is it necessary to make this value a parameter?

@tongtybj
Copy link
Collaborator

@Li-Jinjie

Could you respond the review comment?

@Li-Jinjie
Copy link
Contributor Author

@Li-Jinjie

Could you respond the review comment?

Sorry, I will check it tonight. Don't know why I missed the reminder from GitHub...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants