I am having problems to understand how this method works, as it is throwing errors at evaluation (I am using Orekit in Matlab):
Incorrect number or types of inputs or outputs for function 'estimate'.
From looking at the documentation I see it needs three things:
estimate(int iteration, int evaluation, SpacecraftState[] states)
I am not sure what the first two inputs are, why are there iterations and evaluations involved? Is it resampling the measurement using the noise generation part of the measurement action?
But I don’t have a problem with those inputs, given that they are just integers (I am using 0 for both). The problem is that I am not sure how I am supposed to get the states
part. The measurements come from a Generator configured to simulate a radar, so in the process I have to create a Propagator
object, that I .addPropagator
to it.
After that, when I already have the measurement I don’t have easy access to the spacecraft state at the instant of the given measurement, so what I am doing right now is to use the same propagator, and .propagate
to the date of the measurement, thus giving the supposed spacecraft state at that moment. This seems to me a bad way of doing it as the propagation was already performed, and I don’t want to re-do that, but I can’t see another way of accesing the state.
So by doing that I still get the error mentioned, and I don’t understand what I am doing wrong. Reading the documentation it says that states
is:
`states` - orbital states corresponding to `getSatellites()` at measurement date
But doing getSatellites
to the measurement gives an ObservableSatellite
object, which from looking at the documentation doesn’t have information of the spaceraft state in the methods available, only the index of the propagator. So again, I don’t see any other way of geting the states info, aside from re-computing the propagation with the propagator…
My main question is why is the estimate
method giving me the error, and if possible I would like to understand if I am geting the state wrongly.
These are the code lines in question:
state = myPropagator.propagate(myMeasurements(i).getDate);
EstimationObject = myMeasurements(i).estimate(0,0,state);
Where myPropagator
is the same propagator object that I fed into the measurement Generation object.
Thanks in advance, and sorry if there are not enough details here, as I am writing it in a rush. If needed, this is a script with the complete example of what I am trying to do:
clear all; clc; close all;
% TEST
import org.orekit.orbits.*
import org.orekit.frames.*
import org.orekit.time.*
import org.orekit.utils.*
import org.orekit.propagation.analytical.*
import org.orekit.estimation.*
import org.hipparchus.geometry.euclidean.threed.*
import org.orekit.bodies.*
import org.orekit.geometry.fov.*
import org.orekit.propagation.events.*
% IC
x0 = 1e6*[1.459975626800790 0.436989307528660 -6.916264503127049 -0.003895232294893 -0.006282079270069 -0.001219414996904];
t0 = datetime(2022,05,01);
at0 = AbsoluteDate(2022, 05, 01, 0, 0, 0, TimeScalesFactory.getUTC());
% endDate = at0.shiftedBy(2*86400);
endDate = at0.shiftedBy(10*86400);
% orbit
mu = Constants.WGS84_EARTH_MU;
inertialFrame = FramesFactory.getEME2000();
myOrbit = EquinoctialOrbit(PVCoordinates(Vector3D(x0(1:3)),Vector3D(x0(4:6))), inertialFrame, at0, mu);
myPropagator = KeplerianPropagator(myOrbit);
% Radar
ITRF = FramesFactory.getITRF(ITRFVersion.ITRF_2000,IERSConventions.IERS_2010, 1);
earth = OneAxisEllipsoid(Constants.WGS84_EARTH_EQUATORIAL_RADIUS, Constants.WGS84_EARTH_FLATTENING, ITRF);
sensor = GeodeticPoint(0.64867, -0.0976, 142.33);
stationFrame = TopocentricFrame(earth, sensor,'myRadar');
myRadar = measurements.GroundStation(stationFrame);
% fov
center = [0 0 1]';
ax1 = [1 0 0]'; hA1 = 35*pi/180;
ax2 = [0 1 0]'; hA2 = 35*pi/180;
% radar_FOV = DoubleDihedraFieldOfView(Vector3D(center),Vector3D(ax1),hA1,Vector3D(ax2),hA2,0);
radar_FOV = CircularFieldOfView(Vector3D(center),35*pi/180,0);
% Create the GENERATOR object for the measurements
myGenerator = measurements.generation.Generator();
mySat = myGenerator.addPropagator(myPropagator);
% AzEl Builder
sigmas = [0.005235 0.005235];
myAzElBuilder = measurements.generation.AngularAzElBuilder(null(1), myRadar,sigmas, 1, mySat);
% FixedStepSelector
updateTime = 7;
fixedStepSelector = FixedStepSelector(updateTime,null(1));
% EventDetector
handler = handlers.ContinueOnEvent();
% FOV DETECTOR
% fov_detector = ElevationDetector(100,1e-8,stationFrame).withConstantElevation(55*pi/180).withHandler(handler);
fov_detector = GroundFieldOfViewDetector(stationFrame,radar_FOV).withHandler(handler).withMaxCheck(100).withMaxIter(100).withThreshold(1e-8);
fov_detector = fov_detector.withMaxCheck(20).withMaxIter(200).withThreshold(1e-8);
logger = org.orekit.propagation.events.EventsLogger();
fov_detector = logger.monitorDetector(fov_detector);
% SCHEDULER
signSemantic = measurements.generation.SignSemantic.valueOf('FEASIBLE_MEASUREMENT_WHEN_NEGATIVE');
% signSemantic = measurements.generation.SignSemantic.valueOf('FEASIBLE_MEASUREMENT_WHEN_POSITIVE');
myScheduler = measurements.generation.EventBasedScheduler(myAzElBuilder, fixedStepSelector, myPropagator, fov_detector, signSemantic);
myGenerator.addScheduler(myScheduler);
tic
myMeasurements = myGenerator.generate(at0,endDate);
toc
myMeasurements = myMeasurements.toArray();
n_mes = length(myMeasurements);
fprintf('Number of measurements: %i \n',n_mes)
obs_val = zeros(2,n_mes);
dates_radar = datetime.empty(0,n_mes);
for i = 1 : n_mes
azel = myMeasurements(i).getObservedValue;
dates_radar(i) = date_conversion(myMeasurements(i).getDate,'orekit2matlab');
obs_val(:,i) = azel;
state = myPropagator.propagate(myMeasurements(i).getDate);
EstimationObject = myMeasurements(i).estimate(0,0,state);
end
figure(3);
polarplot(obs_val(1,:),90-180/pi*obs_val(2,:),'bo'); hold on;
polarplot(ObVal_az_el(1,:),90-180/pi*ObVal_az_el(2,:),'r*')
rlim([0 90]);
myEvents = logger.getLoggedEvents.toArray();
for i = 1 : length(myEvents)
E = myEvents(i);
figure(3); hold on
el = stationFrame.getElevation(E.getState.getPVCoordinates().getPosition(), inertialFrame, E.getDate);
az = stationFrame.getAzimuth(E.getState.getPVCoordinates().getPosition(), inertialFrame, E.getDate);
polarplot(az,90-180/pi*el,'m*','MarkerSize',6)
end