Created
May 28, 2014 16:53
-
-
Save moorepants/46123027ff111ce8985f to your computer and use it in GitHub Desktop.
Notes on a barge model
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
####Frames | |
Seabottom = SM.ReferenceFrame('Seabottom') | |
Barge_Frame = Seabottom.orientnew('Barge_Frame', 'Body', [phi_barge, theta_barge, psi_barge], 'XYZ') #roll, pitch, yaw: phi, theta, psi | |
"""So in the line above you set the body fixed xyz angles (these | |
are Euler angles) of the barge, but in the line below you set the angular | |
velocity vector as Space fixed rotations. Before you set the angular velocity with explicit generalized speeds you should run this: | |
In [2]: Barge_Frame.ang_vel_in(Seabottom) | |
Out[2]: (sin(psi_barge)*theta_barge' + cos(psi_barge)*cos(theta_barge)*phi_barge')*Barge_Frame.x + (-sin(psi_barge)*cos(theta_barge)*phi_barge' + cos(psi_barge)*theta_barge')*Barge_Frame.y + (sin(theta_barge)*phi_barge' + psi_barge')*Barge_Frame.z | |
If your kinematical differential equations are going to be defined as: | |
omeagaphi_barge = phi_barge.dt() | |
Then you can see how the above does not match below. | |
One option would be to set your kinematical difff equations as: | |
[gen_speed_1 - (sin(psi_barge)*theta_barge' + cos(psi_barge)*cos(theta_barge)*phi_barge'), | |
gen_speed_2 - (-sin(psi_barge)*cos(theta_barge)*phi_barge' + cos(psi_barge)*theta_barge'), | |
gen_speed_2 - (sin(theta_barge)*phi_barge' + psi_barge')] | |
Barge_Frame.set_ang_vel(Seabottom, gen_speed_1*Barge_Frame.x + gen_speed_2*Barge_Frame.y + gen_speed_2*Barge_Frame.z) | |
But if you want | |
omeagaphi_barge = phi_barge.dt(), etc then you need to make sure things are consistent: | |
Barge_Frame.set_ang_vel(Seabottom, (sin(psi_barge)*omeagetheta_barge + cos(psi_barge)*cos(theta_barge)*omegaphi_barge)*Barge_Frame.x + (-sin(psi_barge)*cos(theta_barge)*omegaphi_barge + cos(psi_barge)*omegatheta_barge)*Barge_Frame.y + (sin(theta_barge)*omegaphi_barge + omegapsi_barge)*Barge_Frame.z) | |
""" | |
Barge_Frame.set_ang_vel(Seabottom, omegaphi_barge * Seabottom.x + omegatheta_barge * Seabottom.y + omegapsi_barge * Seabottom.z) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment