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

How to get time for 1 looping program in ROS node ??

asked 2013-05-30 20:46:28 -0500

Rizqa gravatar image

updated 2013-05-30 20:49:53 -0500

Hi ROS fans..

How to get time for 1 looping program in ROS node ??

I hope someone can help me ^_^

edit retag flag offensive close merge delete


Please edit your question, adding some pseudo-code showing what you want to measure.

joq gravatar image joq  ( 2013-05-31 05:41:02 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2013-05-30 21:55:21 -0500

Lucile gravatar image

updated 2013-05-30 21:56:10 -0500

I am not sure exactly what you mean.

But if you want to know how many time does the loop you've written in a node last, you can use a time library.

I don't know about which library it is in C++, but in Python you can import 'time' and use the function 'clock()'. This function will return you the current date on your computer. Just call it at the beginning of the loop and have it printed in your terminal.

If you don't want to know the date but the time elapsed, just use a variable that your initialise once before the beginning of your loop and then, in your loop don't print 'clock()' value but clock() minus your initialised variable.

Hope that helps.

edit flag offensive delete link more

Question Tools


Asked: 2013-05-30 20:46:28 -0500

Seen: 304 times

Last updated: May 30 '13