# Calculate velocity of a moving frame from two different timestamp

Hi everyone, I have a moving frame (let's call it /moving) that is obviously moving w.r.t. some other frame (e.g. /world). With this setup, I can calculate the speed of the "moving frame" from two different timestamps in a trivial way like

listener.lookupTransform("moving","world", new_timestamp, t1)
listener.lookupTransform("moving","world", old_timestamp, t2)
delta_time = new_timestamp - old_timestamp
t3=t2.inverseTimes(t1) //the position displacement
translational_velocity = t3.getOrigin() / delta_time.toSec()


My question is: can I use the lookupTwist method to evaluate the DELTA speed between two different times (but same frame)? I mean,

listener->lookupTwist("moving","world", TIMESTAMP, ros::Duration(0.1), frame_speed);


gives the velocity w.r.t. the fixed frame, not the deltas.

Ideas? Thank you :-)

Augusto

edit retag close merge delete

Sort by » oldest newest most voted

It sounds like you want the change in velocity of the moving frame between times 1 and 2. in that case I think that calling lookuptwist of as you have at the two different times and then comparing them would give you the results you want.

more

Thank you tfoote, I tried your suggestion and seems it is all right. Let me verify it and then I'll post some lines of code! Bye, Augusto

( 2015-06-24 12:53:21 -0500 )edit