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 camera_frame --> world_frame 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,
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
static_transformStamped.transform.rotation.y = quat
static_transformStamped.transform.rotation.z = quat
static_transformStamped.transform.rotation.w = quat

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)
edit retag close merge delete

Sort by » oldest newest most voted I suggest to check pybullet, there are two functions that do what you are looking for:

getQuaternionFromEuler and getEulerFromQuaternion

https://pybullet.org/wordpress/index....

Also look for:

more

Please update your answer to be more stand-alone: how exactly should @Gazi13 use getQuaternionFromEuler(..) and/or getEulerFromQuaternion(..) to solve his problem?