From 13eddaef68020cb71dac4b22ba82606eafdfd4a8 Mon Sep 17 00:00:00 2001 From: Wout Rombouts Date: Wed, 3 May 2023 20:08:34 +0200 Subject: [PATCH] s --- Software/threads/main.py | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Software/threads/main.py b/Software/threads/main.py index 2608467..cc0439f 100644 --- a/Software/threads/main.py +++ b/Software/threads/main.py @@ -28,9 +28,6 @@ def __init__(self): self.control = "MANUAL" self.flag_initialised = False - self.flag_halt = False - self.flag_stop = False - self.flag_pause = False self.velocity = 0 self.set_velocity = 0 @@ -81,7 +78,6 @@ def __init__(self): logging.info("Starting main loop") try: while not self.stop_event.is_set(): - self.handle_controls() self.process_flags() #TODO improve state machine @@ -111,7 +107,6 @@ def __init__(self): def safe_stop(self): logging.info("Safe stop") self.threads_stop() - self.flag_stop = True self.actuator_motor.throttle = 0 self.actuator_servo.angle = self.transform_heading_to_angle(0) GPIO.cleanup() @@ -182,16 +177,16 @@ def transform_centerangle_to_angle(self, centerangle): ### Controller functions ### def controller_add(self, joy): - print('Controller connected:', joy) + logging.debug('Controller connected: ', joy) def controller_remove(self, joy): - print('Controller disconnected:', joy) + logging.debug('Controller disconnected: ', joy) # Robot sould stop here or at least continue in a very slow safe mode - self.stop = True + self.stop_event.set() def controller_process(self, key): try: - print(key) + logging.debug("Controller key event: " + key) if key.keytype == "Axis" and key.number == 0: # Left joystick, left - right # Steering