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

How do i use tf2_ros to convert from quaternions to euler?

asked 2020-12-26 04:11:43 -0600

Qilos gravatar image

Hello guys,

After a lot of time of setup i finally managed to be able to import tf2_ros in python3. I really would like to use tf2_ros to convert the orientation message of the odometry to roll, pitch and yaw angles. I read that you need to use tf2 to transform it.

I imported tf2_ros and tried the function:

(r,p,y) = tf2_ros.euler_from_quaternion(ori_list)

and

(r,p,y) = euler_from_quaternion(ori_list)

Both resulted in an error that euler_from_quaternion is not defined or that it is not an attribute of tf2_ros

What do i need to do to use the transformation? I preferably would like it to work with python3

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2020-12-26 14:07:43 -0600

SmallJoeMan gravatar image

updated 2020-12-26 16:50:17 -0600

The transformations.py module was not included in the migration to tf2: https://github.com/ros/geometry2/issu...

I suggest you use transforms3d: https://pypi.org/project/transforms3d/.

edit flag offensive delete link more
0

answered 2020-12-26 14:42:02 -0600

updated 2020-12-26 14:44:24 -0600

You have used the kinetic tag. Are you sure you are using ros-kinetic? Because from what I know, ros-kinetic only has support for python2. If you want to use python3, you will have to migrate to ros-noetic or ros2.

Also, have you included tf2 in your code (import tf2_ros)? Can you post your code here so we can see what exactly is going on.

edit flag offensive delete link more

Comments

You are partially right, ros kinetic is made with python 2 but with a few tweaks its possible to run it with python3

Qilos gravatar image Qilos  ( 2021-01-08 14:48:15 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2020-12-26 04:11:43 -0600

Seen: 2,226 times

Last updated: Dec 26 '20