MGIceSkaterWithTurntableKaneLagrange.html  (MotionGenesis input/output).
   (1) % MotionGenesis file:  MGIceSkaterWithTurntableKaneLagrange.txt
   (2) % Copyright (c) 2015 Motion Genesis LLC.  All rights reserved.
   (3) %------------------------------------------------------------
   (4) NewtonianFrame N 
   (5) RigidBody      A           % Head, torsion, legs.
   (6) RigidFrame     B           % Arms.
   (7) Particle       Q           % Heavy dumbbell.
   (8) %------------------------------------------------------------
   (9) Specified   qB''           % Arm angle.
   (10) Variable    wA'            % Ay> measure of A's angular velocity in N.
   (11) Constant    g = 9.8 m/s^2  % Earth's gravitational acceleration.
   (12) Constant    hA             % Distance between Acm and Bo.
   (13) Constant    L = 0.7 m      % Distance between Bo and Q.
   (14) Q.SetMass( m = 12 kg )
   (15) A.SetInertia( Acm,  Ixx = 18.6 kg*m^2,  Iyy = 0.6 kg*m^2,  Izz = 18 kg*m^2 )
   (16) %------------------------------------------------------------
   (17) %       Rotational kinematics.
   (18) A.SetAngularVelocity(  N,  wA*Ay> )
-> (19) w_A_N> = wA*Ay>

   (20) B.RotateZ(  A,  qB )
-> (21) B_A = [cos(qB), sin(qB), 0;  -sin(qB), cos(qB), 0;  0, 0, 1]
-> (22) w_B_A> = qB'*Bz>
-> (23) w_B_N> = wA*Ay> + qB'*Bz>
-> (24) alf_B_A> = qB''*Bz>

   (25) %------------------------------------------------------------
   (26) %       Translational kinematics.
   (27) Acm.SetVelocity(  N,  0>  )
-> (28) v_Acm_N> = 0>

   (29) Bo.Translate(  Acm,  hA*Ay>  )
-> (30) p_Acm_Bo> = hA*Ay>
-> (31) v_Bo_N> = 0>
-> (32) a_Bo_N> = 0>

   (33) Q.Translate(  Bo,  -L*By>  )
-> (34) p_Bo_Q> = -L*By>
-> (35) v_Q_N> = L*qB'*Bx> - L*sin(qB)*wA*Bz>
-> (36) a_Q_N> = -L*sin(qB)*wA^2*Ax> + L*qB''*Bx> + L*qB'^2*By> - L*(2*cos(qB)*
        qB'*wA+sin(qB)*wA')*Bz>

   (37) %------------------------------------------------------------
   (38) %       Add relevant forces.
   (39) Q.AddForceGravity(  -g*Ay>  )
-> (40) Force_Q> = -m*g*Ay>

   (41) %------------------------------------------------------------
   (42) %       Form and solve rotational equation of motion.
   (43) SetGeneralizedSpeed( wA )
   (44) Zero = System.GetDynamicsKane()
-> (45) Zero = [2*m*L^2*sin(qB)*cos(qB)*qB'*wA + (Iyy+m*L^2*sin(qB)^2)*wA']

   (46) Solve( Zero,  wA' )  
-> (47) wA' = -2*m*L^2*sin(qB)*cos(qB)*qB'*wA/(Iyy+m*L^2*sin(qB)^2)

   (48) %------------------------------------------------------------
Saved by Motion Genesis LLC.   Portions copyright (c) 2009-2017 Motion Genesis LLC. Rights reserved. Only for use with MotionGenesis.