# How to approach a target pose via the XY surface normal?

I'm trying to make my panda approach an aruco marker target on the table. However, I also want as a constraint that it does so perpendicular to the target. Given that a pose has an orientation component I can specify this should be fairly simple. The part I'm struggling with is how to mathematically 'flip' the orientation of the target. Is it as simple as multiplying the goal orientation with the quaternion (1,0,0,0)? (which gets me the desired result on a level plane)

Recall that one of the reasons we like quaternions is, like Matrices, we can multiply them to get one quaternion that represents both of their effects together.

So, yes, if we know the orientation of the ARuCo marker, and we know some orientation to modify that orientation by, we can multiply and normalize to get the appropriate orientation:

tf2::Quaternion rotation, approachOrientation;
rotation.setRPY(0, M_PI, 0) // assuming we want to flip around pitch by 180 degrees

approachOrientation = arucoOrientation * rotation;
approachOrientation.normalize();

• "M_PI / 2" is 90 degrees. Commented Aug 15, 2023 at 11:42
• whoops, silly mistake! Thanks for the catch, I've corrected it.
– cst0
Commented Aug 15, 2023 at 14:10

Take a look at my example of docking to aruco at robotics.snowcron.com Important note to people who are going to block this post based on "you have to provide answer here": we are talking about 16 pages of "aruco docking". Full code. Few versions, from simplest, then increasing complexity. In any case, it uses quaternions, and I did my best to make sure it is explained. You have to create projection of aruco to the floor, then a line perpendicular to it, get angle to rotate your robot to this line, and a distance to the line...