use mpc controller with short horizon

This commit is contained in:
Simon Pirkelmann 2021-09-10 00:43:02 +02:00
parent 1c8d4a1d57
commit eea1cee1ec
2 changed files with 4 additions and 4 deletions

View File

@ -57,8 +57,8 @@ class ControlCommander:
if not all_detected: if not all_detected:
print(f"warning: no measurements available for the following robots: {undetected_robots}") print(f"warning: no measurements available for the following robots: {undetected_robots}")
time.sleep(0.5) time.sleep(0.5)
print("all robots detected -> starting control")
print("starting control")
self.running = True self.running = True
while self.running: while self.running:
while not self.event_listener.event_queue.empty(): while not self.event_listener.event_queue.empty():
@ -111,13 +111,13 @@ class ControlCommander:
if __name__ == '__main__': if __name__ == '__main__':
id_ip_dict = { id_ip_dict = {
#11: '10.10.11.88', #11: '10.10.11.88',
12: '192.168.1.12', #12: '192.168.1.12',
13: '192.168.1.13', 13: '192.168.1.13',
#14: '10.10.11.89', #14: '10.10.11.89',
} }
# controller_type = {12: 'mpc', 13: 'pid'} # controller_type = {12: 'mpc', 13: 'pid'}
controller_type = 'pid' controller_type = 'mpc'
rc = ControlCommander(id_ip_dict, controller_type=controller_type) rc = ControlCommander(id_ip_dict, controller_type=controller_type)
rc.run() rc.run()

View File

@ -6,7 +6,7 @@ from casadi_opt import OpenLoopSolver
class MPCController(ControllerBase): class MPCController(ControllerBase):
def __init__(self, N=20, T=1.0): def __init__(self, N=10, T=1.0):
super().__init__() super().__init__()
self.t = None self.t = None