示例#1
0
 def _update_base(self) -> None:
     self._vision_service.update()
     update_message = Message("update", light_on=self._display_service.is_light_on(),
                              image_data=self._vision_service.get_image(),
                              capacitor_charge=self._chargeable.get_charge(),
                              objective=self._vision_service.get_objective())
     self._communication_service.send_message(update_message)
示例#2
0
 def update(self) -> None:
     position = self._vision_service.get_robot()
     robot_position = Position(position.coordinate.to_centimeters(),
                               position.orientation)
     data = robot_position.serialize()
     self._communication_service.send_message(
         Message("position", position=data))
示例#3
0
 def execute_directional_movement(self, direction: str, speed: str,
                                  distance: float,
                                  callback: CommandCallback) -> None:
     command = "directional_movement"
     self._callback_commands[command] = callback
     self._communication_service.send_message(
         Message(command,
                 direction=direction,
                 speed=speed,
                 distance=distance))
示例#4
0
 def execute_look_ahead(self, callback: CommandCallback) -> None:
     command = "look_ahead"
     self._callback_commands[command] = callback
     self._communication_service.send_message(Message(command))
示例#5
0
 def execute_championship(self, callback: CommandCallback) -> None:
     command = "championship"
     self._callback_commands[command] = callback
     self._communication_service.send_message(Message(command))
示例#6
0
 def execute_update_directions(self, callback: CommandCallback) -> None:
     command = "update_directions"
     self._callback_commands[command] = callback
     self._communication_service.send_message(Message(command))
示例#7
0
 def execute_discharge_magnet(self, callback: CommandCallback) -> None:
     command = "discharge_magnet"
     self._callback_commands[command] = callback
     self._communication_service.send_message(Message(command))
示例#8
0
 def _lost_connection(self) -> None:
     self._communication_service.send_message(Message("lost_connection"))
示例#9
0
 def setUp(self) -> None:
     self.message = Message("test_message", variable1="variable1")
示例#10
0
 def execute_drop_subroutine(self, target: str,
                             callback: CommandCallback) -> None:
     command = "drop_subroutine"
     self._callback_commands[command] = callback
     self._communication_service.send_message(
         Message(command, target=target))
示例#11
0
 def get_position(self) -> AbsoluteCoordinate:
     self._communication_service.send_message(Message("get_position"))
     self._position_received.clear()
     self._position_received.wait()
     return self._position
示例#12
0
 def _pathable_goal(self, message: Message) -> None:
     path = self._pathfinding_service.get_goal()
     data = path.serialize()
     self._communication_service.send_message(
         Message("goal_pathable", table=data))
示例#13
0
 def _pathable_charge_station(self, message: Message) -> None:
     path = self._pathfinding_service.get_charge_station()
     data = path.serialize()
     self._communication_service.send_message(
         Message("charge_station_pathable", table=data))
示例#14
0
 def send_full_path(self, path: AbsolutePath) -> None:
     data = path.serialize()
     self._communication_service.send_message(
         Message("full_path", path=data))
示例#15
0
 def request_home_pathable(self) -> None:
     self._communication_service.send_message(
         Message("request_home_pathable"))
示例#16
0
 def setUp(self) -> None:
     self.robot_connector = Mock()
     self.connection = Mock()
     self.robot_connector.connect_robot.return_value = self.connection
     self.test_message = Message("test_message", variable1="variable1")
示例#17
0
 def execute_switch_light_subroutine(self,
                                     callback: CommandCallback) -> None:
     command = "switch_light_subroutine"
     self._callback_commands[command] = callback
     self._communication_service.send_message(Message(command))
示例#18
0
 def _start_charging(self) -> None:
     self._communication_service.send_message(Message("start_charging"))
示例#19
0
 def execute_rotational_movement(self, angle: float,
                                 callback: CommandCallback) -> None:
     command = "rotational_movement"
     self._callback_commands[command] = callback
     self._communication_service.send_message(Message(command, angle=angle))
示例#20
0
 def _charge_done(self) -> None:
     self._communication_service.send_message(Message("charge_done"))
示例#21
0
 def _complete_command(self, command: str) -> None:
     returned_message = Message("command_completed", command=command)
     self._communication_service.send_message(returned_message)