Skip to content

Instantly share code, notes, and snippets.

@simutisernestas
Last active January 30, 2024 10:26
Show Gist options
  • Save simutisernestas/14047512cbffd355a5c29d0c4cbf0eb5 to your computer and use it in GitHub Desktop.
Save simutisernestas/14047512cbffd355a5c29d0c4cbf0eb5 to your computer and use it in GitHub Desktop.
ROS2 tf2 Quaternion to RPY
....
#include <tf2_geometry_msgs/tf2_geometry_msgs.h>
int main()
{
....
tf2::Quaternion quat_tf;
geometry_msgs::msg::Quaternion quat_msg = pose.pose.orientation;
tf2::fromMsg(quat_msg, quat_tf);
double r{}, p{}, y{};
tf2::Matrix3x3 m(quat_tf);
m.getRPY(r, p, y);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment