No, I don’t think the results are same. I will try to explain again. So you defined the rotation matrix as:
rot_matrix = np.array([[c, s], [-s, c]]).T
which is equivalent to: rot_matrix = np.array([[c, -s], [s, c]])
So there is no problem in the rotation matrix itself. The definition of rotation matrix is correct in the code.
But when we want to project a point in the cartesian coordinate into the ego-vehicle’s frame, the result is different if we use orientation
instead of -orientation
. In the code, orientation
has been used, but I think it should be -orientation
. The final vector which we get using orientation
and -orientation
are not the same.
For e.g. let’s say initial point = [1, 2]
Ego-orientation = 40 degrees
Rotation matrix using 40 degrees = array([[ 0.76604444, -0.64278761], [ 0.64278761, 0.76604444]])
Rotated vector using this matrix = array([-0.51953078, 2.1748765 ])
Rotation matrix using -40 degrees = array([[ 0.76604444, 0.64278761], [ -0.64278761, 0.76604444]])
Rotated vector using this matrix = array([2.05161966, 0.88930128])
So the final rotated vectors which we get using orientation
and -orientation
are different. And the answer from -orientation
looks correct.