# Revision history [back]

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.