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

tf::createQuaternionFromYaw equivalent in ros2

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

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
2

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

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

2 followers

Stats

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

Seen: 2,394 times

Last updated: Nov 02 '20