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

Create quaternion from euler in arduino

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

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 -0500

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 image parzival  ( 2019-11-09 11:48:40 -0500 )edit
parzival gravatar image parzival  ( 2019-11-09 11:57:03 -0500 )edit

Question Tools

1 follower

Stats

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

Seen: 827 times

Last updated: Nov 09 '19