Get yaw rate from egoPos Quaternions

Can anyone explain to me how to get the ego’s yaw angle and/or yaw rate from the egoPos rotation quaternions? I am always confused by quaternions and how to work with them.

For the quaternion yaw see https://github.com/nutonomy/nuscenes-devkit/blob/nuscenes_v2.0/python-sdk/nuscenes/eval/common/utils.py#L112 (note the comments, it only works in a specific reference frames).

Similarly you could look at https://github.com/nutonomy/nuscenes-devkit/blob/nuscenes_v2.0/python-sdk/nuscenes/eval/common/utils.py#L36 to get some inspiration for yaw rate. You’d then need to divide the yaw_diff by the time difference.

Looks what I was looking for to easily calculate yaw.
I will try it out. Thank you.