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)
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))
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))
def execute_look_ahead(self, callback: CommandCallback) -> None: command = "look_ahead" self._callback_commands[command] = callback self._communication_service.send_message(Message(command))
def execute_championship(self, callback: CommandCallback) -> None: command = "championship" self._callback_commands[command] = callback self._communication_service.send_message(Message(command))
def execute_update_directions(self, callback: CommandCallback) -> None: command = "update_directions" self._callback_commands[command] = callback self._communication_service.send_message(Message(command))
def execute_discharge_magnet(self, callback: CommandCallback) -> None: command = "discharge_magnet" self._callback_commands[command] = callback self._communication_service.send_message(Message(command))
def _lost_connection(self) -> None: self._communication_service.send_message(Message("lost_connection"))
def setUp(self) -> None: self.message = Message("test_message", variable1="variable1")
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))
def get_position(self) -> AbsoluteCoordinate: self._communication_service.send_message(Message("get_position")) self._position_received.clear() self._position_received.wait() return self._position
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))
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))
def send_full_path(self, path: AbsolutePath) -> None: data = path.serialize() self._communication_service.send_message( Message("full_path", path=data))
def request_home_pathable(self) -> None: self._communication_service.send_message( Message("request_home_pathable"))
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")
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))
def _start_charging(self) -> None: self._communication_service.send_message(Message("start_charging"))
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))
def _charge_done(self) -> None: self._communication_service.send_message(Message("charge_done"))
def _complete_command(self, command: str) -> None: returned_message = Message("command_completed", command=command) self._communication_service.send_message(returned_message)