Skip to content

Check safety during transition#518

Merged
jamessynge merged 3 commits intopanoptes:developfrom
wtgee:bad-weather-while-transition-504
Jul 11, 2018
Merged

Check safety during transition#518
jamessynge merged 3 commits intopanoptes:developfrom
wtgee:bad-weather-while-transition-504

Conversation

@wtgee
Copy link
Copy Markdown
Member

@wtgee wtgee commented May 8, 2018

If the state doesn't successfully change, check the safety between each iteration and if False send to parking

Note: still trying to figure out how to test this

Fixes #504

If the state doesn't successfully change, check the safety between each iteration and if False send to parking

Note: no test for this written
@wtgee wtgee requested a review from a team May 8, 2018 16:07
@codecov
Copy link
Copy Markdown

codecov bot commented May 8, 2018

Codecov Report

Merging #518 into develop will decrease coverage by 0.13%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop     #518      +/-   ##
===========================================
- Coverage    70.46%   70.33%   -0.14%     
===========================================
  Files           62       62              
  Lines         5418     5423       +5     
  Branches       752      753       +1     
===========================================
- Hits          3818     3814       -4     
- Misses        1392     1401       +9     
  Partials       208      208
Impacted Files Coverage Δ
pocs/state/machine.py 86% <0%> (-2.97%) ⬇️
pocs/serial_handlers/protocol_arduinosimulator.py 75.38% <0%> (-1.16%) ⬇️
pocs/camera/camera.py 89.5% <0%> (-1.11%) ⬇️
pocs/dome/astrohaven.py 73.68% <0%> (+0.87%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 17754d0...e658bc6. Read the comment docs.

Comment thread pocs/state/machine.py
# If we didn't successfully transition, sleep a while then try again
if not state_changed:
if _loop_iteration > 5:
if self.is_safe() is False:
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add logging to indicate what is going on. For example:

if not state_changed:
    self.logger.warning("Failed to transition from {} to {}", self.state, self.next_state)
    if not self.is_safe():
        self.logger.warning("Conditions have become unsafe; setting next state to 'parking'")
        self.next_state = 'parking'
    elif _loop_iteration > 5:
        self.logger.warning("Stuck in current state for 5 iterations, parking")
        self.next_state = 'parking'
    else:
        _loop_iteration = _loop_iteration + 1
        self.logger.warning("Sleeping for a bit, then trying the transition again (loop: {})",
                                       _loop_iteration)
        self.sleep(with_status=False)

@jamessynge jamessynge merged commit 2b3ec28 into panoptes:develop Jul 11, 2018
@wtgee wtgee deleted the bad-weather-while-transition-504 branch July 11, 2018 00:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants