0
$\begingroup$

Rosanswers logo

HI

How to create a quaternion from Euler angles in arduino?

In python it is possible to use this function:

from geometry_msgs.msg import Quaternion
import tf
.
.
.
odom_orientation = Quaternion()
odom_orientation = tf.transformations.quaternion_from_euler(0.0, 0.0, th)

thanks


Originally posted by mateusguilherme on ROS Answers with karma: 125 on 2019-11-09

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Hi, since you just want yaw and not pitch and roll, you can use the following:

geometry_msgs::Quaternion odom_quat = tf::createQuaternionMsgFromYaw(th);

Originally posted by parzival with karma: 463 on 2019-11-09

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by parzival on 2019-11-09:
Add the following includes:

#include <tf/transform_broadcaster.h>

Comment by parzival on 2019-11-09:
More generally: http://docs.ros.org/diamondback/api/tf/html/c++/namespacetf.html#a66cb77b973c0db55c3ab8bbee4ac781b

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.