# How to calculate the time when robot moved from one position to another or to a some distance?

Hello

I would like to know the travel time for my robot when he move from one position to another. So for example I wont to know the time needed that my robot move 10 m forwards. So I have a map ov the environment and my platform has IMU, laser, Kinect and encoders. So I do not do any navigation just driving the platform for example 20 m forwards and wont to know the time needed to complete that task. Any help?

Thanks

Originally posted by Astronaut on ROS Answers with karma: 330 on 2013-05-14

Post score: 0

Comment by dornhege on 2013-05-15:
Are you driving yourself by hand? In that case, you'd anyways have inaccuracies in the measurements and you can just use a stopwatch instead of software.

Comment by Astronaut on 2013-05-15:
I need a software ROS solution and not a stopwatch. So I need to know the time when platforms move from one position in the map to other.

Comment by Astronaut on 2013-05-15:
Im not driving by my self. Im observing when someone else is driving it.

Comment by davinci on 2013-05-15:
You can read out the encoders to measure the travelled distance and run a timer in parallel?

Comment by Astronaut on 2013-05-15:
the encoders are drifted. So maybe better to use the pose, How to run a ROS timer??

Comment by davinci on 2013-05-15:
http://www.ros.org/wiki/roscpp/Overview/Timers

You can just use the system clock, and subtract the start time from the end time. In python

import time

start = time.clock()
# Do something
end = time.clock()

print end-start, 'seconds'


and in C++, use gettimeofday() or some similar function.

Originally posted by Bill Smart with karma: 1263 on 2013-05-15

This answer was ACCEPTED on the original site

Post score: 1