MCPcopy Create free account
hub / github.com/SAMMiCA/ChangeSim / transform_to_pq

Function transform_to_pq

script/utils/msg_transform.py:38–49  ·  view source on GitHub ↗

Convert a C{geometry_msgs/Transform} into position/quaternion np arrays @param msg: ROS message to be converted @return: - p: position as a np.array - q: quaternion as a numpy array (order = [x,y,z,w])

(msg)

Source from the content-addressed store, hash-verified

36
37
38def transform_to_pq(msg):
39 """Convert a C{geometry_msgs/Transform} into position/quaternion np arrays
40
41 @param msg: ROS message to be converted
42 @return:
43 - p: position as a np.array
44 - q: quaternion as a numpy array (order = [x,y,z,w])
45 """
46 p = np.array([msg.translation.x, msg.translation.y, msg.translation.z])
47 q = np.array([msg.rotation.x, msg.rotation.y,
48 msg.rotation.z, msg.rotation.w])
49 return p, q
50
51
52def transform_stamped_to_pq(msg):

Callers 2

transform_stamped_to_pqFunction · 0.85
msg_to_se3Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected