def _toggle(req): global _ctrl_on _ctrl_on = not _ctrl_on srv = Trigger() srv.success = True srv.message = "Controller is {}".format(_ctrl_on) return TriggerResponse(True, "Controller is {}".format(_ctrl_on))
def callback(self, message): self.latest_message = message self.detection_dict = self.four_sector_detection() crashed, direction = self.has_crashed(): if crashed: trigger = Trigger() trigger.success = False trigger.message = direction self.crash_publisher.publish(trigger)