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

get Yaw Pitch Roll values

asked 2021-06-28 04:24:14 -0500

omeranar1 gravatar image

updated 2021-06-28 04:57:58 -0500

fvd gravatar image

How can I get the yaw pitch roll values between joint and world?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2021-06-28 04:57:30 -0500

fvd gravatar image

On the command line: rosrun tf tf_echo source_frame target_frame

In Python:

import tf
listener = tf.TransformListener()
p_joint = geometry_msgs.msg.PoseStamped()
p_joint.header.frame_id = "your_joint"
p_joint_in_world = listener.transformPose("world", p_joint)
q = p_joint_in_world.pose.orientation  # Quaternion
rpy = tf.transformations.euler_from_quaternion(q.x, q.y, q.z, q.w)

In C++, I don't have boilerplate code on hand, but you could convert the geometry_msg.msg.Quaternion a Tf::Quaternion, convert it to a Matrix3x3 and call getRPY.

This answer assumes that you meant "Roll Pitch Yaw", because this is the standard in robotics. If you really need the YPR Euler angles, use the euler_from_quaternion function's axes parameter in Python, or the getEulerYPR function in C++.

edit flag offensive delete link more

Comments

its worked thank you

omeranar1 gravatar image omeranar1  ( 2021-06-28 05:20:14 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2021-06-28 04:24:14 -0500

Seen: 1,061 times

Last updated: Jun 28 '21