# Get observations from a given state (discrepancy)

Hey All,

I am working on an OD project. I am trying to write my own estimation code, and for one filter I need to convert the estimated state to an observation. I have the following dode to support that:

``````TPV = state2TPV(state, time) # function that convert a state (x,y,z,vx,vy,vz) and time to a TimeStampedPVCoordinate

range_meas = frames['topo'].getRange(TPV.getPosition(), frames['eci'], TPV.getDate())
az_meas = frames['topo'].getAzimuth(TPV.getPosition(), frames['eci'], TPV.getDate())
el_meas = frames['topo'].getElevation(TPV.getPosition(), frames['eci'], TPV.getDate())
rr_meas = frames['topo'].getRangeRate(TPV, frames['eci'], TPV.getDate())
``````

here the topo and eci frames are already defined. Now I run into a problem that there is a discrepancy between the actual measurement (generated using the measurement generation toolbox for orekit) and the calculated measurement. I already checked the timing and state, they are both the same. Does anyone know what is going on here?

Just for reference:
Xref: estimated state
Xreal: actual state
dX: Xref - Xreal
Yk: measurement (range, az, el, range rate)
G: converted measurement using Xref
yk: residuals (Yk - G)

``````Observation no. 0, iteration no. 1
Xref:  [[-1.81732277e+06 -2.57989350e+06  6.33111049e+06 -5.64291270e+03
-3.81221073e+03 -3.16554705e+03]]
Xreal: [-1.81732277e+06 -2.57989350e+06  6.33111049e+06 -5.64291270e+03
-3.81221073e+03 -3.16554705e+03]
dX:    [[0. 0. 0. 0. 0. 0.]]
Yk:    [ 1.98042757e+06  8.82930547e-01  4.92063648e-01 -5.43768941e+03]
G:     [2.00240297e+06 6.39065651e-01 2.20885902e-01 4.11838412e+06]
yk:    [-2.19754036e+04  2.43864896e-01  2.71177746e-01 -4.12382181e+06]
``````