ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | Q&A
Ask Your Question

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

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

Rizqa gravatar image

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

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

1 Answer

Sort by ยป oldest newest most voted

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

Lucile gravatar image

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

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

Your Answer

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

Add Answer

Question Tools


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

Seen: 266 times

Last updated: May 30 '13