Skip to content

Commit

Permalink
s
Browse files Browse the repository at this point in the history
  • Loading branch information
rombie18 committed May 3, 2023
1 parent 5f84bc6 commit 13eddae
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions Software/threads/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 13eddae

Please sign in to comment.