Using external function to compute attitude


I am using OreKit for orbit propagation, but I have an external function (say, attitudeComputation()) which computes attitudes based on external constraints (i.e. it is not simple target pointing with maximal sun lighting for example).
What I would like to do is at each timestep of the propagation (i.e. before each call to new_state = numericalPropagator.propagate(new_date), i would like to be able to update the current Space craft attitude with the one computed from previous_state.getPVCoordinates. I cannot integrate my attitude computation function in an AttitudeProvider or with AdditionalEquations because this function is matlab-based (closed loop attitude control)

I read that there is tabulated attitude providers, but in that case I won’t have pre-computed tables, I will only have one attitude information, corresponding to the new_state date.

Any hints on how to do so ?

PS: I’m using Orekit via the Python wrapper.



Hi @vianneyl,

Welcome to the Orekit community !!

I’m not sure to fully grasp your problem.

The way I understand it so far, I would tend to tell you to “just” re-initialize the initialState of the propagator with the newly computed attitude before launching the propagation to the next step.

Is it something like that that you want to achieve ?

Hello @MaximeJ
yes this is exactly what I would like to do!

I understand from your answer I simply have to :

  • extract current state from my propagator
  • overload attitude on this state
  • use resetInitialState method on my propagator with this overloaded state

right ?

Hello @vianneyl,

Yes it’s (almost) that.

SpacecraftState are immutable objects so you cannot overload the attitude. You have to create a new object based on your attitude and the values (orbit, mass and eventually additional states) of current state.
Apart from that your method should work.