Guest User

Untitled

a guest
Aug 10th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import numpy as np
  3. from sympy.matrices import Matrix
  4. from sympy import symbols, atan2, sqrt
  5.  
  6. # Conversion Factors
  7. rtd = 180./np.pi # radians to degrees
  8.  
  9. # Fixed Axis X-Y-Z Rotation Matrix
  10. R_XYZ = Matrix([[ 0.353553390593274, -0.306186217847897, 0.883883476483184],
  11. [ 0.353553390593274, 0.918558653543692, 0.176776695296637],
  12. [-0.866025403784439, 0.25, 0.433012701892219]])
  13.  
  14. # Calculate the Euler angles that produces a rotation equivalent to R (above)
  15. # NOTE: the answer has units of DEGREES!
  16. alpha = rtd*atan2(R_XYZ[1,0],R_XYZ[0,0]) # rotation about Z-axis
  17. beta = rtd*atan2(-R_XYZ[2,0],sqrt(R_XYZ[0,0]**2+R_XYZ[1,0]**2)) # rotation about Y-axis
  18. gamma = rtd*atan2(R_XYZ[2,1],R_XYZ[2,2]) # rotation about X-axis
Add Comment
Please, Sign In to add comment