Hi! I am new to Orekit, and looking to use it for an estimation project. Does Orekit support creation of custom measurement types (for example, space based measurements), or will I need to use one of the existing measurement classes? Thank you!

Hello,

You can create your own measurements type, as well as your own measurements modifiers.

The global architecture of the estimation package is explained here.

You have therefore to create a class that implements the `ObservedMeasurement`

interface. The simplest way to do it is to have your class extend the existing `AbstractMeasurement`

abstract class that already handles all the methods from the interface but adds one lower level method that you need to implement in your own class: `theoreticalEvaluation(iteration, evaluation, states)`

. This method will be called by the estimation algorithm (the same method is used for both batch least square and Kalman filter) and given the states of the satellites at some time close to measurement time (in fact it is exactly measurement time for the first iteration of batch least squares, but can be a time with precompensated light time delay on subsequent iterations). If your measurement is a single satellite measurement (like `Range`

), the `states`

array will contain only one element corresponding to your satellite. If your measurement is a multi-satellite measurement (like `InterSatellitesRange`

), the `states`

array will contain as many elements that your measurement needs (according to the `ObservableSatellite`

list passed to the parent abstract class at construction). From this (or these) state(s), and from the specific data you will have put in your specific measurement, the `theoreticalEvaluation`

method will create an instance of `EstimatedMeasurement`

fill it with data and return it to caller. The data that will be gathered in the estimated measurement are:

- a reference to the
`ObservedMeasurement`

itself (i.e. the`this`

reference) - the arguments that were passed to the method (i.e. iteration counter, evaluation counter and states)
- the states relevant to measurements (which may be slightly different from measurement time if for example measurements is timestamped at reception, because light time delay must be compensated)
- the measurements estimated value
- the measurements partial derivatives with respect to state(s)
- the measurements partial derivatives with respect to measurements parameters

The first items in the list above are set in the constructor, the value is set after `EstimatedMeasurement`

construction by calling the `setEstimatedValue`

method, and the various partial derivatives are also set after construction by calling the `setStateDerivatives`

and `setParameterDerivatives`

methods.

I would suggest you to look at two existing implementations for guidance. The first one is the `Position`

measurement, it is possibly the simplest measurement. There is no light time delay so no need to shift the states, the measurement values (X, Y, Z) are directly picked from the states and the derivatives of position with respect to state are simply the 3x3 identity matrix. Most measurements are however much more complex than that. A second implementation you could study is `Range`

as it needs to compensate light time delay and its derivatives are slightly harder to compute. You will note that in order to compute these derivatives, we make extensive use of automatic differentation, with the `Gradient`

class (since 10.2, before 10.2 we used `DerivativeStructure`

). This simplifies a lot computation and avoids some non-intuitive errors. A typical example for Range is the derivative with respect to velocity. Intuitively range does not depend on velocity, but in fact it does because the state that was picked up by propagator may be slightly off and therefore the position relevant for range computation, once light time has been compensated, is a combination of the picked up position and velocity.

Thank you Luc! This is very helpfulâ€“I really appreciate the thorough answer!