Attitude sequence and FieldOfViewDetector


there is something I miss about the functioning of event detectors.

I want to adapt satellite attitude (nominally Earth Pointed) to avoid on-board sensor blinding when I know Sun is present in the field of view, by freezing the attitude to inertial just before when the sensor is about to be blinded by Sun.

Say I use an event detector that detects the blinding of the sensor on-board (blinding occurs when Sun direction is less than 60° of the camera line of sight), based on geometrical positions of Sun and Satellite, assuming the SC attitude is Earth Pointed (but not directly using satellite attitude provider since I will be modifiying afterwards!)

My event ‘g’ function will output the difference between the actual angle and that 60°, basically when positive there is no blinding, when negative there is blinding.

But now, I want this event to be used in an Attitude Sequence, in the following manner:

  • when blinding is about to start, I want to freeze attitude
  • when blinding is about to end, I want to resume Earth Pointed attitude.

The problem I have is that my event above will trigger in both cases (entry and exit), thus I don’t see how I could discriminate both cases when using this event to create the AttitudeSequence ?

More conceptually, what I look for is how to setup the event to only detect entry of blinding, or exit, but I don’t want the event to trigger on both because the action I expect to do is different between entry and exit



You can wrap your event detector within an EventSlopeFilter configured to use FilterType.TRIGGER_ONLY_DECREASING_EVENTS.

Thanks ! this is exactly what I was looking for.

@luc do you know if there is a way to retrieve the current SC attitude at the time of an AttitudeSequence Switch ?

What I would like to do is, everytime my custom blinding detector has fired with ‘decreasing’ slope, to make the Attitude inertial. and when it fires with ‘increasing’ slope, use Earth pointed attitude again.

I have been implementing an attitude provider modifier of EarthPointed that ‘stores’ the attitude at the first call of getAttitude() function after AttitudeSequence switch, but altough this was OK when using it with a DateDetector in an ‘oneshot’ manner, now with my above custom slope-filtered detector, I get a ConcurrentModification Exception at runtime.

        det1 = BlindingPositionDetector.BlindingPositionDetector(sun, sat, sensorName,
                                                                exclAng, earthPointed)
        det2 = BlindingPositionDetector.BlindingPositionDetector(sun, sat, sensorName,
                                                                exclAng, earthPointed)

        blindingStart = EventSlopeFilter(det1, FilterType.TRIGGER_ONLY_DECREASING_EVENTS)
        blindingEnd = EventSlopeFilter(det2, FilterType.TRIGGER_ONLY_INCREASING_EVENTS)

Then I use the above list of attitude providers and triggers to create the AttitudeSequence.

my detector is quite simple, see function g below:

def g(self, s):
        ''' this function computes the separation angle ie. margin
        before being blinded
        absoluteDate = s.getDate()
        frame = s.getFrame()
        sunDirection_J2000 = PVCoordinates(self.sat.prop.getPVCoordinates(absoluteDate, frame),
                self.blindingPvProvider.getPVCoordinates(absoluteDate, frame))
        LVLH_att = self.pointingLaw.getAttitude(self.sat.prop, absoluteDate, frame).getRotation()
        losDir_B = self.sat.getSensor(self.sensorName).losDir_B
        sensorLos_J2000 = LVLH_att.applyInverseTo(
            Vector3D(float(losDir_B[0]), float(losDir_B[1]), float(losDir_B[2])))
        sepAng = Vector3D.angle(sensorLos_J2000, sunDirection_J2000.getPosition())

        return float(sepAng - self.exclAng)

The error I have

JavaError: <super: <class 'JavaError'>, <JavaError object>>
    Java stacktrace:
	at java.util.ArrayList$Itr.checkForComodification(
	at java.util.ArrayList$
	at org.hipparchus.ode.AbstractIntegrator.acceptStep(

any hints ?