ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

tf2::toMsg(tf2::Vector3) in ROS2 Foxy?

asked 2020-12-11 15:54:59 -0500

rblilja gravatar image

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.


edit retag flag offensive close merge delete


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.

rblilja gravatar image rblilja  ( 2020-12-12 02:12:58 -0500 )edit

2 Answers

Sort by ยป oldest newest most voted

answered 2020-12-11 23:18:29 -0500

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.

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.

edit flag offensive delete link more

answered 2022-06-20 17:13:58 -0500

charlie92 gravatar image

updated 2022-06-20 17:14:11 -0500

Later versions of ROS2 (galactic) brought back the non-stamped versions

edit flag offensive delete link more

Question Tools



Asked: 2020-12-11 15:49:06 -0500

Seen: 1,491 times

Last updated: Jun 20 '22