AirshipAutopilot:

--------------------------------------------------------------------------
   Autopilot for an airship. 

   Given the desired trajectory and the current measured state, compute the 
   body-frame velocity and angular rate commands for the controllers.
--------------------------------------------------------------------------
   Form:
   cmd = AirshipAutopilot( action, data )
--------------------------------------------------------------------------

   ------
   Inputs
   ------
   action        (:)   String name of action to take. Choices are:
                          * 'reset'      ...  Reset the commands to current states
                          * 'set limits' ...  Supply rate limits 
                          * 'set dt'     ...  Supply the time step 
                          * 'update'     ...  Update the commands
   data          (.)   Data required for action
                          if action == 'reset'
                             (when no data provided, sets all to 0)
                             - data.u     ...  current axial velocity     [m/s]  
                             - data.v     ...  current lateral velocity   [m/s] 
                             - data.w     ...  current normal velocity    [m/s] 
                             - data.p     ...  current roll rate          [rad/s]  
                             - data.q     ...  current pitch rate         [rad/s] 
                             - data.r     ...  current yaw rate           [rad/s]
                          if action == 'set limits'
                             - data.u     ...  rate limit, axial velocity    [m/s/s]
                             - data.v     ...  rate limit, lateral velocity  [m/s/s]
                             - data.w     ...  rate limit, normal velocity   [m/s/s]
                             - data.p     ...  rate limit, roll rate         [rad/s/s] 
                             - data.q     ...  rate limit, pitch rate        [rad/s/s]
                             - data.r     ...  rate limit, yaw rate          [rad/s/s]
                          if action == 'set dt'
                             - data       ...  time-step [sec] 
                          if action == 'update'
                             - trajDes    ...  desired trajectory data   (psi,theta,vel)
                             - trajMeas   ...  measured trajectory data  (psi,theta,vel)
                             - stateMeas  ...  measured state data       (p,q,r,u,v,w)

   -------
   Outputs
   -------
   cmd           (.)   Data structure of commanded rates
                             - cmd.u     ...  Axial velocity command      [m/s]
                             - cmd.v     ...  Lateral velocity command    [m/s]
                             - cmd.w     ...  Normal velocity command     [m/s]
                             - cmd.p     ...  Roll rate command           [rad/s]
                             - cmd.q     ...  Pitch rate command          [rad/s]
                             - cmd.r     ...  Yaw rate command            [rad/s]

--------------------------------------------------------------------------

Children:

Common: Control/Limit
Math: Trigonometry/WrapPhase