UniAD
UniAD copied to clipboard
rotation related questions
Thanks for your great work: Questions:
- why need rot as following in tools/data_converter/uniad_nuscenes_converter.py when generating gt_boxes names = np.array(names) # instance_inds = [nusc.getind('instance', ann['instance_token']) for ann in annotations] # we need to convert rot to SECOND format. gt_boxes = np.concatenate([locs, dims, -rots - np.pi / 2], axis=1)
- why need rot in when convert_local_coords_to_global, convert_global_coords_to_local
def angle_of_rotation(yaw: float) -> float: """ Given a yaw angle (measured from x axis), find the angle needed to rotate by so that the yaw is aligned with the y axis (pi / 2). :param yaw: Radians. Output of quaternion_yaw function. :return: Angle in radians. """ return (np.pi / 2) + np.sign(-yaw) * np.abs(yaw)
def convert_global_coords_to_local(coordinates: np.ndarray, translation: Tuple[float, float, float], rotation: Tuple[float, float, float, float]) -> np.ndarray: yaw = angle_of_rotation(quaternion_yaw(Quaternion(rotation)))
transform = make_2d_rotation_matrix(angle_in_radians=yaw)
coords = (coordinates - np.atleast_2d(np.array(translation)[:2])).T
return np.dot(transform, coords).T[:, :2]