# How to calculate X, Y, Z, roll, pitch, yaw tf [closed]

I have two lidar units, as below with their respective coordinate frames shown. For the purposes of this lidar-lidar calibration tool which uses the same convention as the tf static_transform_publisher. I am required to calculate the x y z, yaw, pitch, roll of the right unit in the frame of reference of the left.

I have attempted such a calculation as follows:

ΔX = 0

ΔY = -17m * sin(78°) = -16.6m

ΔZ = 17m * cos(78°) = 3.5m

Roll, rotation around X = -24° = -0.42 radians

Pitch, rotation around Y = 0° = 0

Yaw, rotation around Z = 180° = 3.14 radians

(rotations are defined as being counter-clockwise if the vector is pointing at you.)

but these numbers, when broadcast, give a completely incoherent joint pointcloud, so I can only conclude that my calculations are erroneous. How can I calculate the correct X, Y, Z, Yaw, Pitch, Roll ?

This does not appear to be ROS related just pure geometry as such it's not on topic for this forum. I would suggest that you ask someone local to you to help you check your logic and also to check your assumptions about the axes. Your chart has some very ambiguous labels with respect to the orientations of the lasers. And there are many linear math tools that would make this computation a one liner if you know the pose of each of the sensors.

This is a question about ROS because I don't know how the ROS TF tool defined yaw pitch roll - I have found different ways of defining the transformations? I tried one way and it didn't work, which is the way used by the core ROS tool, TF?

If you're using Euler angles, the convention would be RPY (ie: Roll, Pitch, Yaw).

But all the TF2 API and the command line tools also accept a Quaternion as input, so if you want to avoid any ambiguity, I'd suggest to perhaps use those.