Last active
March 5, 2018 13:50
-
-
Save rpapallas/6197677403f7fcbcc3ed6d1eee0149ee to your computer and use it in GitHub Desktop.
OpenRAVE: Given a transform 2D list of an object it will return back the translation and rotation as separated XML elements to be used in an environment.xml file.
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
def get_xml(arr): | |
rotation = "<RotationMat>" | |
for row in range(0, 3): | |
for col in range(0, 3): | |
rotation += str(arr[row, col]) | |
if row != 2 or col != 2: rotation += " " | |
rotation += "</RotationMat>" | |
translation = "<Translation>" | |
for row in range(0, 3): | |
translation += str(arr[row][3]) | |
if row != 2: translation += " " | |
translation += "</Translation>" | |
combined = translation + "\n" + rotation | |
print combined |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment