ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Verify loop_rate

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

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 -0600

Chaos gravatar image

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

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 -0600 )edit
0

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

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

Question Tools

1 follower

Stats

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

Seen: 649 times

Last updated: Mar 24 '15