Pose Transformation with Euler Angles
link for the image : link text
This is the problem. There is a camera on uav and try to detect and send pose of the tag. The detected tag is at center for both images but one of them gives different coordinates (e.g (3,0,0) should be (0,0,0) ) because of the roll angle. I want to transform (rotate) the pose of the tag by using roll-pitch-yaw angles coming from IMU. Something like transforming from cameraframe --> worldframe but by using angles not by frame_name.
BRİEF : I have a pose and want to transform by using angles not frame name. Not like this
transform = tf_buffer.lookup_transform(target_frame,
pose_stamped_to_transform.header.frame_id, #source frame
rospy.Time(0), #get the tf at first available time
rospy.Duration(1.0)) #wait for 1 second
pose_transformed = tf2_geometry_msgs.do_transform_pose(pose_stamped, transform)
This is a solution I found but doesn't work for me because ı don't want transform one frame to another. I want to transform by using angles.
This is the another solution which I tried but not sure is it a a proper way to do this..
mpose = PoseStamped()
mpose.pose.position.x = 3
mpose.pose.position.y = 0
mpose.pose.position.z = 0
mpose.pose.orientation.x = 0
mpose.pose.orientation.y = 0
mpose.pose.orientation.z = 0
mpose.pose.orientation.w = 0
v = Vector3Stamped()
v.vector.x = 3.0
v.vector.y = 0.0
v.vector.z = 0.0
static_transformStamped = geometry_msgs.msg.TransformStamped()
static_transformStamped.transform.translation.x = 0.0
static_transformStamped.transform.translation.y = 0.0
static_transformStamped.transform.translation.z = 0.0
quat = tf.transformations.quaternion_from_euler(30.0, 0.0, 0.0)
static_transformStamped.transform.rotation.x = quat[0]
static_transformStamped.transform.rotation.y = quat[1]
static_transformStamped.transform.rotation.z = quat[2]
static_transformStamped.transform.rotation.w = quat[3]
pose_transformed = tf2_geometry_msgs.do_transform_pose(mpose, static_transformStamped)
# I only need to convert x-y-z so, can also do vector transform.
pose_transformed = tf2_geometry_msgs.do_transform_vector3(v, static_transformStamped)
Asked by Gazi13 on 2021-09-19 09:35:04 UTC
Answers
I suggest to check pybullet, there are two functions that do what you are looking for:
getQuaternionFromEuler and getEulerFromQuaternion
https://pybullet.org/wordpress/index.php/forum-2/
Also look for:
http://wiki.ros.org/tf2_bullet http://wiki.ros.org/tf2/Tutorials/Create%20Data%20Conversion%20Package%20%28Python%29
Asked by osilva on 2021-09-19 20:36:30 UTC
Comments
Please update your answer to be more stand-alone: how exactly should @Gazi13 use getQuaternionFromEuler(..)
and/or getEulerFromQuaternion(..)
to solve his problem?
Asked by gvdhoorn on 2021-09-20 02:06:49 UTC
Comments
I have uploaded image
Asked by Ranjit Kathiriya on 2021-09-20 10:34:01 UTC