Demonstrate A* for a close orbital maneuver.

------------------------------------------------------------------------
See also AStarSearch, ManeuverCost3D, ManeuverSuccessorNodes3D,
GenerateGrid, RaDec2U, Plot2D, Plot3D
------------------------------------------------------------------------

Contents

%---------------------------------------------------------------------------
%   Copyright (c) 2003 Princeton Satellite Systems, Inc.
%   All rights reserved.
%---------------------------------------------------------------------------

Define the grid

%----------------
n                     = 48;
r                     = [1 1.1 2 3 5 8];
stayout               = [];

[rA, dec, a, kDec, kR, r, nPL] = GenerateGrid( n, r, stayout, 'globe' );

d                     = [];
d.myData.dec          = dec;
d.myData.rA           = rA;
d.myData.r            = r;
d.myData.a            = a;
d.myData.kDec         = kDec;
d.myData.kR           = kR;
d.myData.n            = length(a);
d.myData.v            = [1;0;0];
d.n                   = length(a);
d.myData.nPL          = nPL;
startNode             = 5100;
endNode               = 390;

We use the same function for path cost and maneuver cost

%---------------------------------------------------------
d.pathCostEstimateFunction = 'ManeuverCost3D';
d.traverseCostFunction     = 'ManeuverCost3D';
d.successorNodesFunction   = 'ManeuverSuccessorNodes3D';

path                       = AStarSearch( startNode, endNode, d );

Plot the path if one was successfully generated

%------------------------------------------------
if( ~isempty(path) )
  rA    = d.myData.rA(path);
  dec   = d.myData.dec(path);
  r     = d.myData.r(path);
  uPath = RaDec2U( rA*pi/180,dec*pi/180 );
  rPath = zeros(3,size(uPath,2));
  for k = 1:size(uPath,2)
    rPath(:,k) = r(k)*uPath(:,k);
  end
  yL    = {'Right Ascension (deg)', 'Declination (deg)' 'Radius (m)'};
  Plot3D( rPath,'x','y','z','A* Path', 0.98 );
  Plot2D( 1:length(rA), [rA;dec;r], 'Step', yL, 'Trajectory' );
 end

%--------------------------------------

% $Id: 99d19334477d87d840f9b8c24657e73eda5c3cf9 $