Example #1
0
 def keyPressEvent(self, event:QKeyEvent):
     if event.isAutoRepeat():
         return
     key = event.key()
     if key == Qt.Key_G:
         img = ObstacleMap(self.obstacles, GRAPH_TABLE_RATIO, self.robot.radius)
         print("dumping")
         img.dump_obstacle_grid_to_file("graph.txt")
     elif key == Qt.Key_Ampersand:
         self.ivy.send_action(1)
     elif key == Qt.Key_Eacute:
         self.ivy.send_action(2)
     elif key == Qt.Key_QuoteDbl:
         self.ivy.send_action(3)
     elif key == Qt.Key_Apostrophe:
         self.ivy.send_action(4)
     elif key == Qt.Key_ParenLeft:
         self.ivy.send_action(5)
     elif key == Qt.Key_Minus:
         self.ivy.send_action(6)
     elif key == Qt.Key_Egrave:
         self.ivy.send_action(7)
     elif key == Qt.Key_Underscore:
         self.ivy.send_action(8)
     elif key == Qt.Key_Ccedilla:
         self.ivy.send_action(9)
     elif key == Qt.Key_Agrave:
         self.ivy.send_action(10)
     elif key == Qt.Key_ParenRight:
         self.ivy.send_action(11)
     elif key == Qt.Key_Equal:
         self.ivy.send_action(12)
     elif key == Qt.Key_Z:
         self.robot_speed_command[1] = -1
         self.ivy.send_speed_direction(self.robot_speed_command)
     elif key == Qt.Key_Q:
         self.robot_speed_command[0] = 1
         self.ivy.send_speed_direction(self.robot_speed_command)
     elif key == Qt.Key_S:
         self.robot_speed_command[1] = 1
         self.ivy.send_speed_direction(self.robot_speed_command)
     elif key == Qt.Key_D:
         self.robot_speed_command[0] = -1
         self.ivy.send_speed_direction(self.robot_speed_command)
     elif key == Qt.Key_A:
         self.robot_speed_command[2] = 1
         self.ivy.send_speed_direction(self.robot_speed_command)
     elif key == Qt.Key_E:
         self.robot_speed_command[2] = -1
         self.ivy.send_speed_direction(self.robot_speed_command)