Ask Your Question
0

Verify loop_rate

asked 2015-03-24 05:32:50 -0500

Carollour gravatar image

I have set a loop rate in the following way:

ros::Rate r(100)
while(ros::Ok()){
    ros::SpinOnce();
    function();
    r.sleep();
}

Is there anyway to verify if I am accomplish this rate or if the function is taking longer than that? Thank you.

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
2

answered 2015-03-24 06:02:07 -0500

Chaos gravatar image

updated 2015-03-24 06:02:33 -0500

Hi! If you publish a topic you can verify the loop rate with:

rostopic hz /your_topic_name
edit flag offensive delete link more

Comments

thank you, that was it.

Carollour gravatar image Carollour  ( 2015-03-24 08:45:51 -0500 )edit
0

answered 2015-03-24 09:19:32 -0500

Adolfo Rodriguez T gravatar image

Consider using a ros::Timer. You have programatic access to nominal and real periods, hence you can take appropriate action when things start to go unexpectedly.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-03-24 05:32:50 -0500

Seen: 261 times

Last updated: Mar 24 '15