Ask Your Question

Mirror pose in quarternion

asked 2019-12-10 09:22:08 -0500

Abhishekpg gravatar image

Hi im using realsense camera to detect a aruco tag and move the robot to detected point. But the pose (orientation) of the robot is same as the tag. Ie i want the robot to face the aruco rather than in same pose of aruco. Is ther any methode to find the mirror pose for the robot ??

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2019-12-16 18:27:52 -0500

achille gravatar image

Assuming you are using a robot that moves in the plane with its z-axis pointing upwards and markers that have their z axis (mostly) pointing upwards, you can:

  1. publish the detected marker to tf2.
  2. create a static publisher relative to the detected marker that rotates around the local z-axis by 180 degrees to face the marker. See this tf2 tutorial for an example. You could also add in a translation here if you don't want your robot to move on top of the marker.
  3. move to the new mirror pose

The quaternion that rotates around the z-axis by pi radian would have w = cos(theta/2) = 0 and z = sin(theta/2) = 1 which you could insert in your launch file as:

<node pkg="tf2_ros" type="static_transform_publisher" name="mirror_marker_rotation_broadcaster" args="0 0 0 1 0 0 0 marker mirrored_orientation_marker" />

You could also manually do this math yourself by post-multiplying (right-multiplying) the rotation quaternion with the marker's quaternion. Note that if the z-axis of the markers aren't pointing perfectly upright and you are adding a translation (e.g. you move your robot to be 1m in front of the marker), these errors will cause the calculated pose to be offset from where you want it to be depending on much the z-axis diverges from the vertical.

edit flag offensive delete link more


Thank you for your answer. i got the mirror pose by flipping my x axis by 180 degree.

Abhishekpg gravatar image Abhishekpg  ( 2019-12-19 09:18:12 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2019-12-10 09:22:08 -0500

Seen: 153 times

Last updated: Dec 16 '19