From 567813f7fec16a4e185026aa73f59725fd65d938 Mon Sep 17 00:00:00 2001 From: ijnek Date: Sun, 8 Dec 2024 22:58:22 +0000 Subject: [PATCH] delete deprecated packages --- gc_spl/CHANGELOG.rst | 15 -- gc_spl/gc_spl/__init__.py | 0 gc_spl/gc_spl/gc_spl.py | 148 -------------- gc_spl/gc_spl/rcgcd_14/conversion.py | 46 ----- .../rcgcd_14/robocup_game_control_data.py | 135 ------------- gc_spl/gc_spl/rcgcd_15/conversion.py | 48 ----- .../rcgcd_15/robocup_game_control_data.py | 136 ------------- gc_spl/gc_spl/rcgcrd_4/conversion.py | 33 --- .../robocup_game_control_return_data.py | 44 ---- gc_spl/package.xml | 25 --- gc_spl/resource/gc_spl | 0 gc_spl/setup.cfg | 4 - gc_spl/setup.py | 26 --- .../conversion/test_conversion_rcgcd_14.py | 122 ----------- .../conversion/test_conversion_rcgcd_15.py | 182 ----------------- .../conversion/test_conversion_rcgcrd_4.py | 37 ---- gc_spl/test/test_copyright.py | 23 --- gc_spl/test/test_flake8.py | 25 --- gc_spl/test/test_gc_spl.py | 190 ------------------ gc_spl/test/test_pep257.py | 23 --- gc_spl_2022/CHANGELOG.rst | 16 -- gc_spl_2022/gc_spl_2022/__init__.py | 0 gc_spl_2022/gc_spl_2022/gc_spl.py | 108 ---------- gc_spl_2022/package.xml | 27 --- gc_spl_2022/resource/gc_spl_2022 | 0 gc_spl_2022/setup.cfg | 4 - gc_spl_2022/setup.py | 26 --- gc_spl_2022/test/test_copyright.py | 23 --- gc_spl_2022/test/test_flake8.py | 25 --- gc_spl_2022/test/test_gc_spl.py | 155 -------------- gc_spl_2022/test/test_pep257.py | 23 --- gc_spl_interfaces/CHANGELOG.rst | 15 -- gc_spl_interfaces/CMakeLists.txt | 37 ---- gc_spl_interfaces/msg/RCGCD14.msg | 38 ---- gc_spl_interfaces/msg/RCGCD15.msg | 36 ---- gc_spl_interfaces/msg/RCGCRD4.msg | 6 - gc_spl_interfaces/msg/RobotInfo14.msg | 16 -- gc_spl_interfaces/msg/RobotInfo15.msg | 17 -- gc_spl_interfaces/msg/TeamInfo14.msg | 18 -- gc_spl_interfaces/msg/TeamInfo15.msg | 21 -- gc_spl_interfaces/package.xml | 25 --- rcgcd_spl_14/CHANGELOG.rst | 16 -- rcgcd_spl_14/CMakeLists.txt | 28 --- rcgcd_spl_14/msg/RCGCD.msg | 38 ---- rcgcd_spl_14/msg/RobotInfo.msg | 16 -- rcgcd_spl_14/msg/TeamInfo.msg | 18 -- rcgcd_spl_14/package.xml | 25 --- rcgcd_spl_14_conversion/CHANGELOG.rst | 16 -- rcgcd_spl_14_conversion/package.xml | 24 --- .../rcgcd_spl_14_conversion/__init__.py | 0 .../rcgcd_spl_14_conversion/conversion.py | 47 ----- .../robocup_game_control_data.py | 135 ------------- .../resource/rcgcd_spl_14_conversion | 0 rcgcd_spl_14_conversion/setup.cfg | 4 - rcgcd_spl_14_conversion/setup.py | 25 --- .../test/test_conversion.py | 122 ----------- .../test/test_copyright.py | 23 --- rcgcd_spl_14_conversion/test/test_flake8.py | 25 --- rcgcd_spl_14_conversion/test/test_pep257.py | 23 --- rcgcrd_spl_4/CHANGELOG.rst | 17 -- rcgcrd_spl_4/CMakeLists.txt | 26 --- rcgcrd_spl_4/msg/RCGCRD.msg | 6 - rcgcrd_spl_4/package.xml | 25 --- rcgcrd_spl_4_conversion/CHANGELOG.rst | 16 -- rcgcrd_spl_4_conversion/package.xml | 24 --- .../rcgcrd_spl_4_conversion/__init__.py | 0 .../rcgcrd_spl_4_conversion/conversion.py | 33 --- .../robocup_game_control_return_data.py | 44 ---- .../resource/rcgcrd_spl_4_conversion | 0 rcgcrd_spl_4_conversion/setup.cfg | 4 - rcgcrd_spl_4_conversion/setup.py | 26 --- .../test/test_conversion.py | 38 ---- .../test/test_copyright.py | 23 --- rcgcrd_spl_4_conversion/test/test_flake8.py | 25 --- rcgcrd_spl_4_conversion/test/test_pep257.py | 23 --- 75 files changed, 2813 deletions(-) delete mode 100644 gc_spl/CHANGELOG.rst delete mode 100644 gc_spl/gc_spl/__init__.py delete mode 100644 gc_spl/gc_spl/gc_spl.py delete mode 100644 gc_spl/gc_spl/rcgcd_14/conversion.py delete mode 100644 gc_spl/gc_spl/rcgcd_14/robocup_game_control_data.py delete mode 100644 gc_spl/gc_spl/rcgcd_15/conversion.py delete mode 100644 gc_spl/gc_spl/rcgcd_15/robocup_game_control_data.py delete mode 100644 gc_spl/gc_spl/rcgcrd_4/conversion.py delete mode 100644 gc_spl/gc_spl/rcgcrd_4/robocup_game_control_return_data.py delete mode 100644 gc_spl/package.xml delete mode 100644 gc_spl/resource/gc_spl delete mode 100644 gc_spl/setup.cfg delete mode 100644 gc_spl/setup.py delete mode 100644 gc_spl/test/conversion/test_conversion_rcgcd_14.py delete mode 100644 gc_spl/test/conversion/test_conversion_rcgcd_15.py delete mode 100644 gc_spl/test/conversion/test_conversion_rcgcrd_4.py delete mode 100644 gc_spl/test/test_copyright.py delete mode 100644 gc_spl/test/test_flake8.py delete mode 100644 gc_spl/test/test_gc_spl.py delete mode 100644 gc_spl/test/test_pep257.py delete mode 100644 gc_spl_2022/CHANGELOG.rst delete mode 100644 gc_spl_2022/gc_spl_2022/__init__.py delete mode 100644 gc_spl_2022/gc_spl_2022/gc_spl.py delete mode 100644 gc_spl_2022/package.xml delete mode 100644 gc_spl_2022/resource/gc_spl_2022 delete mode 100644 gc_spl_2022/setup.cfg delete mode 100644 gc_spl_2022/setup.py delete mode 100644 gc_spl_2022/test/test_copyright.py delete mode 100644 gc_spl_2022/test/test_flake8.py delete mode 100644 gc_spl_2022/test/test_gc_spl.py delete mode 100644 gc_spl_2022/test/test_pep257.py delete mode 100644 gc_spl_interfaces/CHANGELOG.rst delete mode 100644 gc_spl_interfaces/CMakeLists.txt delete mode 100644 gc_spl_interfaces/msg/RCGCD14.msg delete mode 100644 gc_spl_interfaces/msg/RCGCD15.msg delete mode 100644 gc_spl_interfaces/msg/RCGCRD4.msg delete mode 100644 gc_spl_interfaces/msg/RobotInfo14.msg delete mode 100644 gc_spl_interfaces/msg/RobotInfo15.msg delete mode 100644 gc_spl_interfaces/msg/TeamInfo14.msg delete mode 100644 gc_spl_interfaces/msg/TeamInfo15.msg delete mode 100644 gc_spl_interfaces/package.xml delete mode 100644 rcgcd_spl_14/CHANGELOG.rst delete mode 100644 rcgcd_spl_14/CMakeLists.txt delete mode 100644 rcgcd_spl_14/msg/RCGCD.msg delete mode 100644 rcgcd_spl_14/msg/RobotInfo.msg delete mode 100644 rcgcd_spl_14/msg/TeamInfo.msg delete mode 100644 rcgcd_spl_14/package.xml delete mode 100644 rcgcd_spl_14_conversion/CHANGELOG.rst delete mode 100644 rcgcd_spl_14_conversion/package.xml delete mode 100644 rcgcd_spl_14_conversion/rcgcd_spl_14_conversion/__init__.py delete mode 100644 rcgcd_spl_14_conversion/rcgcd_spl_14_conversion/conversion.py delete mode 100644 rcgcd_spl_14_conversion/rcgcd_spl_14_conversion/robocup_game_control_data.py delete mode 100644 rcgcd_spl_14_conversion/resource/rcgcd_spl_14_conversion delete mode 100644 rcgcd_spl_14_conversion/setup.cfg delete mode 100644 rcgcd_spl_14_conversion/setup.py delete mode 100644 rcgcd_spl_14_conversion/test/test_conversion.py delete mode 100644 rcgcd_spl_14_conversion/test/test_copyright.py delete mode 100644 rcgcd_spl_14_conversion/test/test_flake8.py delete mode 100644 rcgcd_spl_14_conversion/test/test_pep257.py delete mode 100644 rcgcrd_spl_4/CHANGELOG.rst delete mode 100644 rcgcrd_spl_4/CMakeLists.txt delete mode 100644 rcgcrd_spl_4/msg/RCGCRD.msg delete mode 100644 rcgcrd_spl_4/package.xml delete mode 100644 rcgcrd_spl_4_conversion/CHANGELOG.rst delete mode 100644 rcgcrd_spl_4_conversion/package.xml delete mode 100644 rcgcrd_spl_4_conversion/rcgcrd_spl_4_conversion/__init__.py delete mode 100644 rcgcrd_spl_4_conversion/rcgcrd_spl_4_conversion/conversion.py delete mode 100644 rcgcrd_spl_4_conversion/rcgcrd_spl_4_conversion/robocup_game_control_return_data.py delete mode 100644 rcgcrd_spl_4_conversion/resource/rcgcrd_spl_4_conversion delete mode 100644 rcgcrd_spl_4_conversion/setup.cfg delete mode 100644 rcgcrd_spl_4_conversion/setup.py delete mode 100644 rcgcrd_spl_4_conversion/test/test_conversion.py delete mode 100644 rcgcrd_spl_4_conversion/test/test_copyright.py delete mode 100644 rcgcrd_spl_4_conversion/test/test_flake8.py delete mode 100644 rcgcrd_spl_4_conversion/test/test_pep257.py diff --git a/gc_spl/CHANGELOG.rst b/gc_spl/CHANGELOG.rst deleted file mode 100644 index ea7c6fb..0000000 --- a/gc_spl/CHANGELOG.rst +++ /dev/null @@ -1,15 +0,0 @@ -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Changelog for package gc_spl -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -4.0.1 (2024-04-14) ------------------- - -4.0.0 (2024-01-20) ------------------- -* Deprecate package (`#79 `_) -* Add package (`#58 `_) -* Contributors: Florian Vahl, Kenji Brameld - -3.0.0 (2022-06-15) ------------------- diff --git a/gc_spl/gc_spl/__init__.py b/gc_spl/gc_spl/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/gc_spl/gc_spl/gc_spl.py b/gc_spl/gc_spl/gc_spl.py deleted file mode 100644 index bb12230..0000000 --- a/gc_spl/gc_spl/gc_spl.py +++ /dev/null @@ -1,148 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import socket -from threading import Thread - -import rclpy -from rclpy.node import Node -from rclpy.parameter import Parameter - - -class GCSPL(Node): - """Node that runs on the robot to communicate with SPL GameController.""" - - _loop_thread = None - _client = None - _publisher = None - _host = None - _RCGCD = None - - def __init__(self, node_name='gc_spl', **kwargs): - super().__init__(node_name, **kwargs) - - # Declare parameters - self.declare_parameter('return_port', 3939) - self.declare_parameter('rcgcd_version', Parameter.Type.INTEGER) - self.declare_parameter('rcgcrd_version', Parameter.Type.INTEGER) - - # Read and log parameters - return_port = self.get_parameter('return_port').value - self.get_logger().debug('return_port: %s' % return_port) - - # Import libraries dependending on rcgcd and rcgcrd version - rcgcd_version = self.get_parameter('rcgcd_version').value - if rcgcd_version is None: - self.get_logger().error('rcgcd_version not provided as a parameter. ' + - 'Unable to start node.') - return - self.get_logger().debug('rcgcd_version: %s' % rcgcd_version) - - rcgcrd_version = self.get_parameter('rcgcrd_version').value - if rcgcrd_version is None: - self.get_logger().error('rcgcrd_version not provided as a parameter. ' + - 'Unable to start node.') - return - self.get_logger().debug('rcgcrd_version: %s' % rcgcrd_version) - - self._setup_methods(rcgcd_version, rcgcrd_version) - - # Setup publisher - self._publisher = self.create_publisher(self.RCGCD, 'gc/data', 10) - - # Setup subscriber - self._subscriber = self.create_subscription( - self.RCGCRD, 'gc/return_data', self._rcgcrd_callback, 10) - - # UDP Client - adapted from https://github.com/ninedraft/python-udp/blob/master/client.py - self._client = socket.socket( - socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) # UDP - # This has to be SO_REUSEADDR instead of SO_REUSEPORT to work with TCM - self._client.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - self._client.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) - self._client.bind(('', self.GAMECONTROLLER_DATA_PORT)) - # Set timeout so _loop can constantly check for rclpy.ok() - self._client.settimeout(0.1) - - # Start thread to continuously poll - self._loop_thread = Thread(target=self._loop) - self._loop_thread.start() - - def _setup_methods(self, rcgcd_version, rcgcrd_version): - # RCGCD - if rcgcd_version == 14: - from gc_spl_interfaces.msg import RCGCD14 as RCGCD - from gc_spl.rcgcd_14.robocup_game_control_data import \ - GAMECONTROLLER_DATA_PORT - from gc_spl.rcgcd_14.conversion import rcgcd_data_to_msg - elif rcgcd_version == 15: - from gc_spl_interfaces.msg import RCGCD15 as RCGCD - from gc_spl.rcgcd_15.robocup_game_control_data import \ - GAMECONTROLLER_DATA_PORT - from gc_spl.rcgcd_15.conversion import rcgcd_data_to_msg - else: - self.get_logger().error('rcgcd_version ' + rcgcd_version + ' is not supported.') - self.RCGCD = RCGCD - self.GAMECONTROLLER_DATA_PORT = GAMECONTROLLER_DATA_PORT - self.rcgcd_data_to_msg = rcgcd_data_to_msg - - # RCGCRD - if rcgcrd_version == 4: - from gc_spl_interfaces.msg import RCGCRD4 as RCGCRD - from gc_spl.rcgcrd_4.conversion import rcgcrd_msg_to_data - from gc_spl.rcgcrd_4.robocup_game_control_return_data import \ - GAMECONTROLLER_RETURN_PORT - else: - self.get_logger().error('rcgcrd_version ' + rcgcrd_version + ' is not supported.') - self.RCGCRD = RCGCRD - self.rcgcrd_msg_to_data = rcgcrd_msg_to_data - self.GAMECONTROLLER_RETURN_PORT = GAMECONTROLLER_RETURN_PORT - - def _loop(self): - while rclpy.ok(): - try: - data, (self._host, _) = self._client.recvfrom(1024) - self.get_logger().debug('received: "%s"' % data) - - # Convert data to ROS msg - msg = self.rcgcd_data_to_msg(data) - - # Publish it - self._publisher.publish(msg) - except TimeoutError: - pass - - def _rcgcrd_callback(self, msg): - - if self._host is None: - self.get_logger().debug( - 'Not returning RoboCupGameControlReturnData, as GameController' - ' host address is not known yet.') - return - - data = self.rcgcrd_msg_to_data(msg) - - # Return data directly to the GameController's address and return port - self._client.sendto(data, (self._host, self.GAMECONTROLLER_RETURN_PORT)) - - -def main(args=None): - rclpy.init(args=args) - gc_spl = GCSPL() - rclpy.spin(gc_spl) - rclpy.shutdown() - - -if __name__ == '__main__': - main() diff --git a/gc_spl/gc_spl/rcgcd_14/conversion.py b/gc_spl/gc_spl/rcgcd_14/conversion.py deleted file mode 100644 index 8cb8312..0000000 --- a/gc_spl/gc_spl/rcgcd_14/conversion.py +++ /dev/null @@ -1,46 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from gc_spl.rcgcd_14.robocup_game_control_data import ( - MAX_NUM_PLAYERS, RoboCupGameControlData) -from gc_spl_interfaces.msg import RCGCD14 - - -def rcgcd_data_to_msg(data: bytes) -> RCGCD14: - """Convert binary data to RCGCRD ROS msg.""" - parsed = RoboCupGameControlData.parse(data) - msg = RCGCD14() - msg.packet_number = parsed.packetNumber - msg.players_per_team = parsed.playersPerTeam - msg.competition_phase = parsed.competitionPhase - msg.competition_type = parsed.competitionType - msg.game_phase = parsed.gamePhase - msg.state = parsed.state - msg.set_play = parsed.setPlay - msg.first_half = parsed.firstHalf - msg.kicking_team = parsed.kickingTeam - msg.secs_remaining = parsed.secsRemaining - msg.secondary_time = parsed.secondaryTime - for t in range(2): - msg.teams[t].team_number = parsed.teams[t].teamNumber - msg.teams[t].team_colour = parsed.teams[t].teamColour - msg.teams[t].score = parsed.teams[t].score - msg.teams[t].penalty_shot = parsed.teams[t].penaltyShot - msg.teams[t].single_shots = parsed.teams[t].singleShots - msg.teams[t].message_budget = parsed.teams[t].messageBudget - for p in range(MAX_NUM_PLAYERS): - msg.teams[t].players[p].penalty = parsed.teams[t].players[p].penalty - msg.teams[t].players[p].secs_till_unpenalised = \ - parsed.teams[t].players[p].secsTillUnpenalised - return msg diff --git a/gc_spl/gc_spl/rcgcd_14/robocup_game_control_data.py b/gc_spl/gc_spl/rcgcd_14/robocup_game_control_data.py deleted file mode 100644 index 3d9ebda..0000000 --- a/gc_spl/gc_spl/rcgcd_14/robocup_game_control_data.py +++ /dev/null @@ -1,135 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -Library to convert binary udp data to a meaningful python object. - -Example of listening to the GameController, and accessing the data using this library:: - - from robocup_game_control_data import GAMECONTROLLER_DATA_PORT, RoboCupGameControlData - import socket - - # Setup UDP client - client = socket.socket( - socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) # UDP - client.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # SO_REUSEADDR instead of SO_REUSEPORT to work while TCM is running # noqa: E501 - client.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) - client.bind(('', GAMECONTROLLER_DATA_PORT)) - - # Receive data - data = client.recv(1024) - - # Parse it - parsed = RoboCupGameControlData.parse(data) - - # Accessing data - print('First team player4 penalty: ', - parsed.teams[0].players[3].penalty) - print('state: ', parsed.state) -""" - - -from construct import Array, Byte, Const, Int16sl, Int16ul, Struct - -GAMECONTROLLER_DATA_PORT = 3838 - -GAMECONTROLLER_STRUCT_HEADER = b'RGme' -GAMECONTROLLER_STRUCT_VERSION = 14 - -MAX_NUM_PLAYERS = 7 - -# SPL -TEAM_BLUE = 0 # blue, cyan -TEAM_RED = 1 # red, magenta, pink -TEAM_YELLOW = 2 # yellow -TEAM_BLACK = 3 # black, dark gray -TEAM_WHITE = 4 # white -TEAM_GREEN = 5 # green -TEAM_ORANGE = 6 # orange -TEAM_PURPLE = 7 # purple, violet -TEAM_BROWN = 8 # brown -TEAM_GRAY = 9 # lighter gray - -COMPETITION_PHASE_ROUNDROBIN = 0 -COMPETITION_PHASE_PLAYOFF = 1 - -COMPETITION_TYPE_NORMAL = 0 -COMPETITION_TYPE_CHALLENGE_SHIELD = 1 -COMPETITION_TYPE_7V7 = 2 -COMPETITION_TYPE_DYNAMIC_BALL_HANDLING = 3 - -GAME_PHASE_NORMAL = 0 -GAME_PHASE_PENALTYSHOOT = 1 -GAME_PHASE_OVERTIME = 2 -GAME_PHASE_TIMEOUT = 3 - -STATE_INITIAL = 0 -STATE_READY = 1 -STATE_SET = 2 -STATE_PLAYING = 3 -STATE_FINISHED = 4 - -SET_PLAY_NONE = 0 -SET_PLAY_GOAL_KICK = 1 -SET_PLAY_PUSHING_FREE_KICK = 2 -SET_PLAY_CORNER_KICK = 3 -SET_PLAY_KICK_IN = 4 -SET_PLAY_PENALTY_KICK = 5 - -PENALTY_NONE = 0 -# SPL -PENALTY_SPL_ILLEGAL_BALL_CONTACT = 1 # ball holding / playing with hands -PENALTY_SPL_PLAYER_PUSHING = 2 -PENALTY_SPL_ILLEGAL_MOTION_IN_SET = 3 # heard whistle too early? -PENALTY_SPL_INACTIVE_PLAYER = 4 # fallen, inactive -PENALTY_SPL_ILLEGAL_POSITION = 5 -PENALTY_SPL_LEAVING_THE_FIELD = 6 -PENALTY_SPL_REQUEST_FOR_PICKUP = 7 -PENALTY_SPL_LOCAL_GAME_STUCK = 8 -PENALTY_SPL_ILLEGAL_POSITION_IN_SET = 9 - -PENALTY_SUBSTITUTE = 14 -PENALTY_MANUAL = 15 - -RobotInfo = Struct( - 'penalty' / Byte, # penalty state of the player - 'secsTillUnpenalised' / Byte # estimate of time till unpenalised -) - -TeamInfo = Struct( - 'teamNumber' / Byte, # unique team number - 'teamColour' / Byte, # colour of the team - 'score' / Byte, # team's score - 'penaltyShot' / Byte, # penalty shot counter - 'singleShots' / Int16ul, # bits represent penalty shot success # noqa: E501 - 'messageBudget' / Int16ul, # number of team messages the team is allowed to send for the remainder of the game # noqa: E501 - 'players' / Array(MAX_NUM_PLAYERS, RobotInfo) # the team's players -) - -RoboCupGameControlData = Struct( - 'header' / Const(GAMECONTROLLER_STRUCT_HEADER), # header to identify the structure # noqa: E501 - 'version' / Const(GAMECONTROLLER_STRUCT_VERSION, Byte), # version of the data structure # noqa: E501 - 'packetNumber' / Byte, # number incremented with each packet sent (with wraparound) # noqa: E501 - 'playersPerTeam' / Byte, # the number of players on a team - 'competitionPhase' / Byte, # phase of the competition (COMPETITION_PHASE_ROUNDROBIN, COMPETITION_PHASE_PLAYOFF) # noqa: E501 - 'competitionType' / Byte, # type of the competition (COMPETITION_TYPE_NORMAL, COMPETITION_TYPE_CHALLENGE_SHIELD, etc) # noqa: E501 - 'gamePhase' / Byte, # phase of the game (GAME_PHASE_NORMAL, GAME_PHASE_PENALTYSHOOT, etc) # noqa: E501 - 'state' / Byte, # state of the game (STATE_READY, STATE_PLAYING, etc) # noqa: E501 - 'setPlay' / Byte, # active set play (SET_PLAY_NONE, SET_PLAY_GOAL_KICK, etc) # noqa: E501 - 'firstHalf' / Byte, # 1 = game in first half, 0 otherwise - 'kickingTeam' / Byte, # the team number of the next team to kick off, free kick etc - 'secsRemaining' / Int16sl, # estimate of number of seconds remaining in the half - 'secondaryTime' / Int16sl, # number of seconds shown as secondary time (remaining ready, until free ball, etc) # noqa: E501 - 'teams' / Array(2, TeamInfo) -) diff --git a/gc_spl/gc_spl/rcgcd_15/conversion.py b/gc_spl/gc_spl/rcgcd_15/conversion.py deleted file mode 100644 index 85b6fbe..0000000 --- a/gc_spl/gc_spl/rcgcd_15/conversion.py +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from gc_spl.rcgcd_15.robocup_game_control_data import ( - MAX_NUM_PLAYERS, RoboCupGameControlData) -from gc_spl_interfaces.msg import RCGCD15 - - -def rcgcd_data_to_msg(data: bytes) -> RCGCD15: - """Convert binary data to RCGCRD ROS msg.""" - parsed = RoboCupGameControlData.parse(data) - msg = RCGCD15() - msg.packet_number = parsed.packetNumber - msg.players_per_team = parsed.playersPerTeam - msg.competition_phase = parsed.competitionPhase - msg.competition_type = parsed.competitionType - msg.game_phase = parsed.gamePhase - msg.state = parsed.state - msg.set_play = parsed.setPlay - msg.first_half = parsed.firstHalf - msg.kicking_team = parsed.kickingTeam - msg.secs_remaining = parsed.secsRemaining - msg.secondary_time = parsed.secondaryTime - for t in range(2): - msg.teams[t].team_number = parsed.teams[t].teamNumber - msg.teams[t].field_player_colour = parsed.teams[t].fieldPlayerColour - msg.teams[t].goalkeeper_colour = parsed.teams[t].goalkeeperColour - msg.teams[t].goalkeeper = parsed.teams[t].goalkeeper - msg.teams[t].score = parsed.teams[t].score - msg.teams[t].penalty_shot = parsed.teams[t].penaltyShot - msg.teams[t].single_shots = parsed.teams[t].singleShots - msg.teams[t].message_budget = parsed.teams[t].messageBudget - for p in range(MAX_NUM_PLAYERS): - msg.teams[t].players[p].penalty = parsed.teams[t].players[p].penalty - msg.teams[t].players[p].secs_till_unpenalised = \ - parsed.teams[t].players[p].secsTillUnpenalised - return msg diff --git a/gc_spl/gc_spl/rcgcd_15/robocup_game_control_data.py b/gc_spl/gc_spl/rcgcd_15/robocup_game_control_data.py deleted file mode 100644 index dcd26f6..0000000 --- a/gc_spl/gc_spl/rcgcd_15/robocup_game_control_data.py +++ /dev/null @@ -1,136 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -Library to convert binary udp data to a meaningful python object. - -Example of listening to the GameController, and accessing the data using this library:: - - from robocup_game_control_data import GAMECONTROLLER_DATA_PORT, RoboCupGameControlData - import socket - - # Setup UDP client - client = socket.socket( - socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) # UDP - client.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # SO_REUSEADDR instead of SO_REUSEPORT to work while TCM is running # noqa: E501 - client.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) - client.bind(('', GAMECONTROLLER_DATA_PORT)) - - # Receive data - data = client.recv(1024) - - # Parse it - parsed = RoboCupGameControlData.parse(data) - - # Accessing data - print('First team player4 penalty: ', - parsed.teams[0].players[3].penalty) - print('state: ', parsed.state) -""" - - -from construct import Array, Byte, Const, Int16sl, Int16ul, Struct - -GAMECONTROLLER_DATA_PORT = 3838 - -GAMECONTROLLER_STRUCT_HEADER = b'RGme' -GAMECONTROLLER_STRUCT_VERSION = 15 - -MAX_NUM_PLAYERS = 20 - -# SPL -TEAM_BLUE = 0 # blue, cyan -TEAM_RED = 1 # red, magenta, pink -TEAM_YELLOW = 2 # yellow -TEAM_BLACK = 3 # black, dark gray -TEAM_WHITE = 4 # white -TEAM_GREEN = 5 # green -TEAM_ORANGE = 6 # orange -TEAM_PURPLE = 7 # purple, violet -TEAM_BROWN = 8 # brown -TEAM_GRAY = 9 # lighter gray - -COMPETITION_PHASE_ROUNDROBIN = 0 -COMPETITION_PHASE_PLAYOFF = 1 - -COMPETITION_TYPE_NORMAL = 0 -COMPETITION_TYPE_DYNAMIC_BALL_HANDLING = 1 - -GAME_PHASE_NORMAL = 0 -GAME_PHASE_PENALTYSHOOT = 1 -GAME_PHASE_OVERTIME = 2 -GAME_PHASE_TIMEOUT = 3 - -STATE_INITIAL = 0 -STATE_READY = 1 -STATE_SET = 2 -STATE_PLAYING = 3 -STATE_FINISHED = 4 - -SET_PLAY_NONE = 0 -SET_PLAY_GOAL_KICK = 1 -SET_PLAY_PUSHING_FREE_KICK = 2 -SET_PLAY_CORNER_KICK = 3 -SET_PLAY_KICK_IN = 4 -SET_PLAY_PENALTY_KICK = 5 - -PENALTY_NONE = 0 -# SPL -PENALTY_SPL_ILLEGAL_BALL_CONTACT = 1 # ball holding / playing with hands -PENALTY_SPL_PLAYER_PUSHING = 2 -PENALTY_SPL_ILLEGAL_MOTION_IN_SET = 3 # heard whistle too early? -PENALTY_SPL_INACTIVE_PLAYER = 4 # fallen, inactive -PENALTY_SPL_ILLEGAL_POSITION = 5 -PENALTY_SPL_LEAVING_THE_FIELD = 6 -PENALTY_SPL_REQUEST_FOR_PICKUP = 7 -PENALTY_SPL_LOCAL_GAME_STUCK = 8 -PENALTY_SPL_ILLEGAL_POSITION_IN_SET = 9 -PENALTY_SPL_PLAYER_STANCE = 10 - -PENALTY_SUBSTITUTE = 14 -PENALTY_MANUAL = 15 - -RobotInfo = Struct( - 'penalty' / Byte, # penalty state of the player - 'secsTillUnpenalised' / Byte # estimate of time till unpenalised -) - -TeamInfo = Struct( - 'teamNumber' / Byte, # unique team number - 'fieldPlayerColour' / Byte, # colour of the field players - 'goalkeeperColour' / Byte, # colour of the goalkeeper - 'goalkeeper' / Byte, # player number of the goalkeeper (1-MAX_NUM_PLAYERS) - 'score' / Byte, # team's score - 'penaltyShot' / Byte, # penalty shot counter - 'singleShots' / Int16ul, # bits represent penalty shot success # noqa: E501 - 'messageBudget' / Int16ul, # number of team messages the team is allowed to send for the remainder of the game # noqa: E501 - 'players' / Array(MAX_NUM_PLAYERS, RobotInfo) # the team's players -) - -RoboCupGameControlData = Struct( - 'header' / Const(GAMECONTROLLER_STRUCT_HEADER), # header to identify the structure # noqa: E501 - 'version' / Const(GAMECONTROLLER_STRUCT_VERSION, Byte), # version of the data structure # noqa: E501 - 'packetNumber' / Byte, # number incremented with each packet sent (with wraparound) # noqa: E501 - 'playersPerTeam' / Byte, # the number of players on a team - 'competitionPhase' / Byte, # phase of the competition (COMPETITION_PHASE_ROUNDROBIN, COMPETITION_PHASE_PLAYOFF) # noqa: E501 - 'competitionType' / Byte, # type of the competition (COMPETITION_TYPE_NORMAL, COMPETITION_TYPE_DYNAMIC_BALL_HANDLING) # noqa: E501 - 'gamePhase' / Byte, # phase of the game (GAME_PHASE_NORMAL, GAME_PHASE_PENALTYSHOOT, etc) # noqa: E501 - 'state' / Byte, # state of the game (STATE_READY, STATE_PLAYING, etc) # noqa: E501 - 'setPlay' / Byte, # active set play (SET_PLAY_NONE, SET_PLAY_GOAL_KICK, etc) # noqa: E501 - 'firstHalf' / Byte, # 1 = game in first half, 0 otherwise - 'kickingTeam' / Byte, # the team number of the next team to kick off, free kick etc - 'secsRemaining' / Int16sl, # estimate of number of seconds remaining in the half - 'secondaryTime' / Int16sl, # number of seconds shown as secondary time (remaining ready, until free ball, etc) # noqa: E501 - 'teams' / Array(2, TeamInfo) -) diff --git a/gc_spl/gc_spl/rcgcrd_4/conversion.py b/gc_spl/gc_spl/rcgcrd_4/conversion.py deleted file mode 100644 index a0172e1..0000000 --- a/gc_spl/gc_spl/rcgcrd_4/conversion.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from construct import Container - -from gc_spl.rcgcrd_4.robocup_game_control_return_data import \ - RoboCupGameControlReturnData -from gc_spl_interfaces.msg import RCGCRD4 - - -def rcgcrd_msg_to_data(msg: RCGCRD4) -> bytes: - """Convert RCGCRD ROS msg to binary data.""" - container = Container( - playerNum=msg.player_num, - teamNum=msg.team_num, - fallen=msg.fallen, - pose=msg.pose, - ballAge=msg.ball_age, - ball=msg.ball - ) - data = RoboCupGameControlReturnData.build(container) - return data diff --git a/gc_spl/gc_spl/rcgcrd_4/robocup_game_control_return_data.py b/gc_spl/gc_spl/rcgcrd_4/robocup_game_control_return_data.py deleted file mode 100644 index 4033d9f..0000000 --- a/gc_spl/gc_spl/rcgcrd_4/robocup_game_control_return_data.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from construct import Array, Byte, Const, Default, Float32l, Struct - -GAMECONTROLLER_RETURN_PORT = 3939 - -GAMECONTROLLER_RETURN_STRUCT_HEADER = b'RGrt' -GAMECONTROLLER_RETURN_STRUCT_VERSION = 4 - -RoboCupGameControlReturnData = Struct( - 'header' / Const(GAMECONTROLLER_RETURN_STRUCT_HEADER), # "RGrt" - 'version' / Const(GAMECONTROLLER_RETURN_STRUCT_VERSION, Byte), # has to be set to GAMECONTROLLER_RETURN_STRUCT_VERSION # noqa: E501 - 'playerNum' / Default(Byte, 0), # player number starts with 1 - 'teamNum' / Default(Byte, 0), # team number - 'fallen' / Default(Byte, 255), # 1 means that the robot is fallen, 0 means that the robot can play # noqa: E501 - # position and orientation of robot - # coordinates in millimeters - # 0,0 is in center of field - # +ve x-axis points towards the goal we are attempting to score on - # +ve y-axis is 90 degrees counter clockwise from the +ve x-axis - # angle in radians, 0 along the +x axis, increasing counter clockwise - 'pose' / Default(Array(3, Float32l), [0, 0, 0]), # x,y,theta - # ball information - # seconds since this robot last saw the ball. -1.f if we haven't seen it - 'ballAge' / Default(Float32l, -1), - # position of ball relative to the robot - # coordinates in millimeters - # 0,0 is in center of the robot - # +ve x-axis points forward from the robot - # +ve y-axis is 90 degrees counter clockwise from the +ve x-axis - 'ball' / Default(Array(2, Float32l), [0, 0]) -) diff --git a/gc_spl/package.xml b/gc_spl/package.xml deleted file mode 100644 index 8586f6b..0000000 --- a/gc_spl/package.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - gc_spl - 4.0.1 - GameController-Robot communication in RoboCup SPL - ijnek - Apache License 2.0 - - gc_spl_interfaces - python3-construct - rclpy - - ament_copyright - ament_flake8 - ament_pep257 - python3-pytest - - - ament_python - - Please use game_controller_spl. gc_spl is deprecated as of J-turtle, and will be removed in K-turtle. - - - diff --git a/gc_spl/resource/gc_spl b/gc_spl/resource/gc_spl deleted file mode 100644 index e69de29..0000000 diff --git a/gc_spl/setup.cfg b/gc_spl/setup.cfg deleted file mode 100644 index 9d1b8c2..0000000 --- a/gc_spl/setup.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[develop] -script_dir=$base/lib/gc_spl -[install] -install_scripts=$base/lib/gc_spl diff --git a/gc_spl/setup.py b/gc_spl/setup.py deleted file mode 100644 index a3a5239..0000000 --- a/gc_spl/setup.py +++ /dev/null @@ -1,26 +0,0 @@ -from setuptools import find_packages, setup - -package_name = 'gc_spl' - -setup( - name=package_name, - version='4.0.1', - packages=find_packages(exclude=['test']), - data_files=[ - ('share/ament_index/resource_index/packages', - ['resource/' + package_name]), - ('share/' + package_name, ['package.xml']), - ], - install_requires=['setuptools'], - zip_safe=True, - maintainer='ijnek', - maintainer_email='kenjibrameld@gmail.com', - description='GameController-Robot communication in RoboCup SPL', - license='Apache License 2.0', - tests_require=['pytest'], - entry_points={ - 'console_scripts': [ - 'gc_spl = gc_spl.gc_spl:main', - ], - }, -) diff --git a/gc_spl/test/conversion/test_conversion_rcgcd_14.py b/gc_spl/test/conversion/test_conversion_rcgcd_14.py deleted file mode 100644 index 853e11b..0000000 --- a/gc_spl/test/conversion/test_conversion_rcgcd_14.py +++ /dev/null @@ -1,122 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from construct import Container - -from gc_spl.rcgcd_14.conversion import rcgcd_data_to_msg - -from gc_spl.rcgcd_14.robocup_game_control_data import ( - COMPETITION_PHASE_PLAYOFF, COMPETITION_TYPE_CHALLENGE_SHIELD, - GAME_PHASE_PENALTYSHOOT, PENALTY_MANUAL, PENALTY_NONE, PENALTY_SPL_PLAYER_PUSHING, - RoboCupGameControlData, SET_PLAY_GOAL_KICK, STATE_READY, TEAM_RED, TEAM_YELLOW) - - -def test_rcgcd_data_to_msg(): - """Test conversion of binary data to RCGCD msg.""" - data = RoboCupGameControlData.build( - Container( - packetNumber=1, - playersPerTeam=5, - competitionPhase=COMPETITION_PHASE_PLAYOFF, - competitionType=COMPETITION_TYPE_CHALLENGE_SHIELD, - gamePhase=GAME_PHASE_PENALTYSHOOT, - state=STATE_READY, - setPlay=SET_PLAY_GOAL_KICK, - firstHalf=1, - kickingTeam=1, - secsRemaining=10, - secondaryTime=2, - teams=[ - Container( - teamNumber=1, - teamColour=TEAM_RED, - score=1, - penaltyShot=2, - singleShots=3, - messageBudget=1000, - players=[ - Container(penalty=PENALTY_MANUAL, - secsTillUnpenalised=1), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_SPL_PLAYER_PUSHING, - secsTillUnpenalised=2) - ]), - Container( - teamNumber=2, - teamColour=TEAM_YELLOW, - score=4, - penaltyShot=5, - singleShots=6, - messageBudget=2000, - players=[ - Container(penalty=PENALTY_MANUAL, - secsTillUnpenalised=11), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_SPL_PLAYER_PUSHING, - secsTillUnpenalised=12) - ]) - ] - ) - ) - - msg = rcgcd_data_to_msg(data) - assert msg.packet_number == 1 - assert msg.players_per_team == 5 - assert msg.competition_phase == COMPETITION_PHASE_PLAYOFF - assert msg.competition_type == COMPETITION_TYPE_CHALLENGE_SHIELD - assert msg.game_phase == GAME_PHASE_PENALTYSHOOT - assert msg.state == STATE_READY - assert msg.set_play == SET_PLAY_GOAL_KICK - assert msg.first_half == 1 - assert msg.kicking_team == 1 - assert msg.secs_remaining == 10 - assert msg.secondary_time == 2 - assert msg.teams[0].team_number == 1 - assert msg.teams[0].team_colour == TEAM_RED - assert msg.teams[0].score == 1 - assert msg.teams[0].penalty_shot == 2 - assert msg.teams[0].single_shots == 3 - assert msg.teams[0].message_budget == 1000 - assert msg.teams[0].players[0].penalty == PENALTY_MANUAL - assert msg.teams[0].players[0].secs_till_unpenalised == 1 - assert msg.teams[0].players[6].penalty == PENALTY_SPL_PLAYER_PUSHING - assert msg.teams[0].players[6].secs_till_unpenalised == 2 - assert msg.teams[1].team_number == 2 - assert msg.teams[1].team_colour == TEAM_YELLOW - assert msg.teams[1].score == 4 - assert msg.teams[1].penalty_shot == 5 - assert msg.teams[1].single_shots == 6 - assert msg.teams[1].message_budget == 2000 - assert msg.teams[1].players[0].penalty == PENALTY_MANUAL - assert msg.teams[1].players[0].secs_till_unpenalised == 11 - assert msg.teams[1].players[6].penalty == PENALTY_SPL_PLAYER_PUSHING - assert msg.teams[1].players[6].secs_till_unpenalised == 12 diff --git a/gc_spl/test/conversion/test_conversion_rcgcd_15.py b/gc_spl/test/conversion/test_conversion_rcgcd_15.py deleted file mode 100644 index 3d8b3e0..0000000 --- a/gc_spl/test/conversion/test_conversion_rcgcd_15.py +++ /dev/null @@ -1,182 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from construct import Container - -from gc_spl.rcgcd_15.conversion import rcgcd_data_to_msg - -from gc_spl.rcgcd_15.robocup_game_control_data import ( - COMPETITION_PHASE_PLAYOFF, COMPETITION_TYPE_DYNAMIC_BALL_HANDLING, - GAME_PHASE_PENALTYSHOOT, PENALTY_MANUAL, PENALTY_NONE, PENALTY_SPL_PLAYER_PUSHING, - RoboCupGameControlData, SET_PLAY_GOAL_KICK, STATE_READY, TEAM_RED, TEAM_YELLOW) - - -def test_rcgcd_data_to_msg(): - """Test conversion of binary data to RCGCD msg.""" - data = RoboCupGameControlData.build( - Container( - packetNumber=1, - playersPerTeam=5, - competitionPhase=COMPETITION_PHASE_PLAYOFF, - competitionType=COMPETITION_TYPE_DYNAMIC_BALL_HANDLING, - gamePhase=GAME_PHASE_PENALTYSHOOT, - state=STATE_READY, - setPlay=SET_PLAY_GOAL_KICK, - firstHalf=1, - kickingTeam=1, - secsRemaining=10, - secondaryTime=2, - teams=[ - Container( - teamNumber=1, - fieldPlayerColour=TEAM_RED, - goalkeeperColour=TEAM_RED, - goalkeeper=1, - score=1, - penaltyShot=2, - singleShots=3, - messageBudget=1000, - players=[ - Container(penalty=PENALTY_MANUAL, - secsTillUnpenalised=1), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_SPL_PLAYER_PUSHING, - secsTillUnpenalised=2), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - ]), - Container( - teamNumber=2, - fieldPlayerColour=TEAM_YELLOW, - goalkeeperColour=TEAM_YELLOW, - goalkeeper=1, - score=4, - penaltyShot=5, - singleShots=6, - messageBudget=2000, - players=[ - Container(penalty=PENALTY_MANUAL, - secsTillUnpenalised=11), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_SPL_PLAYER_PUSHING, - secsTillUnpenalised=12), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - ]) - ] - ) - ) - - msg = rcgcd_data_to_msg(data) - assert msg.packet_number == 1 - assert msg.players_per_team == 5 - assert msg.competition_phase == COMPETITION_PHASE_PLAYOFF - assert msg.competition_type == COMPETITION_TYPE_DYNAMIC_BALL_HANDLING - assert msg.game_phase == GAME_PHASE_PENALTYSHOOT - assert msg.state == STATE_READY - assert msg.set_play == SET_PLAY_GOAL_KICK - assert msg.first_half == 1 - assert msg.kicking_team == 1 - assert msg.secs_remaining == 10 - assert msg.secondary_time == 2 - assert msg.teams[0].team_number == 1 - assert msg.teams[0].field_player_colour == TEAM_RED - assert msg.teams[0].goalkeeper_colour == TEAM_RED - assert msg.teams[0].goalkeeper == 1 - assert msg.teams[0].score == 1 - assert msg.teams[0].penalty_shot == 2 - assert msg.teams[0].single_shots == 3 - assert msg.teams[0].message_budget == 1000 - assert msg.teams[0].players[0].penalty == PENALTY_MANUAL - assert msg.teams[0].players[0].secs_till_unpenalised == 1 - assert msg.teams[0].players[6].penalty == PENALTY_SPL_PLAYER_PUSHING - assert msg.teams[0].players[6].secs_till_unpenalised == 2 - assert msg.teams[1].team_number == 2 - assert msg.teams[1].field_player_colour == TEAM_YELLOW - assert msg.teams[1].goalkeeper_colour == TEAM_YELLOW - assert msg.teams[1].goalkeeper == 1 - assert msg.teams[1].score == 4 - assert msg.teams[1].penalty_shot == 5 - assert msg.teams[1].single_shots == 6 - assert msg.teams[1].message_budget == 2000 - assert msg.teams[1].players[0].penalty == PENALTY_MANUAL - assert msg.teams[1].players[0].secs_till_unpenalised == 11 - assert msg.teams[1].players[6].penalty == PENALTY_SPL_PLAYER_PUSHING - assert msg.teams[1].players[6].secs_till_unpenalised == 12 diff --git a/gc_spl/test/conversion/test_conversion_rcgcrd_4.py b/gc_spl/test/conversion/test_conversion_rcgcrd_4.py deleted file mode 100644 index d5a38be..0000000 --- a/gc_spl/test/conversion/test_conversion_rcgcrd_4.py +++ /dev/null @@ -1,37 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from gc_spl.rcgcrd_4.conversion import rcgcrd_msg_to_data -from gc_spl.rcgcrd_4.robocup_game_control_return_data import RoboCupGameControlReturnData -from gc_spl_interfaces.msg import RCGCRD4 as RCGCRD - - -def test_rcgcrd_msg_to_data(): - """Test conversion of RCGCRD msg to binary data.""" - msg = RCGCRD() - msg.player_num = 1 - msg.team_num = 2 - msg.fallen = 1 - msg.pose = [1.0, 2.0, 3.0] - msg.ball_age = 20.0 - msg.ball = [10.0, 20.0] - data = rcgcrd_msg_to_data(msg) - - parsed = RoboCupGameControlReturnData.parse(data) - assert parsed.playerNum == 1 - assert parsed.teamNum == 2 - assert parsed.fallen == 1 - assert parsed.pose == [1.0, 2.0, 3.0] - assert parsed.ballAge == 20.0 - assert parsed.ball == [10.0, 20.0] diff --git a/gc_spl/test/test_copyright.py b/gc_spl/test/test_copyright.py deleted file mode 100644 index cc8ff03..0000000 --- a/gc_spl/test/test_copyright.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2015 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ament_copyright.main import main -import pytest - - -@pytest.mark.copyright -@pytest.mark.linter -def test_copyright(): - rc = main(argv=['.', 'test']) - assert rc == 0, 'Found errors' diff --git a/gc_spl/test/test_flake8.py b/gc_spl/test/test_flake8.py deleted file mode 100644 index 27ee107..0000000 --- a/gc_spl/test/test_flake8.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2017 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ament_flake8.main import main_with_errors -import pytest - - -@pytest.mark.flake8 -@pytest.mark.linter -def test_flake8(): - rc, errors = main_with_errors(argv=[]) - assert rc == 0, \ - 'Found %d code style errors / warnings:\n' % len(errors) + \ - '\n'.join(errors) diff --git a/gc_spl/test/test_gc_spl.py b/gc_spl/test/test_gc_spl.py deleted file mode 100644 index 705dccb..0000000 --- a/gc_spl/test/test_gc_spl.py +++ /dev/null @@ -1,190 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import socket -import time - -from construct import Container - -from gc_spl.gc_spl import GCSPL -from gc_spl.rcgcd_15.robocup_game_control_data import RoboCupGameControlData -from gc_spl_interfaces.msg import RCGCD15 as RCGCD -from gc_spl_interfaces.msg import RCGCRD4 as RCGCRD - -import rclpy -from rclpy.parameter import Parameter - -RCGCD_VERSION = 15 -RCGCRD_VERSION = 4 - - -class TestGCSPL: - """Tests against GCSPL.""" - - received = None - - msg = RoboCupGameControlData.build( - Container( - packetNumber=0, - playersPerTeam=0, - competitionPhase=0, - competitionType=0, - gamePhase=0, - state=0, - setPlay=0, - firstHalf=0, - kickingTeam=0, - secsRemaining=0, - secondaryTime=0, - teams=[ - Container( - teamNumber=0, - fieldPlayerColour=0, - goalkeeperColour=0, - goalkeeper=0, - score=0, - penaltyShot=0, - singleShots=0, - messageBudget=0, - players=[ - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0) - ] - ), - Container( - teamNumber=0, - fieldPlayerColour=0, - goalkeeperColour=0, - goalkeeper=0, - score=0, - penaltyShot=0, - singleShots=0, - messageBudget=0, - players=[ - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0) - ] - ) - ] - ) - ) - - def _callback_msg(self, msg): - self.received = msg - - def test_receiving(self): - """ - Test GCSPL node receives from gamecontroller and publishes onto ros topic. - - This test mimics the gamecontroller sending a packet on UDP port 3838, and checks if the - GCSPL receives it, converts it to a RCGCD message, and publishes it on the 'gc/data' topic. - """ - # Setup nodes - rclpy.init() - gc_spl_node = GCSPL(parameter_overrides=[ # noqa: F841 - Parameter('rcgcd_version', value=RCGCD_VERSION), - Parameter('rcgcrd_version', value=RCGCRD_VERSION)]) - test_node = rclpy.node.Node('test') - subscription = test_node.create_subscription( # noqa: F841 - RCGCD, 'gc/data', self._callback_msg, 10) - - # UDP Server - adapted from https://github.com/ninedraft/python-udp/blob/master/server.py - with socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) as server: - server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - server.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) - server.sendto(self.msg, ('', 3838)) - - # Wait for RCGCD to receive packet over UDP, and publish a ROS msg - time.sleep(0.1) - - # Check if message has been received - rclpy.spin_once(test_node, timeout_sec=0) - assert self.received is not None - - # Shutdown - rclpy.shutdown() - - def test_sending(self): - # Setup nodes - rclpy.init() - gc_spl_node = GCSPL(parameter_overrides=[ - Parameter('rcgcd_version', value=RCGCD_VERSION), - Parameter('rcgcrd_version', value=RCGCRD_VERSION)]) - test_node = rclpy.node.Node('test') - publisher = test_node.create_publisher(RCGCRD, 'gc/return_data', 10) - - # UDP Server - adapted from https://github.com/ninedraft/python-udp/blob/master/server.py - server = socket.socket( - socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) - server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - server.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) - server.bind((socket.gethostbyname(socket.gethostname()), 3939)) - server.settimeout(0.1) - - # Send first message so client knows GC's address. - server.sendto(self.msg, ('', 3838)) - - # Publish RCGCRD to gc_spl_node - publisher.publish(RCGCRD()) - - # Wait before spinning for the msg arrive in gc_spl_node's subscription - time.sleep(0.01) - - # Spin gc_spl_node to process incoming message and send out UDP message - rclpy.spin_once(gc_spl_node, timeout_sec=0) - - # Check if packet has arrived - try: - _ = server.recv(1024) - except TimeoutError: - assert False - - # Shutdown - rclpy.shutdown() diff --git a/gc_spl/test/test_pep257.py b/gc_spl/test/test_pep257.py deleted file mode 100644 index b234a38..0000000 --- a/gc_spl/test/test_pep257.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2015 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ament_pep257.main import main -import pytest - - -@pytest.mark.linter -@pytest.mark.pep257 -def test_pep257(): - rc = main(argv=['.', 'test']) - assert rc == 0, 'Found code style errors / warnings' diff --git a/gc_spl_2022/CHANGELOG.rst b/gc_spl_2022/CHANGELOG.rst deleted file mode 100644 index 7a27667..0000000 --- a/gc_spl_2022/CHANGELOG.rst +++ /dev/null @@ -1,16 +0,0 @@ -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Changelog for package gc_spl_2022 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -4.0.1 (2024-04-14) ------------------- - -4.0.0 (2024-01-20) ------------------- -* Deprecate package(`#81 `_) -* Contributors: Kenji Brameld - -3.0.0 (2022-06-15) ------------------- -* Initial commit -* Contributors: Kenji Brameld diff --git a/gc_spl_2022/gc_spl_2022/__init__.py b/gc_spl_2022/gc_spl_2022/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/gc_spl_2022/gc_spl_2022/gc_spl.py b/gc_spl_2022/gc_spl_2022/gc_spl.py deleted file mode 100644 index ad85543..0000000 --- a/gc_spl_2022/gc_spl_2022/gc_spl.py +++ /dev/null @@ -1,108 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import socket -from threading import Thread - -from rcgcd_spl_14.msg import RCGCD - -from rcgcd_spl_14_conversion.conversion import rcgcd_data_to_msg -from rcgcd_spl_14_conversion.robocup_game_control_data import GAMECONTROLLER_DATA_PORT - -from rcgcrd_spl_4.msg import RCGCRD - -from rcgcrd_spl_4_conversion.conversion import rcgcrd_msg_to_data -from rcgcrd_spl_4_conversion.robocup_game_control_return_data import GAMECONTROLLER_RETURN_PORT - - -import rclpy -from rclpy.node import Node - - -class GCSPL(Node): - """Node that runs on the robot to communicate with SPL GameController.""" - - _loop_thread = None - _client = None - _publisher = None - _host = None - - def __init__(self, node_name='gc_spl', **kwargs): - super().__init__(node_name, **kwargs) - - # Declare parameters - self.declare_parameter('return_port', 3939) - - # Read and log parameters - return_port = self.get_parameter('return_port').value - self.get_logger().debug('return_port: "%s"' % return_port) - - # Setup publisher - self._publisher = self.create_publisher(RCGCD, 'gc/data', 10) - - # Setup subscriber - self._subscriber = self.create_subscription( - RCGCRD, 'gc/return_data', self._rcgcrd_callback, 10) - - # UDP Client - adapted from https://github.com/ninedraft/python-udp/blob/master/client.py - self._client = socket.socket( - socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) # UDP - # This has to be SO_REUSEADDR instead of SO_REUSEPORT to work with TCM - self._client.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - self._client.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) - self._client.bind(('', GAMECONTROLLER_DATA_PORT)) - # Set timeout so _loop can constantly check for rclpy.ok() - self._client.settimeout(0.1) - - # Start thread to continuously poll - self._loop_thread = Thread(target=self._loop) - self._loop_thread.start() - - def _loop(self): - while rclpy.ok(): - try: - data, (self._host, _) = self._client.recvfrom(1024) - self.get_logger().debug('received: "%s"' % data) - - # Convert data to ROS msg - msg = rcgcd_data_to_msg(data) - - # Publish it - self._publisher.publish(msg) - except TimeoutError: - pass - - def _rcgcrd_callback(self, msg): - - if self._host is None: - self.get_logger().debug( - 'Not returning RoboCupGameControlReturnData, as GameController' - ' host address is not known yet.') - return - - data = rcgcrd_msg_to_data(msg) - - # Return data directly to the GameController's address and return port - self._client.sendto(data, (self._host, GAMECONTROLLER_RETURN_PORT)) - - -def main(args=None): - rclpy.init(args=args) - gc_spl = GCSPL() - rclpy.spin(gc_spl) - rclpy.shutdown() - - -if __name__ == '__main__': - main() diff --git a/gc_spl_2022/package.xml b/gc_spl_2022/package.xml deleted file mode 100644 index 3ec91a7..0000000 --- a/gc_spl_2022/package.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - gc_spl_2022 - 4.0.1 - GameController-Robot communication in RoboCup SPL at RoboCup2022 - ijnek - Apache License 2.0 - - ament_copyright - ament_flake8 - ament_pep257 - python3-pytest - - rclpy - rcgcd_spl_14 - rcgcd_spl_14_conversion - rcgcrd_spl_4 - rcgcrd_spl_4_conversion - - - ament_python - - Please use game_controller_spl. gc_spl_2022 is deprecated as of J-turtle, and will be removed in K-turtle. - - - diff --git a/gc_spl_2022/resource/gc_spl_2022 b/gc_spl_2022/resource/gc_spl_2022 deleted file mode 100644 index e69de29..0000000 diff --git a/gc_spl_2022/setup.cfg b/gc_spl_2022/setup.cfg deleted file mode 100644 index c325112..0000000 --- a/gc_spl_2022/setup.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[develop] -script_dir=$base/lib/gc_spl_2022 -[install] -install_scripts=$base/lib/gc_spl_2022 diff --git a/gc_spl_2022/setup.py b/gc_spl_2022/setup.py deleted file mode 100644 index 33b1bb9..0000000 --- a/gc_spl_2022/setup.py +++ /dev/null @@ -1,26 +0,0 @@ -from setuptools import setup - -package_name = 'gc_spl_2022' - -setup( - name=package_name, - version='4.0.1', - packages=[package_name], - data_files=[ - ('share/ament_index/resource_index/packages', - ['resource/' + package_name]), - ('share/' + package_name, ['package.xml']), - ], - install_requires=['setuptools'], - zip_safe=True, - maintainer='ijnek', - maintainer_email='kenjibrameld@gmail.com', - description='GameController-Robot communication in RoboCup SPL at RoboCup2022', - license='Apache License 2.0', - tests_require=['pytest'], - entry_points={ - 'console_scripts': [ - 'gc_spl = gc_spl_2022.gc_spl:main', - ], - }, -) diff --git a/gc_spl_2022/test/test_copyright.py b/gc_spl_2022/test/test_copyright.py deleted file mode 100644 index cc8ff03..0000000 --- a/gc_spl_2022/test/test_copyright.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2015 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ament_copyright.main import main -import pytest - - -@pytest.mark.copyright -@pytest.mark.linter -def test_copyright(): - rc = main(argv=['.', 'test']) - assert rc == 0, 'Found errors' diff --git a/gc_spl_2022/test/test_flake8.py b/gc_spl_2022/test/test_flake8.py deleted file mode 100644 index 27ee107..0000000 --- a/gc_spl_2022/test/test_flake8.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2017 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ament_flake8.main import main_with_errors -import pytest - - -@pytest.mark.flake8 -@pytest.mark.linter -def test_flake8(): - rc, errors = main_with_errors(argv=[]) - assert rc == 0, \ - 'Found %d code style errors / warnings:\n' % len(errors) + \ - '\n'.join(errors) diff --git a/gc_spl_2022/test/test_gc_spl.py b/gc_spl_2022/test/test_gc_spl.py deleted file mode 100644 index 6fae884..0000000 --- a/gc_spl_2022/test/test_gc_spl.py +++ /dev/null @@ -1,155 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -import socket -import time - -from construct import Container - -from gc_spl_2022.gc_spl import GCSPL - -from rcgcd_spl_14.msg import RCGCD - -from rcgcd_spl_14_conversion.robocup_game_control_data import RoboCupGameControlData - -from rcgcrd_spl_4.msg import RCGCRD - -import rclpy - - -class TestGCSPL: - """Tests against GCSPL.""" - - received = None - - msg = RoboCupGameControlData.build( - Container( - packetNumber=0, - playersPerTeam=0, - competitionPhase=0, - competitionType=0, - gamePhase=0, - state=0, - setPlay=0, - firstHalf=0, - kickingTeam=0, - secsRemaining=0, - secondaryTime=0, - teams=[ - Container( - teamNumber=0, - teamColour=0, - score=0, - penaltyShot=0, - singleShots=0, - messageBudget=0, - players=[ - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0) - ] - ), - Container( - teamNumber=0, - teamColour=0, - score=0, - penaltyShot=0, - singleShots=0, - messageBudget=0, - players=[ - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0), - Container(penalty=0, secsTillUnpenalised=0) - ] - ) - ] - ) - ) - - def _callback_msg(self, msg): - self.received = msg - - def test_receiving(self): - """ - Test GCSPL node receives from gamecontroller and publishes onto ros topic. - - This test mimics the gamecontroller sending a packet on UDP port 3838, and checks if the - GCSPL receives it, converts it to a RCGCD message, and publishes it on the 'gc/data' topic. - """ - # Setup nodes - rclpy.init() - gc_spl_node = GCSPL() # noqa: F841 - test_node = rclpy.node.Node('test') - subscription = test_node.create_subscription( # noqa: F841 - RCGCD, 'gc/data', self._callback_msg, 10) - - # UDP Server - adapted from https://github.com/ninedraft/python-udp/blob/master/server.py - with socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) as server: - server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - server.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) - server.sendto(self.msg, ('', 3838)) - - # Wait for RCGCD to receive packet over UDP, and publish a ROS msg - time.sleep(0.1) - - # Check if message has been received - rclpy.spin_once(test_node, timeout_sec=0) - assert self.received is not None - - # Shutdown - rclpy.shutdown() - - def test_sending(self): - # Setup nodes - rclpy.init() - gc_spl_node = GCSPL() # noqa: F841 - test_node = rclpy.node.Node('test') - publisher = test_node.create_publisher(RCGCRD, 'gc/return_data', 10) - - # UDP Server - adapted from https://github.com/ninedraft/python-udp/blob/master/server.py - server = socket.socket( - socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) - server.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) - server.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) - server.bind((socket.gethostbyname(socket.gethostname()), 3939)) - server.settimeout(0.1) - - # Send first message so client knows GC's address. - server.sendto(self.msg, ('', 3838)) - - # Publish RCGCRD to gc_spl_node - publisher.publish(RCGCRD()) - - # Wait before spinning for the msg arrive in gc_spl_node's subscription - time.sleep(0.01) - - # Spin gc_spl_node to process incoming message and send out UDP message - rclpy.spin_once(gc_spl_node, timeout_sec=0) - - # Check if packet has arrived - try: - _ = server.recv(1024) - except TimeoutError: - assert False - - # Shutdown - rclpy.shutdown() diff --git a/gc_spl_2022/test/test_pep257.py b/gc_spl_2022/test/test_pep257.py deleted file mode 100644 index b234a38..0000000 --- a/gc_spl_2022/test/test_pep257.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2015 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ament_pep257.main import main -import pytest - - -@pytest.mark.linter -@pytest.mark.pep257 -def test_pep257(): - rc = main(argv=['.', 'test']) - assert rc == 0, 'Found code style errors / warnings' diff --git a/gc_spl_interfaces/CHANGELOG.rst b/gc_spl_interfaces/CHANGELOG.rst deleted file mode 100644 index 3bd8a37..0000000 --- a/gc_spl_interfaces/CHANGELOG.rst +++ /dev/null @@ -1,15 +0,0 @@ -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Changelog for package gc_spl_interfaces -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -4.0.1 (2024-04-14) ------------------- - -4.0.0 (2024-01-20) ------------------- -* Deprecate package (`#79 `_) -* Add package (`#58 `_) -* Contributors: Florian Vahl, Kenji Brameld - -3.0.0 (2022-06-15) ------------------- diff --git a/gc_spl_interfaces/CMakeLists.txt b/gc_spl_interfaces/CMakeLists.txt deleted file mode 100644 index 26b1e5a..0000000 --- a/gc_spl_interfaces/CMakeLists.txt +++ /dev/null @@ -1,37 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(gc_spl_interfaces) - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rosidl_default_generators REQUIRED) - -# generate interfaces -rosidl_generate_interfaces(${PROJECT_NAME} - # RCGCD 14 - msg/RCGCD14.msg - msg/RobotInfo14.msg - msg/TeamInfo14.msg - - # RCGCD 15 - msg/RCGCD15.msg - msg/RobotInfo15.msg - msg/TeamInfo15.msg - - # RCGCRD 4 - msg/RCGCRD4.msg -) - -# export dependencies -ament_export_dependencies(rosidl_default_runtime) - -# test -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() diff --git a/gc_spl_interfaces/msg/RCGCD14.msg b/gc_spl_interfaces/msg/RCGCD14.msg deleted file mode 100644 index 553fc77..0000000 --- a/gc_spl_interfaces/msg/RCGCD14.msg +++ /dev/null @@ -1,38 +0,0 @@ -uint8 COMPETITION_PHASE_ROUNDROBIN=0 -uint8 COMPETITION_PHASE_PLAYOFF=1 - -uint8 COMPETITION_TYPE_NORMAL=0 -uint8 COMPETITION_TYPE_CHALLENGE_SHIELD=1 -uint8 COMPETITION_TYPE_7V7=2 -uint8 COMPETITION_TYPE_DYNAMIC_BALL_HANDLING=3 - -uint8 GAME_PHASE_NORMAL=0 -uint8 GAME_PHASE_PENALTYSHOOT=1 -uint8 GAME_PHASE_OVERTIME=2 -uint8 GAME_PHASE_TIMEOUT=3 - -uint8 STATE_INITIAL=0 -uint8 STATE_READY=1 -uint8 STATE_SET=2 -uint8 STATE_PLAYING=3 -uint8 STATE_FINISHED=4 - -uint8 SET_PLAY_NONE=0 -uint8 SET_PLAY_GOAL_KICK=1 -uint8 SET_PLAY_PUSHING_FREE_KICK=2 -uint8 SET_PLAY_CORNER_KICK=3 -uint8 SET_PLAY_KICK_IN=4 -uint8 SET_PLAY_PENALTY_KICK=5 - -uint8 packet_number -uint8 players_per_team -uint8 competition_phase -uint8 competition_type -uint8 game_phase -uint8 state -uint8 set_play -uint8 first_half -uint8 kicking_team -int16 secs_remaining -int16 secondary_time -gc_spl_interfaces/TeamInfo14[2] teams diff --git a/gc_spl_interfaces/msg/RCGCD15.msg b/gc_spl_interfaces/msg/RCGCD15.msg deleted file mode 100644 index 4873f3e..0000000 --- a/gc_spl_interfaces/msg/RCGCD15.msg +++ /dev/null @@ -1,36 +0,0 @@ -uint8 COMPETITION_PHASE_ROUNDROBIN=0 -uint8 COMPETITION_PHASE_PLAYOFF=1 - -uint8 COMPETITION_TYPE_NORMAL=0 -uint8 COMPETITION_TYPE_DYNAMIC_BALL_HANDLING=1 - -uint8 GAME_PHASE_NORMAL=0 -uint8 GAME_PHASE_PENALTYSHOOT=1 -uint8 GAME_PHASE_OVERTIME=2 -uint8 GAME_PHASE_TIMEOUT=3 - -uint8 STATE_INITIAL=0 -uint8 STATE_READY=1 -uint8 STATE_SET=2 -uint8 STATE_PLAYING=3 -uint8 STATE_FINISHED=4 - -uint8 SET_PLAY_NONE=0 -uint8 SET_PLAY_GOAL_KICK=1 -uint8 SET_PLAY_PUSHING_FREE_KICK=2 -uint8 SET_PLAY_CORNER_KICK=3 -uint8 SET_PLAY_KICK_IN=4 -uint8 SET_PLAY_PENALTY_KICK=5 - -uint8 packet_number -uint8 players_per_team -uint8 competition_phase -uint8 competition_type -uint8 game_phase -uint8 state -uint8 set_play -uint8 first_half -uint8 kicking_team -int16 secs_remaining -int16 secondary_time -gc_spl_interfaces/TeamInfo15[2] teams diff --git a/gc_spl_interfaces/msg/RCGCRD4.msg b/gc_spl_interfaces/msg/RCGCRD4.msg deleted file mode 100644 index f0845df..0000000 --- a/gc_spl_interfaces/msg/RCGCRD4.msg +++ /dev/null @@ -1,6 +0,0 @@ -uint8 player_num 0 -uint8 team_num 0 -uint8 fallen 0 -float32[3] pose [0.0, 0.0, 0.0] -float32 ball_age -1.0 -float32[2] ball [0.0, 0.0] diff --git a/gc_spl_interfaces/msg/RobotInfo14.msg b/gc_spl_interfaces/msg/RobotInfo14.msg deleted file mode 100644 index 89410ef..0000000 --- a/gc_spl_interfaces/msg/RobotInfo14.msg +++ /dev/null @@ -1,16 +0,0 @@ -uint8 PENALTY_NONE=0 -uint8 PENALTY_SPL_ILLEGAL_BALL_CONTACT=1 -uint8 PENALTY_SPL_PLAYER_PUSHING=2 -uint8 PENALTY_SPL_ILLEGAL_MOTION_IN_SET=3 -uint8 PENALTY_SPL_INACTIVE_PLAYER=4 -uint8 PENALTY_SPL_ILLEGAL_POSITION=5 -uint8 PENALTY_SPL_LEAVING_THE_FIELD=6 -uint8 PENALTY_SPL_REQUEST_FOR_PICKUP=7 -uint8 PENALTY_SPL_LOCAL_GAME_STUCK=8 -uint8 PENALTY_SPL_ILLEGAL_POSITION_IN_SET=9 - -uint8 PENALTY_SUBSTITUTE=14 -uint8 PENALTY_MANUAL=15 - -uint8 penalty -uint8 secs_till_unpenalised diff --git a/gc_spl_interfaces/msg/RobotInfo15.msg b/gc_spl_interfaces/msg/RobotInfo15.msg deleted file mode 100644 index 2c5baaf..0000000 --- a/gc_spl_interfaces/msg/RobotInfo15.msg +++ /dev/null @@ -1,17 +0,0 @@ -uint8 PENALTY_NONE=0 -uint8 PENALTY_SPL_ILLEGAL_BALL_CONTACT=1 -uint8 PENALTY_SPL_PLAYER_PUSHING=2 -uint8 PENALTY_SPL_ILLEGAL_MOTION_IN_SET=3 -uint8 PENALTY_SPL_INACTIVE_PLAYER=4 -uint8 PENALTY_SPL_ILLEGAL_POSITION=5 -uint8 PENALTY_SPL_LEAVING_THE_FIELD=6 -uint8 PENALTY_SPL_REQUEST_FOR_PICKUP=7 -uint8 PENALTY_SPL_LOCAL_GAME_STUCK=8 -uint8 PENALTY_SPL_ILLEGAL_POSITION_IN_SET=9 -uint8 PENALTY_SPL_PLAYER_STANCE=10 - -uint8 PENALTY_SUBSTITUTE=14 -uint8 PENALTY_MANUAL=15 - -uint8 penalty -uint8 secs_till_unpenalised diff --git a/gc_spl_interfaces/msg/TeamInfo14.msg b/gc_spl_interfaces/msg/TeamInfo14.msg deleted file mode 100644 index c279547..0000000 --- a/gc_spl_interfaces/msg/TeamInfo14.msg +++ /dev/null @@ -1,18 +0,0 @@ -uint8 TEAM_BLUE=0 # blue, cyan -uint8 TEAM_RED=1 # red, magenta, pink -uint8 TEAM_YELLOW=2 # yellow -uint8 TEAM_BLACK=3 # black, dark gray -uint8 TEAM_WHITE=4 # white -uint8 TEAM_GREEN=5 # green -uint8 TEAM_ORANGE=6 # orange -uint8 TEAM_PURPLE=7 # purple, violet -uint8 TEAM_BROWN=8 # brown -uint8 TEAM_GRAY=9 # lighter gray - -uint8 team_number -uint8 team_colour -uint8 score -uint8 penalty_shot -uint16 single_shots -uint16 message_budget -gc_spl_interfaces/RobotInfo14[7] players diff --git a/gc_spl_interfaces/msg/TeamInfo15.msg b/gc_spl_interfaces/msg/TeamInfo15.msg deleted file mode 100644 index 03171e2..0000000 --- a/gc_spl_interfaces/msg/TeamInfo15.msg +++ /dev/null @@ -1,21 +0,0 @@ -uint8 TEAM_BLUE=0 # blue, cyan -uint8 TEAM_RED=1 # red, magenta, pink -uint8 TEAM_YELLOW=2 # yellow -uint8 TEAM_BLACK=3 # black, dark gray -uint8 TEAM_WHITE=4 # white -uint8 TEAM_GREEN=5 # green -uint8 TEAM_ORANGE=6 # orange -uint8 TEAM_PURPLE=7 # purple, violet -uint8 TEAM_BROWN=8 # brown -uint8 TEAM_GRAY=9 # lighter gray - -uint8 team_number -uint8 field_player_colour -uint8 goalkeeper_colour -uint8 goalkeeper -uint8 team_colour -uint8 score -uint8 penalty_shot -uint16 single_shots -uint16 message_budget -gc_spl_interfaces/RobotInfo15[20] players diff --git a/gc_spl_interfaces/package.xml b/gc_spl_interfaces/package.xml deleted file mode 100644 index c6ed1a8..0000000 --- a/gc_spl_interfaces/package.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - gc_spl_interfaces - 4.0.1 - RoboCup SPL GameController Data ROS msg - ijnek - Apache License 2.0 - - ament_cmake - - ament_lint_auto - ament_lint_common - - rosidl_default_generators - rosidl_default_runtime - rosidl_interface_packages - - - ament_cmake - - Please use game_controller_spl_interfaces. gc_spl_interfaces is deprecated as of J-turtle, and will be removed in K-turtle. - - - diff --git a/rcgcd_spl_14/CHANGELOG.rst b/rcgcd_spl_14/CHANGELOG.rst deleted file mode 100644 index 5d94167..0000000 --- a/rcgcd_spl_14/CHANGELOG.rst +++ /dev/null @@ -1,16 +0,0 @@ -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Changelog for package rcgcd_spl_14 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -4.0.1 (2024-04-14) ------------------- - -4.0.0 (2024-01-20) ------------------- -* Deprecate package(`#81 `_) -* Contributors: Kenji Brameld - -3.0.0 (2022-06-15) ------------------- -* Initial commit -* Contributors: Kenji Brameld diff --git a/rcgcd_spl_14/CMakeLists.txt b/rcgcd_spl_14/CMakeLists.txt deleted file mode 100644 index 2a0335d..0000000 --- a/rcgcd_spl_14/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(rcgcd_spl_14) - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rosidl_default_generators REQUIRED) - -# generate interfaces -rosidl_generate_interfaces(${PROJECT_NAME} - "msg/RCGCD.msg" - "msg/RobotInfo.msg" - "msg/TeamInfo.msg" -) - -# export dependencies -ament_export_dependencies(rosidl_default_runtime) - -# test -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() diff --git a/rcgcd_spl_14/msg/RCGCD.msg b/rcgcd_spl_14/msg/RCGCD.msg deleted file mode 100644 index 34a55d1..0000000 --- a/rcgcd_spl_14/msg/RCGCD.msg +++ /dev/null @@ -1,38 +0,0 @@ -uint8 COMPETITION_PHASE_ROUNDROBIN=0 -uint8 COMPETITION_PHASE_PLAYOFF=1 - -uint8 COMPETITION_TYPE_NORMAL=0 -uint8 COMPETITION_TYPE_CHALLENGE_SHIELD=1 -uint8 COMPETITION_TYPE_7V7=2 -uint8 COMPETITION_TYPE_DYNAMIC_BALL_HANDLING=3 - -uint8 GAME_PHASE_NORMAL=0 -uint8 GAME_PHASE_PENALTYSHOOT=1 -uint8 GAME_PHASE_OVERTIME=2 -uint8 GAME_PHASE_TIMEOUT=3 - -uint8 STATE_INITIAL=0 -uint8 STATE_READY=1 -uint8 STATE_SET=2 -uint8 STATE_PLAYING=3 -uint8 STATE_FINISHED=4 - -uint8 SET_PLAY_NONE=0 -uint8 SET_PLAY_GOAL_KICK=1 -uint8 SET_PLAY_PUSHING_FREE_KICK=2 -uint8 SET_PLAY_CORNER_KICK=3 -uint8 SET_PLAY_KICK_IN=4 -uint8 SET_PLAY_PENALTY_KICK=5 - -uint8 packet_number -uint8 players_per_team -uint8 competition_phase -uint8 competition_type -uint8 game_phase -uint8 state -uint8 set_play -uint8 first_half -uint8 kicking_team -int16 secs_remaining -int16 secondary_time -rcgcd_spl_14/TeamInfo[2] teams diff --git a/rcgcd_spl_14/msg/RobotInfo.msg b/rcgcd_spl_14/msg/RobotInfo.msg deleted file mode 100644 index 89410ef..0000000 --- a/rcgcd_spl_14/msg/RobotInfo.msg +++ /dev/null @@ -1,16 +0,0 @@ -uint8 PENALTY_NONE=0 -uint8 PENALTY_SPL_ILLEGAL_BALL_CONTACT=1 -uint8 PENALTY_SPL_PLAYER_PUSHING=2 -uint8 PENALTY_SPL_ILLEGAL_MOTION_IN_SET=3 -uint8 PENALTY_SPL_INACTIVE_PLAYER=4 -uint8 PENALTY_SPL_ILLEGAL_POSITION=5 -uint8 PENALTY_SPL_LEAVING_THE_FIELD=6 -uint8 PENALTY_SPL_REQUEST_FOR_PICKUP=7 -uint8 PENALTY_SPL_LOCAL_GAME_STUCK=8 -uint8 PENALTY_SPL_ILLEGAL_POSITION_IN_SET=9 - -uint8 PENALTY_SUBSTITUTE=14 -uint8 PENALTY_MANUAL=15 - -uint8 penalty -uint8 secs_till_unpenalised diff --git a/rcgcd_spl_14/msg/TeamInfo.msg b/rcgcd_spl_14/msg/TeamInfo.msg deleted file mode 100644 index 4b79f46..0000000 --- a/rcgcd_spl_14/msg/TeamInfo.msg +++ /dev/null @@ -1,18 +0,0 @@ -uint8 TEAM_BLUE=0 # blue, cyan -uint8 TEAM_RED=1 # red, magenta, pink -uint8 TEAM_YELLOW=2 # yellow -uint8 TEAM_BLACK=3 # black, dark gray -uint8 TEAM_WHITE=4 # white -uint8 TEAM_GREEN=5 # green -uint8 TEAM_ORANGE=6 # orange -uint8 TEAM_PURPLE=7 # purple, violet -uint8 TEAM_BROWN=8 # brown -uint8 TEAM_GRAY=9 # lighter gray - -uint8 team_number -uint8 team_colour -uint8 score -uint8 penalty_shot -uint16 single_shots -uint16 message_budget -rcgcd_spl_14/RobotInfo[7] players diff --git a/rcgcd_spl_14/package.xml b/rcgcd_spl_14/package.xml deleted file mode 100644 index de6c55b..0000000 --- a/rcgcd_spl_14/package.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - rcgcd_spl_14 - 4.0.1 - RoboCup SPL GameController Data V14 ROS msg - ijnek - Apache License 2.0 - - ament_cmake - - ament_lint_auto - ament_lint_common - - rosidl_default_generators - rosidl_default_runtime - rosidl_interface_packages - - - ament_cmake - - Please use game_controller_spl_interfaces. rcgcd_spl_14 is deprecated as of J-turtle, and will be removed in K-turtle. - - - diff --git a/rcgcd_spl_14_conversion/CHANGELOG.rst b/rcgcd_spl_14_conversion/CHANGELOG.rst deleted file mode 100644 index 645489a..0000000 --- a/rcgcd_spl_14_conversion/CHANGELOG.rst +++ /dev/null @@ -1,16 +0,0 @@ -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Changelog for package rcgcd_spl_14_conversion -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -4.0.1 (2024-04-14) ------------------- - -4.0.0 (2024-01-20) ------------------- -* Deprecate package(`#81 `_) -* Contributors: Kenji Brameld - -3.0.0 (2022-06-15) ------------------- -* Initial commit -* Contributors: Kenji Brameld diff --git a/rcgcd_spl_14_conversion/package.xml b/rcgcd_spl_14_conversion/package.xml deleted file mode 100644 index 4db4300..0000000 --- a/rcgcd_spl_14_conversion/package.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - rcgcd_spl_14_conversion - 4.0.1 - Converts RoboCup SPL GameController Data V14 between ROS msg and UDP raw bytes - ijnek - Apache License 2.0 - - python3-construct - rcgcd_spl_14 - - ament_copyright - ament_flake8 - ament_pep257 - python3-pytest - - - ament_python - - This package is deprecated as of J-turtle, and will be removed in K-turtle. - - - diff --git a/rcgcd_spl_14_conversion/rcgcd_spl_14_conversion/__init__.py b/rcgcd_spl_14_conversion/rcgcd_spl_14_conversion/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rcgcd_spl_14_conversion/rcgcd_spl_14_conversion/conversion.py b/rcgcd_spl_14_conversion/rcgcd_spl_14_conversion/conversion.py deleted file mode 100644 index 5c2a49f..0000000 --- a/rcgcd_spl_14_conversion/rcgcd_spl_14_conversion/conversion.py +++ /dev/null @@ -1,47 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rcgcd_spl_14.msg import RCGCD - -from rcgcd_spl_14_conversion.robocup_game_control_data import ( - MAX_NUM_PLAYERS, RoboCupGameControlData) - - -def rcgcd_data_to_msg(data: bytes) -> RCGCD: - """Convert binary data to RCGCRD ROS msg.""" - parsed = RoboCupGameControlData.parse(data) - msg = RCGCD() - msg.packet_number = parsed.packetNumber - msg.players_per_team = parsed.playersPerTeam - msg.competition_phase = parsed.competitionPhase - msg.competition_type = parsed.competitionType - msg.game_phase = parsed.gamePhase - msg.state = parsed.state - msg.set_play = parsed.setPlay - msg.first_half = parsed.firstHalf - msg.kicking_team = parsed.kickingTeam - msg.secs_remaining = parsed.secsRemaining - msg.secondary_time = parsed.secondaryTime - for t in range(2): - msg.teams[t].team_number = parsed.teams[t].teamNumber - msg.teams[t].team_colour = parsed.teams[t].teamColour - msg.teams[t].score = parsed.teams[t].score - msg.teams[t].penalty_shot = parsed.teams[t].penaltyShot - msg.teams[t].single_shots = parsed.teams[t].singleShots - msg.teams[t].message_budget = parsed.teams[t].messageBudget - for p in range(MAX_NUM_PLAYERS): - msg.teams[t].players[p].penalty = parsed.teams[t].players[p].penalty - msg.teams[t].players[p].secs_till_unpenalised = \ - parsed.teams[t].players[p].secsTillUnpenalised - return msg diff --git a/rcgcd_spl_14_conversion/rcgcd_spl_14_conversion/robocup_game_control_data.py b/rcgcd_spl_14_conversion/rcgcd_spl_14_conversion/robocup_game_control_data.py deleted file mode 100644 index 3d9ebda..0000000 --- a/rcgcd_spl_14_conversion/rcgcd_spl_14_conversion/robocup_game_control_data.py +++ /dev/null @@ -1,135 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -""" -Library to convert binary udp data to a meaningful python object. - -Example of listening to the GameController, and accessing the data using this library:: - - from robocup_game_control_data import GAMECONTROLLER_DATA_PORT, RoboCupGameControlData - import socket - - # Setup UDP client - client = socket.socket( - socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP) # UDP - client.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) # SO_REUSEADDR instead of SO_REUSEPORT to work while TCM is running # noqa: E501 - client.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) - client.bind(('', GAMECONTROLLER_DATA_PORT)) - - # Receive data - data = client.recv(1024) - - # Parse it - parsed = RoboCupGameControlData.parse(data) - - # Accessing data - print('First team player4 penalty: ', - parsed.teams[0].players[3].penalty) - print('state: ', parsed.state) -""" - - -from construct import Array, Byte, Const, Int16sl, Int16ul, Struct - -GAMECONTROLLER_DATA_PORT = 3838 - -GAMECONTROLLER_STRUCT_HEADER = b'RGme' -GAMECONTROLLER_STRUCT_VERSION = 14 - -MAX_NUM_PLAYERS = 7 - -# SPL -TEAM_BLUE = 0 # blue, cyan -TEAM_RED = 1 # red, magenta, pink -TEAM_YELLOW = 2 # yellow -TEAM_BLACK = 3 # black, dark gray -TEAM_WHITE = 4 # white -TEAM_GREEN = 5 # green -TEAM_ORANGE = 6 # orange -TEAM_PURPLE = 7 # purple, violet -TEAM_BROWN = 8 # brown -TEAM_GRAY = 9 # lighter gray - -COMPETITION_PHASE_ROUNDROBIN = 0 -COMPETITION_PHASE_PLAYOFF = 1 - -COMPETITION_TYPE_NORMAL = 0 -COMPETITION_TYPE_CHALLENGE_SHIELD = 1 -COMPETITION_TYPE_7V7 = 2 -COMPETITION_TYPE_DYNAMIC_BALL_HANDLING = 3 - -GAME_PHASE_NORMAL = 0 -GAME_PHASE_PENALTYSHOOT = 1 -GAME_PHASE_OVERTIME = 2 -GAME_PHASE_TIMEOUT = 3 - -STATE_INITIAL = 0 -STATE_READY = 1 -STATE_SET = 2 -STATE_PLAYING = 3 -STATE_FINISHED = 4 - -SET_PLAY_NONE = 0 -SET_PLAY_GOAL_KICK = 1 -SET_PLAY_PUSHING_FREE_KICK = 2 -SET_PLAY_CORNER_KICK = 3 -SET_PLAY_KICK_IN = 4 -SET_PLAY_PENALTY_KICK = 5 - -PENALTY_NONE = 0 -# SPL -PENALTY_SPL_ILLEGAL_BALL_CONTACT = 1 # ball holding / playing with hands -PENALTY_SPL_PLAYER_PUSHING = 2 -PENALTY_SPL_ILLEGAL_MOTION_IN_SET = 3 # heard whistle too early? -PENALTY_SPL_INACTIVE_PLAYER = 4 # fallen, inactive -PENALTY_SPL_ILLEGAL_POSITION = 5 -PENALTY_SPL_LEAVING_THE_FIELD = 6 -PENALTY_SPL_REQUEST_FOR_PICKUP = 7 -PENALTY_SPL_LOCAL_GAME_STUCK = 8 -PENALTY_SPL_ILLEGAL_POSITION_IN_SET = 9 - -PENALTY_SUBSTITUTE = 14 -PENALTY_MANUAL = 15 - -RobotInfo = Struct( - 'penalty' / Byte, # penalty state of the player - 'secsTillUnpenalised' / Byte # estimate of time till unpenalised -) - -TeamInfo = Struct( - 'teamNumber' / Byte, # unique team number - 'teamColour' / Byte, # colour of the team - 'score' / Byte, # team's score - 'penaltyShot' / Byte, # penalty shot counter - 'singleShots' / Int16ul, # bits represent penalty shot success # noqa: E501 - 'messageBudget' / Int16ul, # number of team messages the team is allowed to send for the remainder of the game # noqa: E501 - 'players' / Array(MAX_NUM_PLAYERS, RobotInfo) # the team's players -) - -RoboCupGameControlData = Struct( - 'header' / Const(GAMECONTROLLER_STRUCT_HEADER), # header to identify the structure # noqa: E501 - 'version' / Const(GAMECONTROLLER_STRUCT_VERSION, Byte), # version of the data structure # noqa: E501 - 'packetNumber' / Byte, # number incremented with each packet sent (with wraparound) # noqa: E501 - 'playersPerTeam' / Byte, # the number of players on a team - 'competitionPhase' / Byte, # phase of the competition (COMPETITION_PHASE_ROUNDROBIN, COMPETITION_PHASE_PLAYOFF) # noqa: E501 - 'competitionType' / Byte, # type of the competition (COMPETITION_TYPE_NORMAL, COMPETITION_TYPE_CHALLENGE_SHIELD, etc) # noqa: E501 - 'gamePhase' / Byte, # phase of the game (GAME_PHASE_NORMAL, GAME_PHASE_PENALTYSHOOT, etc) # noqa: E501 - 'state' / Byte, # state of the game (STATE_READY, STATE_PLAYING, etc) # noqa: E501 - 'setPlay' / Byte, # active set play (SET_PLAY_NONE, SET_PLAY_GOAL_KICK, etc) # noqa: E501 - 'firstHalf' / Byte, # 1 = game in first half, 0 otherwise - 'kickingTeam' / Byte, # the team number of the next team to kick off, free kick etc - 'secsRemaining' / Int16sl, # estimate of number of seconds remaining in the half - 'secondaryTime' / Int16sl, # number of seconds shown as secondary time (remaining ready, until free ball, etc) # noqa: E501 - 'teams' / Array(2, TeamInfo) -) diff --git a/rcgcd_spl_14_conversion/resource/rcgcd_spl_14_conversion b/rcgcd_spl_14_conversion/resource/rcgcd_spl_14_conversion deleted file mode 100644 index e69de29..0000000 diff --git a/rcgcd_spl_14_conversion/setup.cfg b/rcgcd_spl_14_conversion/setup.cfg deleted file mode 100644 index 86e0240..0000000 --- a/rcgcd_spl_14_conversion/setup.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[develop] -script_dir=$base/lib/rcgcd_spl_14_conversion -[install] -install_scripts=$base/lib/rcgcd_spl_14_conversion diff --git a/rcgcd_spl_14_conversion/setup.py b/rcgcd_spl_14_conversion/setup.py deleted file mode 100644 index 44628c0..0000000 --- a/rcgcd_spl_14_conversion/setup.py +++ /dev/null @@ -1,25 +0,0 @@ -from setuptools import setup - -package_name = 'rcgcd_spl_14_conversion' - -setup( - name=package_name, - version='4.0.1', - packages=[package_name], - data_files=[ - ('share/ament_index/resource_index/packages', - ['resource/' + package_name]), - ('share/' + package_name, ['package.xml']), - ], - install_requires=['setuptools'], - zip_safe=True, - maintainer='ijnek', - maintainer_email='kenjibrameld@gmail.com', - description='Converts RoboCup SPL GameController Data V14 between ROS msg and UDP raw bytes', - license='Apache License 2.0', - tests_require=['pytest'], - entry_points={ - 'console_scripts': [ - ], - }, -) diff --git a/rcgcd_spl_14_conversion/test/test_conversion.py b/rcgcd_spl_14_conversion/test/test_conversion.py deleted file mode 100644 index 9008430..0000000 --- a/rcgcd_spl_14_conversion/test/test_conversion.py +++ /dev/null @@ -1,122 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from construct import Container - -from rcgcd_spl_14_conversion.conversion import rcgcd_data_to_msg - -from rcgcd_spl_14_conversion.robocup_game_control_data import ( - COMPETITION_PHASE_PLAYOFF, COMPETITION_TYPE_CHALLENGE_SHIELD, - GAME_PHASE_PENALTYSHOOT, PENALTY_MANUAL, PENALTY_NONE, PENALTY_SPL_PLAYER_PUSHING, - RoboCupGameControlData, SET_PLAY_GOAL_KICK, STATE_READY, TEAM_RED, TEAM_YELLOW) - - -def test_rcgcd_data_to_msg(): - """Test conversion of binary data to RCGCD msg.""" - data = RoboCupGameControlData.build( - Container( - packetNumber=1, - playersPerTeam=5, - competitionPhase=COMPETITION_PHASE_PLAYOFF, - competitionType=COMPETITION_TYPE_CHALLENGE_SHIELD, - gamePhase=GAME_PHASE_PENALTYSHOOT, - state=STATE_READY, - setPlay=SET_PLAY_GOAL_KICK, - firstHalf=1, - kickingTeam=1, - secsRemaining=10, - secondaryTime=2, - teams=[ - Container( - teamNumber=1, - teamColour=TEAM_RED, - score=1, - penaltyShot=2, - singleShots=3, - messageBudget=1000, - players=[ - Container(penalty=PENALTY_MANUAL, - secsTillUnpenalised=1), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_SPL_PLAYER_PUSHING, - secsTillUnpenalised=2) - ]), - Container( - teamNumber=2, - teamColour=TEAM_YELLOW, - score=4, - penaltyShot=5, - singleShots=6, - messageBudget=2000, - players=[ - Container(penalty=PENALTY_MANUAL, - secsTillUnpenalised=11), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_NONE, - secsTillUnpenalised=0), - Container(penalty=PENALTY_SPL_PLAYER_PUSHING, - secsTillUnpenalised=12) - ]) - ] - ) - ) - - msg = rcgcd_data_to_msg(data) - assert msg.packet_number == 1 - assert msg.players_per_team == 5 - assert msg.competition_phase == COMPETITION_PHASE_PLAYOFF - assert msg.competition_type == COMPETITION_TYPE_CHALLENGE_SHIELD - assert msg.game_phase == GAME_PHASE_PENALTYSHOOT - assert msg.state == STATE_READY - assert msg.set_play == SET_PLAY_GOAL_KICK - assert msg.first_half == 1 - assert msg.kicking_team == 1 - assert msg.secs_remaining == 10 - assert msg.secondary_time == 2 - assert msg.teams[0].team_number == 1 - assert msg.teams[0].team_colour == TEAM_RED - assert msg.teams[0].score == 1 - assert msg.teams[0].penalty_shot == 2 - assert msg.teams[0].single_shots == 3 - assert msg.teams[0].message_budget == 1000 - assert msg.teams[0].players[0].penalty == PENALTY_MANUAL - assert msg.teams[0].players[0].secs_till_unpenalised == 1 - assert msg.teams[0].players[6].penalty == PENALTY_SPL_PLAYER_PUSHING - assert msg.teams[0].players[6].secs_till_unpenalised == 2 - assert msg.teams[1].team_number == 2 - assert msg.teams[1].team_colour == TEAM_YELLOW - assert msg.teams[1].score == 4 - assert msg.teams[1].penalty_shot == 5 - assert msg.teams[1].single_shots == 6 - assert msg.teams[1].message_budget == 2000 - assert msg.teams[1].players[0].penalty == PENALTY_MANUAL - assert msg.teams[1].players[0].secs_till_unpenalised == 11 - assert msg.teams[1].players[6].penalty == PENALTY_SPL_PLAYER_PUSHING - assert msg.teams[1].players[6].secs_till_unpenalised == 12 diff --git a/rcgcd_spl_14_conversion/test/test_copyright.py b/rcgcd_spl_14_conversion/test/test_copyright.py deleted file mode 100644 index cc8ff03..0000000 --- a/rcgcd_spl_14_conversion/test/test_copyright.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2015 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ament_copyright.main import main -import pytest - - -@pytest.mark.copyright -@pytest.mark.linter -def test_copyright(): - rc = main(argv=['.', 'test']) - assert rc == 0, 'Found errors' diff --git a/rcgcd_spl_14_conversion/test/test_flake8.py b/rcgcd_spl_14_conversion/test/test_flake8.py deleted file mode 100644 index 27ee107..0000000 --- a/rcgcd_spl_14_conversion/test/test_flake8.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2017 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ament_flake8.main import main_with_errors -import pytest - - -@pytest.mark.flake8 -@pytest.mark.linter -def test_flake8(): - rc, errors = main_with_errors(argv=[]) - assert rc == 0, \ - 'Found %d code style errors / warnings:\n' % len(errors) + \ - '\n'.join(errors) diff --git a/rcgcd_spl_14_conversion/test/test_pep257.py b/rcgcd_spl_14_conversion/test/test_pep257.py deleted file mode 100644 index b234a38..0000000 --- a/rcgcd_spl_14_conversion/test/test_pep257.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2015 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ament_pep257.main import main -import pytest - - -@pytest.mark.linter -@pytest.mark.pep257 -def test_pep257(): - rc = main(argv=['.', 'test']) - assert rc == 0, 'Found code style errors / warnings' diff --git a/rcgcrd_spl_4/CHANGELOG.rst b/rcgcrd_spl_4/CHANGELOG.rst deleted file mode 100644 index 2604e27..0000000 --- a/rcgcrd_spl_4/CHANGELOG.rst +++ /dev/null @@ -1,17 +0,0 @@ -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Changelog for package rcgcrd_spl_4 -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -4.0.1 (2024-04-14) ------------------- - -4.0.0 (2024-01-20) ------------------- -* Deprecate package(`#81 `_) -* change default fallen to 0 -* Contributors: Kenji Brameld - -3.0.0 (2022-06-15) ------------------- -* Initial commit -* Contributors: Kenji Brameld diff --git a/rcgcrd_spl_4/CMakeLists.txt b/rcgcrd_spl_4/CMakeLists.txt deleted file mode 100644 index 25343c1..0000000 --- a/rcgcrd_spl_4/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(rcgcrd_spl_4) - -if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") - add_compile_options(-Wall -Wextra -Wpedantic) -endif() - -# find dependencies -find_package(ament_cmake REQUIRED) -find_package(rosidl_default_generators REQUIRED) - -# generate interfaces -rosidl_generate_interfaces(${PROJECT_NAME} - "msg/RCGCRD.msg" -) - -# export dependencies -ament_export_dependencies(rosidl_default_runtime) - -# test -if(BUILD_TESTING) - find_package(ament_lint_auto REQUIRED) - ament_lint_auto_find_test_dependencies() -endif() - -ament_package() diff --git a/rcgcrd_spl_4/msg/RCGCRD.msg b/rcgcrd_spl_4/msg/RCGCRD.msg deleted file mode 100644 index f0845df..0000000 --- a/rcgcrd_spl_4/msg/RCGCRD.msg +++ /dev/null @@ -1,6 +0,0 @@ -uint8 player_num 0 -uint8 team_num 0 -uint8 fallen 0 -float32[3] pose [0.0, 0.0, 0.0] -float32 ball_age -1.0 -float32[2] ball [0.0, 0.0] diff --git a/rcgcrd_spl_4/package.xml b/rcgcrd_spl_4/package.xml deleted file mode 100644 index 5e1f221..0000000 --- a/rcgcrd_spl_4/package.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - rcgcrd_spl_4 - 4.0.1 - RoboCup SPL GameController Return Data V4 ROS msg - ijnek - Apache License 2.0 - - ament_cmake - - ament_lint_auto - ament_lint_common - - rosidl_default_generators - rosidl_default_runtime - rosidl_interface_packages - - - ament_cmake - - Please use game_controller_spl_interfaces. rcgcrd_spl_4 is deprecated as of J-turtle, and will be removed in K-turtle. - - - diff --git a/rcgcrd_spl_4_conversion/CHANGELOG.rst b/rcgcrd_spl_4_conversion/CHANGELOG.rst deleted file mode 100644 index 2ecb3f1..0000000 --- a/rcgcrd_spl_4_conversion/CHANGELOG.rst +++ /dev/null @@ -1,16 +0,0 @@ -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -Changelog for package rcgcrd_spl_4_conversion -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - -4.0.1 (2024-04-14) ------------------- - -4.0.0 (2024-01-20) ------------------- -* Deprecate package(`#81 `_) -* Contributors: Kenji Brameld - -3.0.0 (2022-06-15) ------------------- -* Initial commit -* Contributors: Kenji Brameld diff --git a/rcgcrd_spl_4_conversion/package.xml b/rcgcrd_spl_4_conversion/package.xml deleted file mode 100644 index 8bf17b1..0000000 --- a/rcgcrd_spl_4_conversion/package.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - rcgcrd_spl_4_conversion - 4.0.1 - Converts RoboCup SPL GameController Return Data V4 between ROS msg and UDP raw bytes - ijnek - Apache License 2.0 - - python3-construct - rcgcrd_spl_4 - - ament_copyright - ament_flake8 - ament_pep257 - python3-pytest - - - ament_python - - This package is deprecated as of J-turtle, and will be removed in K-turtle. - - - diff --git a/rcgcrd_spl_4_conversion/rcgcrd_spl_4_conversion/__init__.py b/rcgcrd_spl_4_conversion/rcgcrd_spl_4_conversion/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/rcgcrd_spl_4_conversion/rcgcrd_spl_4_conversion/conversion.py b/rcgcrd_spl_4_conversion/rcgcrd_spl_4_conversion/conversion.py deleted file mode 100644 index dfaa5ad..0000000 --- a/rcgcrd_spl_4_conversion/rcgcrd_spl_4_conversion/conversion.py +++ /dev/null @@ -1,33 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from construct import Container - -from rcgcrd_spl_4.msg import RCGCRD - -from rcgcrd_spl_4_conversion.robocup_game_control_return_data import RoboCupGameControlReturnData - - -def rcgcrd_msg_to_data(msg: RCGCRD) -> bytes: - """Convert RCGCRD ROS msg to binary data.""" - container = Container( - playerNum=msg.player_num, - teamNum=msg.team_num, - fallen=msg.fallen, - pose=msg.pose, - ballAge=msg.ball_age, - ball=msg.ball - ) - data = RoboCupGameControlReturnData.build(container) - return data diff --git a/rcgcrd_spl_4_conversion/rcgcrd_spl_4_conversion/robocup_game_control_return_data.py b/rcgcrd_spl_4_conversion/rcgcrd_spl_4_conversion/robocup_game_control_return_data.py deleted file mode 100644 index 4033d9f..0000000 --- a/rcgcrd_spl_4_conversion/rcgcrd_spl_4_conversion/robocup_game_control_return_data.py +++ /dev/null @@ -1,44 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from construct import Array, Byte, Const, Default, Float32l, Struct - -GAMECONTROLLER_RETURN_PORT = 3939 - -GAMECONTROLLER_RETURN_STRUCT_HEADER = b'RGrt' -GAMECONTROLLER_RETURN_STRUCT_VERSION = 4 - -RoboCupGameControlReturnData = Struct( - 'header' / Const(GAMECONTROLLER_RETURN_STRUCT_HEADER), # "RGrt" - 'version' / Const(GAMECONTROLLER_RETURN_STRUCT_VERSION, Byte), # has to be set to GAMECONTROLLER_RETURN_STRUCT_VERSION # noqa: E501 - 'playerNum' / Default(Byte, 0), # player number starts with 1 - 'teamNum' / Default(Byte, 0), # team number - 'fallen' / Default(Byte, 255), # 1 means that the robot is fallen, 0 means that the robot can play # noqa: E501 - # position and orientation of robot - # coordinates in millimeters - # 0,0 is in center of field - # +ve x-axis points towards the goal we are attempting to score on - # +ve y-axis is 90 degrees counter clockwise from the +ve x-axis - # angle in radians, 0 along the +x axis, increasing counter clockwise - 'pose' / Default(Array(3, Float32l), [0, 0, 0]), # x,y,theta - # ball information - # seconds since this robot last saw the ball. -1.f if we haven't seen it - 'ballAge' / Default(Float32l, -1), - # position of ball relative to the robot - # coordinates in millimeters - # 0,0 is in center of the robot - # +ve x-axis points forward from the robot - # +ve y-axis is 90 degrees counter clockwise from the +ve x-axis - 'ball' / Default(Array(2, Float32l), [0, 0]) -) diff --git a/rcgcrd_spl_4_conversion/resource/rcgcrd_spl_4_conversion b/rcgcrd_spl_4_conversion/resource/rcgcrd_spl_4_conversion deleted file mode 100644 index e69de29..0000000 diff --git a/rcgcrd_spl_4_conversion/setup.cfg b/rcgcrd_spl_4_conversion/setup.cfg deleted file mode 100644 index 2020851..0000000 --- a/rcgcrd_spl_4_conversion/setup.cfg +++ /dev/null @@ -1,4 +0,0 @@ -[develop] -script_dir=$base/lib/rcgcrd_spl_4_conversion -[install] -install_scripts=$base/lib/rcgcrd_spl_4_conversion diff --git a/rcgcrd_spl_4_conversion/setup.py b/rcgcrd_spl_4_conversion/setup.py deleted file mode 100644 index a93b409..0000000 --- a/rcgcrd_spl_4_conversion/setup.py +++ /dev/null @@ -1,26 +0,0 @@ -from setuptools import setup - -package_name = 'rcgcrd_spl_4_conversion' - -setup( - name=package_name, - version='4.0.1', - packages=[package_name], - data_files=[ - ('share/ament_index/resource_index/packages', - ['resource/' + package_name]), - ('share/' + package_name, ['package.xml']), - ], - install_requires=['setuptools'], - zip_safe=True, - maintainer='ijnek', - maintainer_email='kenjibrameld@gmail.com', - description=('Converts RoboCup SPL GameController Return Data V4 between ROS msg and UDP raw ' - 'bytes'), - license='Apache License 2.0', - tests_require=['pytest'], - entry_points={ - 'console_scripts': [ - ], - }, -) diff --git a/rcgcrd_spl_4_conversion/test/test_conversion.py b/rcgcrd_spl_4_conversion/test/test_conversion.py deleted file mode 100644 index 32fe3d3..0000000 --- a/rcgcrd_spl_4_conversion/test/test_conversion.py +++ /dev/null @@ -1,38 +0,0 @@ -# Copyright 2022 Kenji Brameld -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from rcgcrd_spl_4.msg import RCGCRD - -from rcgcrd_spl_4_conversion.conversion import rcgcrd_msg_to_data -from rcgcrd_spl_4_conversion.robocup_game_control_return_data import RoboCupGameControlReturnData - - -def test_rcgcrd_msg_to_data(): - """Test conversion of RCGCRD msg to binary data.""" - msg = RCGCRD() - msg.player_num = 1 - msg.team_num = 2 - msg.fallen = 1 - msg.pose = [1.0, 2.0, 3.0] - msg.ball_age = 20.0 - msg.ball = [10.0, 20.0] - data = rcgcrd_msg_to_data(msg) - - parsed = RoboCupGameControlReturnData.parse(data) - assert parsed.playerNum == 1 - assert parsed.teamNum == 2 - assert parsed.fallen == 1 - assert parsed.pose == [1.0, 2.0, 3.0] - assert parsed.ballAge == 20.0 - assert parsed.ball == [10.0, 20.0] diff --git a/rcgcrd_spl_4_conversion/test/test_copyright.py b/rcgcrd_spl_4_conversion/test/test_copyright.py deleted file mode 100644 index cc8ff03..0000000 --- a/rcgcrd_spl_4_conversion/test/test_copyright.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2015 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ament_copyright.main import main -import pytest - - -@pytest.mark.copyright -@pytest.mark.linter -def test_copyright(): - rc = main(argv=['.', 'test']) - assert rc == 0, 'Found errors' diff --git a/rcgcrd_spl_4_conversion/test/test_flake8.py b/rcgcrd_spl_4_conversion/test/test_flake8.py deleted file mode 100644 index 27ee107..0000000 --- a/rcgcrd_spl_4_conversion/test/test_flake8.py +++ /dev/null @@ -1,25 +0,0 @@ -# Copyright 2017 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ament_flake8.main import main_with_errors -import pytest - - -@pytest.mark.flake8 -@pytest.mark.linter -def test_flake8(): - rc, errors = main_with_errors(argv=[]) - assert rc == 0, \ - 'Found %d code style errors / warnings:\n' % len(errors) + \ - '\n'.join(errors) diff --git a/rcgcrd_spl_4_conversion/test/test_pep257.py b/rcgcrd_spl_4_conversion/test/test_pep257.py deleted file mode 100644 index b234a38..0000000 --- a/rcgcrd_spl_4_conversion/test/test_pep257.py +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright 2015 Open Source Robotics Foundation, Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -from ament_pep257.main import main -import pytest - - -@pytest.mark.linter -@pytest.mark.pep257 -def test_pep257(): - rc = main(argv=['.', 'test']) - assert rc == 0, 'Found code style errors / warnings'