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.
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.