diff --git a/socs/agents/acu/agent.py b/socs/agents/acu/agent.py index 61e64e1ef..4d81a1d7e 100644 --- a/socs/agents/acu/agent.py +++ b/socs/agents/acu/agent.py @@ -40,11 +40,18 @@ } -#: Default Sun avoidance params by platform type (enabled, policy) +#: Default Sun avoidance params by platform type (enabled, policy). If +#: either of escape *or* monitoring is enabled, then the full policy +#: must be specified. SUN_CONFIGS = { 'ccat': { 'enabled': False, - 'policy': {}, + 'policy': { + 'exclusion_radius': 20, + 'el_horizon': 10, + 'min_sun_time': 1800, + 'response_time': 7200, + }, }, 'satp': { 'enabled': True, @@ -1713,7 +1720,7 @@ def generate_scan(self, session, params): ok, msg = self._check_scan_sunsafe(az_endpoint1, az_endpoint2, el_endpoint1, az_speed, az_accel) if ok: - self.log.info('Sun safety check passes: {msg}', msg=msg) + self.log.info('Sun safety check: {msg}', msg=msg) else: self.log.error('Sun safety check fails: {msg}', msg=msg) return False, 'Scan is not Sun Safe.' @@ -2201,6 +2208,8 @@ def lookup(keys, tree): yield dsleep(1) + return True, 'monitor_sun exited cleanly.' + @ocs_agent.param('reset', type=bool, default=None) @ocs_agent.param('enable', type=bool, default=None) @ocs_agent.param('temporary_disable', type=float, default=None) @@ -2363,6 +2372,17 @@ def _leg_done(result): return True, "Exited." def _check_scan_sunsafe(self, az1, az2, el, v_az, a_az): + """This will return True if active avoidance is disabled. If active + avoidance is enabled, then it will only return true if the + planned scan seems to currently be sun-safe. + + """ + if not self._get_sun_policy('sunsafe_moves'): + return True, 'Sun-safety checking is not enabled.' + + if not self._get_sun_policy('map_valid'): + return False, 'Sun Safety Map not computed or stale; run the monitor_sun process.' + # Include a bit of buffer for turn-arounds. az1, az2 = min(az1, az2), max(az1, az2) turn = v_az**2 / a_az @@ -2378,10 +2398,7 @@ def _check_scan_sunsafe(self, az1, az2, el, v_az, a_az): else: msg = 'Scan will be unsafe in %.1f hours' % (info['sun_time'] / 3600) - if self._get_sun_policy('sunsafe_moves'): - return safe, msg - else: - return True, 'Sun-safety not active; %s' % msg + return safe, msg def _get_sunsafe_moves(self, target_az, target_el): """Given a target position, find a Sun-safe way to get there. This