Created
March 14, 2024 17:28
-
-
Save johnwason/46e2bebf0a665901cb0b5ded9e071ffa to your computer and use it in GitHub Desktop.
abb_loaddata_to_spatialinertia.py
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 general_robotics_toolbox as rox | |
| # abb loaddata has the form [mass, [com_x, com_y, com_z], [aom_qw, aom_qx, aom_qy, aom_qz], ixx, iyy, izz] | |
| # abb uses mm while spatial inertia uses m | |
| abb_loaddata = [5,[1002,2003,0],[-0.00585693,0.595997,0.802901,-0.0101995],0.0349296,0.21552,0.250029] | |
| mass = abb_loaddata[0] | |
| com = np.array(abb_loaddata[1],dtype=np.float64)/1000.0 | |
| aom = np.array(abb_loaddata[2],dtype=np.float64) | |
| ixx_aom = abb_loaddata[3] | |
| iyy_aom = abb_loaddata[4] | |
| izz_aom = abb_loaddata[5] | |
| I_aom = np.array([[ixx_aom,0,0],[0,iyy_aom,0],[0,0,izz_aom]],dtype=np.float64) | |
| R_aom = rox.q2R(aom) | |
| I = R_aom @ I_aom @ R_aom.T | |
| print("mass: ", mass) | |
| print("com: ", com) | |
| print("ixx: ", I[0,0]) | |
| print("ixy: ", I[0,1]) | |
| print("ixz: ", I[0,2]) | |
| print("iyy: ", I[1,1]) | |
| print("iyz: ", I[1,2]) | |
| print("izz: ", I[2,2]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment