Skip to content

Commit 50e2974

Browse files
committed
add radar measurement
1 parent 1790115 commit 50e2974

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

toolbox/+otp/+cr3bp/+presets/CircularEarthOrbit.m

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010
% ----------
1111
% OrbitalRadius : numeric(1, 1)
1212
% The radius of the orbit above Earth's surface in km.
13+
% The default radius is 340 km, which is approximately where
14+
% the ISS is/was located.
1315

1416
p = inputParser();
1517
p.KeepUnmatched = true;
16-
p.addParameter('OrbitalRadius', 340, @isnumeric);
18+
p.addParameter('OrbitalRadius', 340, @(x) isnumeric(x) && isscalar(x));
1719
p.parse(varargin{:});
1820
results = p.Results;
1921
varargin = [fieldnames(p.Unmatched), struct2cell(p.Unmatched)].';
@@ -22,6 +24,7 @@
2224
earthMoonDist = 385000;
2325
orbitalradius = results.OrbitalRadius;
2426

27+
% set the relative distance from earth to the moon
2528
delta = (equatorialRadius + orbitalradius)/earthMoonDist;
2629

2730
mE = otp.utils.PhysicalConstants.EarthMass;

toolbox/+otp/+cr3bp/CR3BPProblem.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
properties (SetAccess = private)
7878
JacobiConstant
7979
JacobiConstantJacobian
80-
RHSStab
80+
RadarMeasurement
8181
end
8282

8383
methods (Access = protected)
@@ -88,6 +88,8 @@ function onSettingsChanged(obj)
8888
obj.JacobiConstant = @(y) otp.cr3bp.jacobiconstant(y, mu, soft);
8989
obj.JacobiConstantJacobian = @(y) otp.cr3bp.jacobiconstantjacobian(y, mu, soft);
9090

91+
obj.RadarMeasurement = @(y, radary) otp.cr3bp.radarMeasurement(t, y, mu, soft, radary);
92+
9193
obj.RHS = otp.RHS(@(t, y) otp.cr3bp.f(t, y, mu, soft), ...
9294
'Jacobian', @(t, y) otp.cr3bp.jacobian(t, y, mu, soft), ...
9395
'JacobianVectorProduct', @(t, y, v) otp.cr3bp.jacobianVectorProduct(t, y, v, mu, soft), ...
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function rmeas = radarMeasurement(~, y, ~, ~, radary)
2+
3+
x = y(1:3, :);
4+
v = y(4:6, :);
5+
6+
relpos = x - radary;
7+
8+
r = sqrt(relpos(1, :).^2 + relpos(2, :).^2 + relpos(3, :).^2);
9+
drdt = sum(relpos.*v, 1)/r;
10+
theta = atan2(relpos(2, :), relpos(1, :));
11+
phi = atan2(relpos(3, :), r);
12+
13+
14+
rmeas = [r; drdt; theta; phi];
15+
16+
end

0 commit comments

Comments
 (0)