Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACU: permit scans on LAT even when Sun Avoidance is not to be enabled #586

Merged
merged 3 commits into from
Dec 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 24 additions & 7 deletions socs/agents/acu/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.'
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down