# Mirror pose in quarternion

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 close merge delete

Sort by ยป oldest newest most voted

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.

more

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

( 2019-12-19 09:18:12 -0600 )edit