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

Revision history [back]

click to hide/show revision 1
initial version

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 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 make it print. 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.

I am not sure exactly what you mean. 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. 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 make have it print. 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.