get rotation state of a joint with tf::listener.lookupTransform
Hello everyone,
I have a velodyne with a rotating joint.
Now, for each velodyne scan, I want to use tf to obtain the instantaneous pose of the lidar in order to be able to transform the 3D point clouds. For that, I use tf::TransformListener listener.lookupTransform
:
cloudCallback(inputPoints);
ros::Time scanTime = inputPoints->header.stamp;
listener.waitForTransform("world","velodyne", scanTime, ros::Duration(1.0));
listener.lookupTransform("world","velodyne", scanTime, transform);
however, I get always :
Extrapolation Error looking up joint pose: Lookup would require extrapolation at time 1882.101000000, but only time 1882.137000000 is in the buffer, when looking up transform from frame [velodyne] to frame [world]
I also have tried to use tf2_ros::MessageFilter
like here but I wasn't sure that's needed, since I'm getting the transformed data directly, so no need to transform it again.
or trying to define the transform listener as class member variable and initialize it in the constructor as suggested by @tfoote here or here
tf2_ros::Buffer tf_;
tf2_ros::TransformListener tfListener;
Ctr{tfListener(TF_),
...}
transformStamped = tf_.lookupTransform("world",ros::Time::now(),"md4_200/velodyne", scanTime,"world", ros::Duration(1.0));
with that, I get :
Extrapolation Error looking up joint pose: Lookup would require extrapolation at time 6505.806000000, but only time 6505.779000000 is in the buffer, when looking up transform from frame [velodyne] to frame [world]
I have checked using : rosrun tf tf_echo world velodyne
At time 6686.625
- Translation: [0.000, 0.000, 0.060]
- Rotation: in Quaternion [-0.671, 0.223, 0.671, 0.223]
in RPY (radian) [1.083, 1.571, -2.696]
in RPY (degree) [62.037, 90.000, -154.477]
At time 6686.625
- Translation: [0.000, 0.000, 0.060]
- Rotation: in Quaternion [-0.671, 0.223, 0.671, 0.223]
in RPY (radian) [1.083, 1.571, -2.696]
in RPY (degree) [62.037, 90.000, -154.477]
Can anyone help advise on to solve this issue please?
I tried with
ros::Time()
it works, but the scans are all offset, because the joint timestamps are different from the scan timestamps. what I want is to get the joint pose precisely in the scan timestamp.