MCPcopy Create free account
hub / github.com/OpenDriveLab/DriveAdapter / vec_global_to_ref

Function vec_global_to_ref

roach/utils/transforms.py:21–33  ·  view source on GitHub ↗

: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)

Source from the content-addressed store, hash-verified

19
20
21def 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
36def rot_global_to_ref(target_rot_in_global, ref_rot_in_global):

Callers 2

loc_global_to_refFunction · 0.85
get_loc_rot_vel_in_evFunction · 0.85

Calls 2

carla_rot_to_matFunction · 0.85
dotMethod · 0.80

Tested by

no test coverage detected