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

Pose Transformation with Euler Angles

asked 2021-09-19 09:36:54 -0600

Gazi13 gravatar image

updated 2021-09-20 10:31:48 -0600

Ranjit Kathiriya gravatar image

ros-transform

link for the image : link text image description

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

Comments

I have uploaded image

Ranjit Kathiriya gravatar image Ranjit Kathiriya  ( 2021-09-20 10:34:01 -0600 )edit

1 Answer

Sort by » oldest newest most voted
0

answered 2021-09-19 20:36:30 -0600

osilva gravatar image

updated 2021-09-19 20:52:31 -0600

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:

http://wiki.ros.org/tf2_bullet http://wiki.ros.org/tf2/Tutorials/Cre...

edit flag offensive delete link more

Comments

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

gvdhoorn gravatar image gvdhoorn  ( 2021-09-20 02:06:49 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2021-09-19 09:35:04 -0600

Seen: 900 times

Last updated: Sep 20 '21