Ask Your Question
0

Create quaternion from euler in arduino

asked 2019-11-09 11:02:17 -0600

mateusguilherme gravatar image

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

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2019-11-09 11:47:37 -0600

parzival gravatar image

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

geometry_msgs::Quaternion odom_quat = tf::createQuaternionMsgFromYaw(th);
edit flag offensive delete link more

Comments

Add the following includes:

#include <tf/transform_broadcaster.h>
parzival gravatar imageparzival ( 2019-11-09 11:48:40 -0600 )edit
parzival gravatar imageparzival ( 2019-11-09 11:57:03 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-11-09 11:02:17 -0600

Seen: 15 times

Last updated: Nov 09