I am trying to convert a transformation matrix from one coordinate system to another. The first coordinate system looks like this in a pybullet simulation:
I'm assuming this coordinate system would be:
X = Forward
Y = Away From Camera
Z = Up
Though I'm not sure about the orientation of the XY plane.
The second coordinate system looks like this:
I'm assuming this coordinate system would be:
X = Forward
Y= Up
Z = Toward The Camera
Though I'm not sure about the orientation of the XZ plane.
The coordinate conversion should then be something like this:
(X,Y,Z)->(X,-Z,Y)
This is the following code I wrote to achieve the transformation:
def transform_matrix(self,transformation_matrix):
#X maps to X (1,0,0)
#Y maps to -Z (0,0,-1)
#Z maps to -Y (0,-1,0)
C = np.matrix([
[1, 0, 0, 0],
[0, 0, -1,0],
[0, -1, 0, 0],
[0, 0, 0, 1]])
C_prime = np.transpose(C)
return C @ transformation_matrix @ C_prime
Which I derived from here
This code, however, isn't working. I'm not sure if it's because the code itself is incorrect, or if my mapping is incorrect. Any help would be appreciated!