• API
• FAQ
• Tools
• Archive
daily pastebin goal
10%
SHARE
TWEET

# Untitled

a guest Aug 10th, 2018 57 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
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
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy.

Top