Skip to content

Commit

Permalink
MISSIONS: block missions from firing launcher while reloading
Browse files Browse the repository at this point in the history
  • Loading branch information
kev-the-dev committed Nov 11, 2018
1 parent 9f2a5e7 commit d15d35d
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ def _init(cls, task_runner):
cls.vision_proxies = {}
cls._load_vision_services()

cls.launcher_state = "inactive"
cls._actuator_timing = yield cls.nh.get_param("~actuator_timing")

cls.mission_params = {}
Expand Down Expand Up @@ -214,13 +215,23 @@ def retract_thrusters(self):

@util.cancellableInlineCallbacks
def reload_launcher(self):
if self.launcher_state != "inactive":
raise Exception("Launcher is {}".format(self.launcher_state))
self.launcher_state = "reloading"
yield self.set_valve('LAUNCHER_RELOAD', True)
yield self.nh.sleep(self._actuator_timing['launcher_reload_extend_time'])
yield self.set_valve('LAUNCHER_RELOAD', False)
yield self.nh.sleep(self._actuator_timing['launcher_reload_retract_time'])
self.launcher_state = "inactive"

@util.cancellableInlineCallbacks
def fire_launcher(self):
return self.set_valve('LAUNCHER_FIRE', True)
if self.launcher_state != "inactive":
raise Exception("Launcher is {}".format(self.launcher_state))
self.launcher_state = "firing"
yield self.set_valve('LAUNCHER_FIRE', True)
yield self.nh.sleep(0.5)
self.launcher_state = "inactive"

def set_valve(self, name, state):
req = SetValveRequest(actuator=name, opened=state)
Expand Down

0 comments on commit d15d35d

Please sign in to comment.