Optimal way to gather many transforms
I need to collect transforms at a certain interval from time N to N + S, to use them in some vectorised calculations.
ind = 0
for i in range(start, end, (end - start) / steps):
listener.waitForTransform(targetFrame, sourceFrame, rospy.rostime.Time(0, i), timeout)
translation, rotation = listener.lookupTransform(targetFrame, sourceFrame, rospy.rostime.Time(0, i))
transforms[ind] = listener.fromTranslationRotation(translation, rotation)
ind += 1
I am worried however about the efficiency of this operation - it takes quite a long time, I assume due to the way I am waiting for the transforms. For arguments sake, the lookup is started well after the TF listener is created, so the TF buffer has a complete picture of the transforms in the time I am asking for.
Is this the most efficient method to look up a large number transforms in a known interval? I've scoured through ROS TF and can't find anything that will allow me to return a batch of TF's, only one at a time. Thanks.