Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Commit

Permalink
imprement referee_wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
spiralray committed Dec 26, 2019
1 parent f6594c7 commit 9ad027b
Show file tree
Hide file tree
Showing 12 changed files with 575 additions and 0 deletions.
2 changes: 2 additions & 0 deletions consai2r2_msgs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ set(msg_files
"msg/VisionDetections.msg"
"msg/RobotInfo.msg"
"msg/BallInfo.msg"
"msg/DecodedReferee.msg"
"msg/ReplaceBall.msg"
"msg/RobotCommand.msg"
"msg/RobotCommands.msg"
)
Expand Down
40 changes: 40 additions & 0 deletions consai2r2_msgs/msg/DecodedReferee.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# game status for consai2_game

# ID : text
# 0 : HALT
# 1 : STOP
# 2 : ---
# 3 : FORCE_START
# 11 : OUR_KICKOFF_PREPARATION
# 12 : OUR_KICKOFF_START
# 13 : OUR_PENALTY_PREPARATION
# 14 : OUR_PENALTY_START
# 15 : OUR_DIRECT_FREE
# 16 : OUR_INDIRECT_FREE
# 17 : OUR_TIMEOUT
# 18 : OUR_GOAL
# 19 : OUR_BALL_PLACEMENT
# 20 : ---
# 21 : THEIR_KICKOFF_PREPARATION
# 22 : THEIR_KICKOFF_START
# 23 : THEIR_PENALTY_PREPARATION
# 24 : THEIR_PENALTY_START
# 25 : THEIR_DIRECT_FREE
# 26 : THEIR_INDIRECT_FREE
# 27 : THEIR_TIMEOUT
# 28 : THEIR_GOAL
# 29 : THEIR_BALL_PLACEMENT

uint8 referee_id
string referee_text

bool can_move_robot
float64 speed_limit_of_robot # meter/sec
bool can_kick_ball
bool can_enter_their_side
bool can_enter_center_circle
bool is_inplay
float64 keep_out_radius_from_ball # meter
float64 keep_out_distance_from_their_defense_area # meter

geometry_msgs/Point placement_position
8 changes: 8 additions & 0 deletions consai2r2_msgs/msg/ReplaceBall.msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# This msg file is copied from 'grSim_Replacement.proto'
#
float64 x
float64 y
float64 vx
float64 vy

bool is_enabled
Empty file.
392 changes: 392 additions & 0 deletions consai2r2_referee_wrapper/consai2r2_referee_wrapper/referee_wrapper.py

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions consai2r2_referee_wrapper/package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="3">
<name>consai2r2_referee_wrapper</name>
<version>0.0.0</version>
<description>Referee Wrapper</description>
<maintainer email="macakasit@gmail.com">akshota</maintainer>
<license>MIT</license>

<exec_depend>rclpy</exec_depend>
<exec_depend>consai2r2_msgs</exec_depend>
<exec_depend>consai2r2_receiver</exec_depend>
<exec_depend>consai2r2_description</exec_depend>

<!-- These test dependencies are optional
Their purpose is to make sure that the code passes the linters -->
<test_depend>ament_copyright</test_depend>
<test_depend>ament_flake8</test_depend>
<test_depend>ament_pep257</test_depend>
<test_depend>python3-pytest</test_depend>

<export>
<build_type>ament_python</build_type>
</export>
</package>
Empty file.
4 changes: 4 additions & 0 deletions consai2r2_referee_wrapper/setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[develop]
script-dir=$base/lib/consai2r2_referee_wrapper
[install]
install-scripts=$base/lib/consai2r2_referee_wrapper
35 changes: 35 additions & 0 deletions consai2r2_referee_wrapper/setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from setuptools import setup

package_name = 'consai2r2_referee_wrapper'

setup(
name=package_name,
version='0.0.0',
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,
author='akshota',
author_email='macakasit@gmail.com',
maintainer='akshota',
maintainer_email='macakasit@gmail.com',
keywords=['ROS'],
classifiers=[
'Intended Audience :: Developers',
'License :: OSI Approved :: MIT License',
'Programming Language :: Python',
'Topic :: Software Development',
],
description='Translate raw referee message to AI-friendly message',
license='MIT License',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'referee_wrapper = consai2r2_referee_wrapper.referee_wrapper:main',
],
},
)
23 changes: 23 additions & 0 deletions consai2r2_referee_wrapper/test/test_copyright.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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=['.'])
assert rc == 0, 'Found errors'
23 changes: 23 additions & 0 deletions consai2r2_referee_wrapper/test/test_flake8.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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
import pytest


@pytest.mark.flake8
@pytest.mark.linter
def test_flake8():
rc = main(argv=[])
assert rc == 0, 'Found errors'
23 changes: 23 additions & 0 deletions consai2r2_referee_wrapper/test/test_pep257.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# 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=['.'])
assert rc == 0, 'Found code style errors / warnings'

0 comments on commit 9ad027b

Please sign in to comment.