MGHumanOnTurntableWithGyroKaneLagrange.html  (MotionGenesis input/output).
```   (1) % MotionGenesis file:  MGHumanOnTurntableWithGyroKaneLagrange.txt
(2) %------------------------------------------------------------
(3) NewtonianFrame  N
(4) RigidBody       A   % Turntable, human legs, torso, and head.
(5) RigidFrame      B   % Human shoulder, arms, and wheel's axle.
(6) RigidBody       C   % Bicycle wheel (rotor).
(7) %------------------------------------------------------------
(8) Variable    qA''        % Az> measure of angle from Nx> to Ax>
(9) Specified   qB''        % Ax> measure of angle from Ay> to By>
(10) Variable    wC'         % By> measure of C's angular velocity in B
(11) Constant    Lz = 1.2 m  % Az> measure of Bo from No
(12) Constant    Lx = 0.5 m  % Ax> measure of Ccm from Bo
(13) C.SetMass( mC = 2 kg )
(14) A.SetInertia( Acm,  IAxx,  IAyy,  IAzz = 0.64 kg*m^2 )
(15) C.SetInertia( Ccm, B,  IC = 0.12 kg*m^2,  JC = 0.24 kg*m^2,  IC  )
(16) %------------------------------------------------------------
(17) %       Rotational kinematics.
(18) A.RotateZ( N, qA )
-> (19) A_N = [cos(qA), sin(qA), 0;  -sin(qA), cos(qA), 0;  0, 0, 1]
-> (20) w_A_N> = qA'*Az>
-> (21) alf_A_N> = qA''*Az>

(22) B.RotateX( A, qB )
-> (23) B_A = [1, 0, 0;  0, cos(qB), sin(qB);  0, -sin(qB), cos(qB)]
-> (24) w_B_A> = qB'*Bx>
-> (25) w_B_N> = qA'*Az> + qB'*Bx>
-> (26) alf_B_A> = qB''*Bx>
-> (27) alf_B_N> = qB'*qA'*Ay> + qA''*Az> + qB''*Bx>

(28) C.SetAngularVelocityAcceleration( B, wC*By> )
-> (29) w_C_B> = wC*By>
-> (30) w_C_N> = qB'*Bx> + (wC+sin(qB)*qA')*By> + cos(qB)*qA'*Bz>
-> (31) alf_C_B> = wC'*By>
-> (32) alf_C_N> = (qB''-cos(qB)*wC*qA')*Bx> + (wC'+cos(qB)*qB'*qA'+sin(qB)*qA
'')*By> + (qB'*wC+cos(qB)*qA''-sin(qB)*qB'*qA')*Bz>

(33) %------------------------------------------------------------
(34) %       Translational kinematics.
(35) Acm.SetVelocity( N, 0> )
-> (36) v_Acm_N> = 0>

(37) Bo.Translate(  No, Lz*Az> )
-> (38) p_No_Bo> = Lz*Az>
-> (39) v_Bo_N> = 0>
-> (40) a_Bo_N> = 0>

(41) Ccm.Translate( Bo, Lx*Ax> )
-> (42) p_Bo_Ccm> = Lx*Ax>
-> (43) v_Ccm_N> = Lx*qA'*Ay>
-> (44) a_Ccm_N> = -Lx*qA'^2*Ax> + Lx*qA''*Ay>

(45) %------------------------------------------------------------
(46) %       Form Kane's equation of motion.
(47) SetGeneralizedSpeed( qA', wC )
(48) Dynamics = System.GetDynamicsKane()
-> (49) Dynamics[1] = cos(qB)*qB'*(JC*sin(qB)*qA'+IC*(wC-sin(qB)*qA')-(IC-JC)*(
wC+sin(qB)*qA')) + JC*sin(qB)*wC' + (IAzz+mC*Lx^2+IC*cos(qB)^2+JC*sin(
qB)^2)*qA''

-> (50) Dynamics[2] = JC*(cos(qB)*qB'*qA'+wC'+sin(qB)*qA'')

(51) FactorQuadratic( Dynamics,  qA', qB', wC )
-> (52) Dynamics[1] = JC*cos(qB)*qB'*wC + JC*sin(qB)*wC' + (IAzz+mC*Lx^2+IC*cos
(qB)^2+JC*sin(qB)^2)*qA'' - 2*(IC-JC)*sin(qB)*cos(qB)*qB'*qA'

-> (53) Dynamics[2] = JC*(cos(qB)*qB'*qA'+wC'+sin(qB)*qA'')

(54) Solve( Dynamics = 0,  qA'',  wC' )
-> (55) qA'' = cos(qB)*qB'*(2*IC*sin(qB)*qA'-JC*wC-JC*sin(qB)*qA')/(IAzz+mC*Lx^2
+IC*cos(qB)^2)
-> (56) wC' = -cos(qB)*qB'*(qA'-sin(qB)*(JC*wC-(2*IC-JC)*sin(qB)*qA')/(IAzz+mC*Lx^2
+IC*cos(qB)^2))

(57) %------------------------------------------------------------
```