:param target_vec_in_global: carla.Vector3D in global coordinate (world, actor) :param ref_rot_in_global: carla.Rotation in global coordinate (world, actor) :return: carla.Vector3D in ref coordinate
(target_vec_in_global, ref_rot_in_global)
| 19 | |
| 20 | |
| 21 | def vec_global_to_ref(target_vec_in_global, ref_rot_in_global): |
| 22 | """ |
| 23 | :param target_vec_in_global: carla.Vector3D in global coordinate (world, actor) |
| 24 | :param ref_rot_in_global: carla.Rotation in global coordinate (world, actor) |
| 25 | :return: carla.Vector3D in ref coordinate |
| 26 | """ |
| 27 | R = carla_rot_to_mat(ref_rot_in_global) |
| 28 | np_vec_in_global = np.array([[target_vec_in_global.x], |
| 29 | [target_vec_in_global.y], |
| 30 | [target_vec_in_global.z]]) |
| 31 | np_vec_in_ref = R.T.dot(np_vec_in_global) |
| 32 | target_vec_in_ref = carla.Vector3D(x=np_vec_in_ref[0, 0], y=np_vec_in_ref[1, 0], z=np_vec_in_ref[2, 0]) |
| 33 | return target_vec_in_ref |
| 34 | |
| 35 | |
| 36 | def rot_global_to_ref(target_rot_in_global, ref_rot_in_global): |
no test coverage detected