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

tf::createQuaternionFromYaw equivalent in ros2

asked 2020-11-02 03:04:04 -0600

How should I create a quaternion of a simple yaw (zaxis) rotation in ros2?

The alternative in ros1 were essentially tf::createQuaternionMsgFromYaw or tf::createQuaternionFromYaw but these options are not there anymore.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted

answered 2020-11-02 08:56:41 -0600

Phgo gravatar image

As far as I know there is no out of the box tf/tf2 function that does that in ros2.

However, you can easily achieve that with a simple helper function e.g.:

auto createQuaternionMsgFromYaw(double yaw)
  tf2::Quaternion q;
  q.setRPY(0, 0, yaw);
  return tf2::toMsg(q);
edit flag offensive delete link more

Question Tools



Asked: 2020-11-02 03:04:04 -0600

Seen: 2,268 times

Last updated: Nov 02 '20