Ask Your Question

Revision history [back]

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 :-)