Last active
January 25, 2019 02:20
-
-
Save stfuchs/d4514eb598cc16dd8f1b2a8535fdef61 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
import tf.transformations as tft | |
def quat_to_array(msg): | |
return np.array([msg.x, msg.y, msg.z, msg.w]) | |
def vec_to_array(msg): | |
return np.array([msg.x, msg.y, msg.z]) | |
def from_pose_msg(msg): | |
return tft.compose_matrix( | |
angles=tft.euler_from_quaternion(quat_to_array(msg.orientation)) | |
translate=vec_to_array(msg.position)) | |
def from_tf_msg(msg): | |
return tft.compose_matrix( | |
angles=tft.euler_from_quaternion(quat_to_array(msg.rotation)) | |
translate=vec_to_array(msg.translation) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment