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

Function pose_to_pq

script/utils/msg_transform.py:13–24  ·  view source on GitHub ↗

Convert a C{geometry_msgs/Pose} 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

11import numpy as np
12
13def pose_to_pq(msg):
14 """Convert a C{geometry_msgs/Pose} into position/quaternion np arrays
15
16 @param msg: ROS message to be converted
17 @return:
18 - p: position as a np.array
19 - q: quaternion as a numpy array (order = [x,y,z,w])
20 """
21 p = np.array([msg.position.x, msg.position.y, msg.position.z])
22 q = np.array([msg.orientation.x, msg.orientation.y,
23 msg.orientation.z, msg.orientation.w])
24 return p, q
25
26
27def pose_stamped_to_pq(msg):

Callers 2

pose_stamped_to_pqFunction · 0.85
msg_to_se3Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected