PID3Axis:

Path: SC/Control

% A PID-based 3 axis controller for rigid body.
 Includes windup compensation. Use the reset flag to reset the controller
 states stored in the data structure. This is an incremental controller
 limited to the specific maximum angle per step. The torque output is
 computed from the inertia matrix and acceleration vector, T = -I*a
 
 This has 4 modes:

   0 - steady rotation about an axis ('axis')
   1 - align two vectors ('align')
   2 - align with a quaternion ('quat')
   3 - point vector and steady rotation ('point')

 Use the call with one output to get the default data structure. Type
 PID3Axis for a demo. See also PIDMIMO for computing the gains. All axes
 use the same gains. The defaults are: damping ratio of 1, undamped
 natural frequency of 0.01 rad/sec, the integrator time constant of 200 s,
 and a derivative term roll-off frequency of 0.05 rad/sec.

--------------------------------------------------------------------------
  Forms:
                PID3Axis;   % demo
            d = PID3Axis;   % data structure, uses PIDMIMO
  [torque, d] = PID3Axis( q_ECI_body, d )
--------------------------------------------------------------------------

   -----
   Input
   -----
   q_ECI_body (4,1) ECI to body quaternion
   d           (.)  Data structure
                    .a               (2,2) PID A Matrix
                    .b               (2,1) PID B Matrix
                    .c               (1,2) PID C Matrix
                    .d               (1,1) PID D Matrix
                    .inertia         (3,3) Inertia matrix
                    .x_roll          (2,1) PID roll state
                    .x_yaw           (2,1) PID yaw state
                    .x_pitch         (2,1) PID pitch stage
                    .reset           (1,1) Reset flag (T/F)
                    .mode      (1,1) or '' Four options:
                                           Mode 0 = rotate about an axis, 'axis'
                                           -requires d.q_desired_state 
                                                     d.angle / d.axis
                                           Mode 1 = align two vectors, 'align'
                                           -requires d.eci_vector 
                                                     d.body_vector
                                           Mode 2 = quaternion, 'quat'
                                           -requires d.q_desired_state
                                           Mode 3 = point with rotation, 'point'
                                           -requires d.eci_vector 
                                                     d.angle / d.axis
                                                     d.body_vector
                    .l               (2,1) Windup compensation matrix
                    .accel_sat       (1,1) Saturation acceleration
                    .max_angle       (1,1) Maximum incremental angle
          .         .q_target_last   (4,1) Last target
                    .q_desired_state (4,1) Target quaternion  (mode 0 and 2)
                    .body_vector     (3,1) Axis in body frame (mode 1 and 3)
                    .eci_vector      (3,1) Axis in ECI frame  (mode 1 and 3)
                    .angle           (1,1) Angle of rotation  (mode 0 and 3)
                    .axis            (3,1) Axis of rotation   (mode 0 and 3)

   ------
   Output
   ------
   torque     (3,1) Control torque
   d           (.)  Data structure with control states
   
--------------------------------------------------------------------------
 See also: AU2Q, U2Q, PIDMIMO
--------------------------------------------------------------------------

Children:

AerospaceUtils: Coord/QIToBDot
Common: Control/PIDMIMO
Common: Graphics/Plot2D
Common: Graphics/TimeLabl
Common: Quaternion/AU2Q
Common: Quaternion/Q2AU
Common: Quaternion/QForm
Common: Quaternion/QMult
Common: Quaternion/QPose
Common: Quaternion/QTForm
Common: Quaternion/U2Q
Math: Integration/RK4
Math: Linear/Dot

Back to the SC Module page