MCPcopy Create free account
hub / github.com/OpenDriveLab/TCP / rot_to_mat

Function rot_to_mat

TCP/data.py:217–239  ·  view source on GitHub ↗
(roll, pitch, yaw)

Source from the content-addressed store, hash-verified

215 return out
216
217def rot_to_mat(roll, pitch, yaw):
218 roll = np.deg2rad(roll)
219 pitch = np.deg2rad(pitch)
220 yaw = np.deg2rad(yaw)
221
222 yaw_matrix = np.array([
223 [np.cos(yaw), -np.sin(yaw), 0],
224 [np.sin(yaw), np.cos(yaw), 0],
225 [0, 0, 1]
226 ])
227 pitch_matrix = np.array([
228 [np.cos(pitch), 0, -np.sin(pitch)],
229 [0, 1, 0],
230 [np.sin(pitch), 0, np.cos(pitch)]
231 ])
232 roll_matrix = np.array([
233 [1, 0, 0],
234 [0, np.cos(roll), np.sin(roll)],
235 [0, -np.sin(roll), np.cos(roll)]
236 ])
237
238 rotation_matrix = yaw_matrix.dot(pitch_matrix).dot(roll_matrix)
239 return rotation_matrix
240
241
242def vec_global_to_ref(target_vec_in_global, ref_rot_in_global):

Callers 1

vec_global_to_refFunction · 0.85

Calls 1

dotMethod · 0.80

Tested by

no test coverage detected