thomasfermi / Algorithms-for-Automated-Driving

Each chapter of this (mini-)book guides you in programming one important software component for automated driving.

Home Page:https://thomasfermi.github.io/Algorithms-for-Automated-Driving/Introduction/intro.html

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Align roll, pitch, yaw definition with Carla

thomasfermi opened this issue · comments

Definition of roll, pitch, yaw in Carla is given here. The order seems to be yzx, which is different from zyx which is used in the book. This might be a problem.

I think the exercise video and exercise image should have the camera mounted with yaw != 0. Then we could empirically check if the book's formula gives us the correct pitch and yaw, or if we have to change it to the yzx convention.

I rechecked Carla's documentation and it is not very detailed, and to me it was even misleading. I did some analysis and wrote down how roll, pitch, yaw are handled in Carla here.

This knowledge should help to work on this issue.

EDIT: Just checked and saw that in camera_geometry.py we have trafo_cam_to_road and that is again a bit different since the forwards direction in the camera frame is z, but it is x in the vehicle frame. Will be a bit of work to unravel all that... Will continue working on this.

Did some analysis and I think the rotation matrix in the book needs to be

image

(c=cos(), s=sin(), y=yaw, p=pitch, r=roll)

Problem with the matrix that is currently in the book is that it uses the ISO8855 coordinate system and not the camera reference system. The correct formula (if I am not mistaken) should be pitch = arcsin(r3_y) and yaw = -arctan(r3_x/r3_z). So the negative of what we have so far. I will need some time to verify this with Carla. If it is true, I will write a more detailed explanation.

The code that was checked in for issue #20 solves this for the lane detection chapter. The rotation matrix from my post above is now in the lane detection chapter.

The calibration chapter will need to be rewritten such that it makes use of the new text in the lane detection chapter.

Did some analysis and I think the rotation matrix in the book needs to be

image

(c=cos(), s=sin(), y=yaw, p=pitch, r=roll)

Problem with the matrix that is currently in the book is that it uses the ISO8855 coordinate system and not the camera reference system. The correct formula (if I am not mistaken) should be pitch = arcsin(r3_y) and yaw = -arctan(r3_x/r3_z). So the negative of what we have so far. I will need some time to verify this with Carla. If it is true, I will write a more detailed explanation.

@thomasfermi hello so i use directly this matrix? i have transformation matrix extracted from carla and i want to calculate pitch,yaw,roll