% The Nominal Safe Guidance method.

 Define a safe relative orbit and plan a 1-2 burn maneuver to reach it.
 The safe relative orbit is a 2x1 relative in-plane ellipse, with a
 cross-track oscillation that provides a minimum cross-track separation
 where the ellipse intersects the along-track axis. The relative ellipse
 is chosen such that:
 * it can be reached with a single, immediate delta-v
 * it does not intersect with a 2x1 elliptical avoidance region 
 * its semi-major axis is greater than the defined minimum value
 * it requires the lowest delta-v to meet the above constraints

   [deltaV,desTraj,inside] = NominalSafeGuidance( inputs, parameters, state );

   inputs        (.)    Input data from other modules
   parameters    (.)    Parameters that may be adjusted 
   state         (.)    Absolute and relative state information

   deltaV        (.)   Delta-V sequence data structure
                          .dV  (3,N) Set of N Hills-frame delta-v's [km/s]
                          .t   (1,N) Time for each delta-v's [MET] 
   desTraj       (.)   Desired relative trajectory
                          .y0   Along-track offset of relative ellipse
                          .aE   Semi-major axis of relative ellipse
                          .zA   Cross-track value at along-track axis crossing
                          .zR   Cross-track value at radial axis crossing

   tracking      (.)   Tracking performance of current trajectory
                          .drift   Along-track drift per orbit [km]
                          .yA      Cross-track offset at along-track crossing [km]
                          .zOsc    Smallest radial oscillation [km]



FormationFlying: SafeGuidance/ComputeRE
FormationFlying: SafeGuidance/CrossTrackDeltaV
FormationFlying: SafeGuidance/EllipseDeltaV
FormationFlying: SafeGuidance/RadialOscillation