0
$\begingroup$

Rosanswers logo

I'm on ROS2 Foxy and cannot find the toMsg() function for Vector3 that used to be in tf2_geometry_msgs.h. In previous versions the following function exists:

geometry_msgs::Vector3 tf2::toMsg (const tf2::Vector3 &in)

Has it been moved or removed completely? What shall I use instead? I do not really fancy to use the stamped version of Vector3.

Thanks!


Originally posted by rblilja on ROS Answers with karma: 35 on 2020-12-11

Post score: 0


Original comments

Comment by rblilja on 2020-12-12:
I have a custom message with multiple vectors and a header (with time and frame id). Therefore I don't see the necessity to use stamped vectors.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

It's Vector3Stamped now. Most all of the ROS2 TF2 non-Stamped conversions were removed. I don't know the exact reason why, but I'm going to speculate that it has to do with TF2 in general really only supporting Stamped types so the conversions to/from messages really don't need the non-stamped versions anymore. The only exception I can find to that is Quaternion which is needed by the other functions regarding the transform message.

https://github.com/ros2/geometry2/blob/ros2/tf2_geometry_msgs/include/tf2_geometry_msgs/tf2_geometry_msgs.h#L110.

Just as a policy, if you're using TF2, it's good to use stamped variants so you don't make silly mistakes like misassigning frames/data to their proper timestamps and frames.


Originally posted by stevemacenski with karma: 8272 on 2020-12-12

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.