Switching from random tumbling to celestial body pointing using AttitudesSequence

Hello Orekit community,
I am quite new to the Orekit python wrapper, but I am trying to simulate the attitude switch from a random tumbling satellite to sun-pointing. To do so I have defined two attitude laws as FixedRate and CelestialBodyPointed, and I am trying to implement the switch between the two modes with AttitudesSequence.

In order to estimate the slew rate of the spacecraft, such that the attitude switch is not instantaneous, I am trying to implement a transition period through the variable “transitionTime”.
I would also like to start the simulation and instantly switch to sun-pointing mode, but I have not found an event_detector that might suit my case: for now, I am just assuming that the switch happens after crossing a given true anomaly.

This is the code that I am using right now.

initialAtt = Attitude(date, inertialFrame, thetaRot, thetadot, thetaddot)  # Define initial S/C attitude
FixedRateAttitude = FixedRate(initialAtt)                                               # Attitude constant tumbling rate
CBP = CelestialBodyPointed(inertialFrame, sun, orbit.getPVCoordinates().getPosition(), Vector3D.PLUS_I, Vector3D.PLUS_J)                                                  #SunPointingAtt

attitude_switching = AttitudesSequence()
eventDet = PositionAngleDetector(OrbitType.KEPLERIAN, PositionAngle.TRUE, true_anomaly_switch)

attitude_switching.addSwitchingCondition(FixedRateAttitude, CBP, eventDet, True, False, 2 * period, AngularDerivativesFilter.USE_RRA)       # Define switching attitude

propagator = KeplerianPropagator(orbit, attitude_switching)

When I try to run it, I get the error:

orekit.InvalidArgsError: (<class 'org.orekit.attitudes.AttitudesSequence'>, 'addSwitchingCondition', (<FixedRate: org.orekit.attitudes.FixedRate@41de5768>, <CelestialBodyPointed: org.orekit.attitudes.CelestialBodyPointed@13c612bd>, <PositionAngleDetector: org.orekit.propagation.events.PositionAngleDetector@437e951d>, True, False, 11477.984635997393, <AngularDerivativesFilter: USE_RRA>))

I have seen from documentation that AttitudesSequence also requires SwitchHandler, but it is not compulsory. Could this be the cause of the problem? If so, how can I easily implement it into my script?

Thanks in advance.

Hi @a_gior

Welcome in the Orekit forum! :slight_smile:

Could you try to add a None parameter when calling the addSwitchingCondition method?
Something like:

attitude_switching.addSwitchingCondition(FixedRateAttitude, CBP,
                                         eventDet, True, False, 2 * period,
                                         AngularDerivativesFilter.USE_RRA, None)

Best regards,

Hi @a_gior

Did you manage to make it work ? The topic is a bit old.
I am facing a issue with AttitudesSequence (the event detector is triggered, but no change in attitude occurs.)

btw, I got also the error you mentioned, and adding None as suggested by @bcazabonne solved the issue.