tf2_ros::Buffer.transform() missing timestamp
Hello everyone
I use tf2_ros::Buffer.transform()
to transform a geometry_msgs::WrenchStamped
into ageometry_msgs::WrenchStamped
in another frame at the same time. So the syntax is:
tf2_ros::Buffer.transform(geometry_msgs::WrenchStamped wrenchStamped1, geometry_msgs::WrenchStamped wrenchStamped2, const std::string & target_frame, ros::Duration timDur);
It seems to work fine but the wrenchStamped2 has an empty timestamp. Is this on purpose by the function and do I need to manually assign the timestamp?
The code looks basically like this (msg is the message from the subscriber callback function this code snippet is part of):
geometry_msgs::WrenchStamped msgWrench = msg->wrench;
msgWrench.header = msg->header;
msgWrench.header.frame_id = "EE_FORCETORQUESENSOR";
geometry_msgs::WrenchStamped worldFrameWrenchFTSensorStamped;
try
{
ros::Duration timDur(0.1);
std::string target_frame_("world");
buffer_.transform(msgWrench, worldFrameWrenchFTSensorStamped, target_frame_, timDur);
}
catch (tf2::TransformException &ex)
{
ROS_WARN("Failure %s\n", ex.what()); //Print exception which was caught
}
worldFrameWrenchFTSensorStamped.header = msgWrench.header;
Can you provide the actual code in which you're using your
tf2_ros::Buffer
object? Just the surrounding function or a few lines above and below would help.Sorry. I added the code. I hope it is clear what i am doing there.