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