Skip to content
Salvo Virga edited this page Sep 22, 2018 · 4 revisions

simple_msgs - Quaternion

simple_msgs::Quaternion messages represent a 3D rotation in space: X, Y, Z, W.

A simple_msgs::QuaternionStamped message is a Quaternion + Header:
the rotation 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::Quaternion my_quaternion{0.0, 0.0, 0.0, 1.0};
simple_msgs::QuaternionStamped my_quaternionstamped{my_header, my_quaternion}

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

my_quaternionstamped.getQuaternion.setW(-1.0);

Note: simple sends the message that you create, you are responsible to check if the sent Quaternion is valid/normalized.

Clone this wiki locally