Skip to content
Salvo Virga edited this page Sep 22, 2018 · 1 revision

simple_msgs - Transform

simple_msgs::Transform messages represent a 3D position and orientation in space.
It is composed of a simple_msgs::Point: X, Y, Z
and a simple_msgs::RotationMatrix: a 3x3 matrix.

A simple_msgs::TransformStamped message is a Transform + Header:
the pose can then be linked to a reference frame defined by Header.frame_id and their timestamp can be stored in Header.timestamp.

In code:

simple_msgs::Header my_header{0, "root", 1.0};
simple_msgs::Point my_point{1.0, 3.0, 2.0};
simple_msgs::RotationMatrix my_matrix{1.0, 0.0, 2.0,
                                      4.0, 5.0, 1.0,
                                      0.0, 0.0, 1.0};
simple_msgs::TransformStamped my_transformstamped{my_header, simple_msgs::Transform{my_point, my_matrix}};

You can manipulate the TransformStamped message using its setters/getters. E.g.

my_transformstamped.getTransform.getTranslation.setX(0.0);

Clone this wiki locally