% MotionGenesis file: MGAircraftTrifilarPendulumConstraints.txt % Copyright (c) 2016-18 Motion Genesis LLC. %-------------------------------------------------------------------- NewtonianFrame N % Earth / aircraft hanger. RigidBody C % Aircraft. Point N1(N), N2(N), N3(N) % End-points of cable on N. Point C1(C), C2(C), C3(C) % End-points of cable on C. %-------------------------------------------------------------------- Constant L1 = 30 m % Length of cable between N1 and C1. Constant L2 = 30 m % Length of cable between N2 and C2. Constant L3 = 30 m % Length of cable between N3 and C3. Constant dN = 30 m % Distance between No and N1. Constant dC = 30 m % Distance between Co and C1. Constant wN = 20 m % Distance between No and N2. Constant wC = 20 m % Distance between Co and C2. Constant dcm = 8 m % Distance between Co and Ccm. Variable x, y, z % Locates Ccm from No. Variable q1, q2, q3 % BodyZYX Euler angles. %-------------------------------------------------------------------- % Rotational and translational kinematics. C.SetRotationMatrix( N, BodyZYX, q1, q2, q3 ) CCm.SetPosition( No, x*Nx> + y*Ny> + z*Nz> ) Co.SetPosition( CCm, -dcm*Cx> ) C1.SetPosition( Co, dC*Cx> ) C2.SetPosition( Co, -wC*Cy> ) C3.SetPosition( Co, wC*Cy> ) N1.SetPosition( No, dN*Nx> ) N2.SetPosition( No, -wN*Ny> ) N3.SetPosition( No, wN*Ny> ) %-------------------------------------------------------------------- % Configuration constraints: Length of cables. CableConstraint[1] = C1.GetDistanceSquared( N1 ) - L1^2 CableConstraint[2] = C2.GetDistanceSquared( N2 ) - L2^2 CableConstraint[3] = C3.GetDistanceSquared( N3 ) - L3^2 %-------------------------------------------------------------------- % Calculate yaw, pitch and roll angles in terms of q1, q2, q3. Yaw = GetAngleBetweenUnitVectors( Nx>, Cy> ) - pi/2 Pitch = GetAngleBetweenUnitVectors( Nz>, Cx> ) - pi/2 Roll = pi/2 - GetAngleBetweenUnitVectors( Nz>, Cy> ) %-------------------------------------------------------------------- % Solve for values of q1, q2, q3 via yaw, pitch, roll angles. Constant Yaw0 = 0 deg, Pitch0 = 5 deg, Roll0 = 5 deg Solve( [Yaw; Pitch; Roll] = [Yaw0; Pitch0; Roll0], q1 = 0 deg, q2 = 5 deg, q3 = 5 deg ) %-------------------------------------------------------------------- % Solve for values of x, y, z using the CableConstraint (and the values of q1, q2, q3). Solve( CableConstraint = 0, x = Input(dN)/2 m, y=0 m, z = 0.2*Input(L1) m ) %-------------------------------------------------------------------- % Calculate the distance between No and Ccm. distance = EvaluateToNumber( Ccm.GetDistance( No ) ) %-------------------------------------------------------------------- Save MGAircraftTrifilarPendulumConstraints.html Quit