Hey all,
I am working on an OD project and I want to get the initial guess for the OD algorithm from the measurements. I want to do this by using finite differencing of the first two measurements. When I use it, there is quite a large discrepancy between the reference state and my initial guess as seen below:
Initial state: finite_differencing
State | px | py | pz | vx | vy | vz
----------------------------------------------------------------------------------------------------
Reference | -630804.69 | -2930405.89 | 6399491.22 | -3845.15 | -5715.48 | -2989.68
Init guess | -644723.19 | -2949291.15 | 6399969.51 | -3510.15 | -4623.28 | -3879.32
Difference | 1557.23 | 1375.81 | 21018.48 | 1379.60 | 1674.56 | 1873.50
These is some noise on the measurements however I don’t expect it to be this large in the velocity components. So my idea is to transform the measurements (range, azimuth, elevation) to cartesian ECI positions. Then I have P0 and P1, with a time difference dt. By simply saying, dx = P1 - P0 → V = dx/dt (forward differencing from T0). And then the initial state would be X0 = [P0, V].
Does anyone have any suggestions on why this is wrong? Thanks in advance!
using this code:
def topo2ECI(real_measurement, time):
from org.hipparchus.geometry.euclidean.threed import Vector3D
ran, az, el, radial_vel = real_measurement
direction = Vector3D(float(ran * math.cos(el) * math.sin(az)), float(ran * math.cos(el) * math.cos(az)), float(ran * math.sin(el)))
pv_topo = PVCoordinates(direction, Vector3D.ZERO)
time = datetime_to_absolutedate(time)
# Transform direction vector from topocentric to ECEF frame
direction_ecef = frames['topo'].getTransformTo(frames['ecef'], time).transformPVCoordinates(pv_topo)
# Convert direction vector from ECEF to ECI
direction_eci = frames['ecef'].getTransformTo(frames['eci'], time).transformPVCoordinates(direction_ecef)
return PV2state(direction_eci)
def getInitialGuess(reference, real_measurements, method='finite_differencing'):
initial_state = reference[real_measurements['first_observation']][1:].astype(float)
if method == 'finite_differencing':
print('Finite differencing is used for the initial guess')
measurement0 = np.array([real_measurements['range'][0],
real_measurements['azimuth'][0],
real_measurements['elevation'][0],
real_measurements['range_rate'][0]])
time0 = real_measurements['time'][0]
measurement1 = np.array([real_measurements['range'][1],
real_measurements['azimuth'][1],
real_measurements['elevation'][1],
real_measurements['range_rate'][1]])
time1 = real_measurements['time'][1]
pos0 = topo2ECI(measurement0, time0)
pos1 = topo2ECI(measurement1, time1)
dt = (time1 - time0).total_seconds()
dx = pos1[:3] - pos0[:3]
V = (dx[:3]/ dt)
x0 = np.array([pos0[:3], V])