adjusted key events to Qt and changed robot ips
This commit is contained in:
parent
bbb341ea56
commit
2dc3eef2d6
|
@ -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()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user