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

Revision history [back]

click to hide/show revision 1
initial version

According to the documentation for tf2_msgs/TFMessage (here), the transforms field is a list/array, so you'll need to index into it:

geometry_msgs/TransformStamped[] transforms

Something like msg.transforms[0].transform.translation.x.

But realise that you may receive multiple TransformStampeds in a single message, so always using the first might not be what you want.