adjusted key events to Qt and changed robot ips

master
Simon Pirkelmann 2021-09-07 00:21:51 +02:00
parent bbb341ea56
commit 2dc3eef2d6
1 changed files with 6 additions and 6 deletions

View File

@ -75,7 +75,7 @@ class CommanderBase:
self.robots[controlled_robot_id].move_to_pos(target_pos) self.robots[controlled_robot_id].move_to_pos(target_pos)
elif event[0] == 'key': elif event[0] == 'key':
key = event[1] key = event[1]
if key == 32: # arrow up if key == 16777235: # arrow up
self.controlling = not self.controlling self.controlling = not self.controlling
if not self.controlling: if not self.controlling:
print("disable control") print("disable control")
@ -85,7 +85,7 @@ class CommanderBase:
print("enable control") print("enable control")
for _, r in self.robots.items(): for _, r in self.robots.items():
r.start_control() r.start_control()
elif key == 9: # TAB elif key == 16777236: # left
# switch controlled robot # switch controlled robot
self.current_robot_index = (self.current_robot_index + 1) % len(self.robots) self.current_robot_index = (self.current_robot_index + 1) % len(self.robots)
controlled_robot_id = list(self.robots.keys())[self.current_robot_index] controlled_robot_id = list(self.robots.keys())[self.current_robot_index]
@ -101,13 +101,13 @@ class CommanderBase:
if __name__ == '__main__': if __name__ == '__main__':
id_ip_dict = { id_ip_dict = {
#11: '10.10.11.88', #11: '10.10.11.88',
#12: '10.10.11.91', 12: '192.168.1.12',
#13: '10.10.11.90', 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 = 'mpc' controller_type = 'pid'
rc = CommanderBase(id_ip_dict, controller_type=controller_type) rc = CommanderBase(id_ip_dict, controller_type=controller_type)
rc.run() rc.run()