Hi,
How would one calculate the yaw angle of the vehicle using its quaternion?
Hi,
How would one calculate the yaw angle of the vehicle using its quaternion?
Please use this function: https://github.com/nutonomy/nuscenes-devkit/blob/master/python-sdk/nuscenes/eval/detection/utils.py#L162
Hello,
This link doesn’t provide the required function. It only includes “detection_name_to_rel_attributes” and “category_to_detection_name” functions.
Can you please check the link again?
Thanks and regards,
Apologies for the wrong link. Try:
Thank you for the link. I was able to write my own function in the mean time. And if there is someone who wishes to get the yaw angle (heading angle) from a quaternion directly then please use the below function,
import numpy as np
quarternion = [w, x, y, z]
numerator = 2 * (quaternion[0]*quaternion[3]+quaternion[1]*quaternion[2])
denominator = 1 - (2*(np.square(quaternion[2])+np.square(quaternion[3])))
yaw_angle = np.arctan2(numerator, denominator)
The yaw_angle will be between [-180, +180] radians
Please refer to Wiki link for the math
https://en.wikipedia.org/wiki/Conversion_between_quaternions_and_Euler_angles