Skip to content

Commit

Permalink
Merge branch 'release/v0.5'
Browse files Browse the repository at this point in the history
  • Loading branch information
chshong committed Mar 30, 2018
2 parents b1ea461 + 971c17f commit 8c80849
Show file tree
Hide file tree
Showing 129 changed files with 1,838 additions and 1,019 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
worlds/*.wbproj
controllers/*/build
plugins/physics/*/build
*.cache
62 changes: 37 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,48 +1,60 @@
# test_world
# AI World Cup Simulation

The AI World Cup simulation environment for usage in local PCs. Participants of [AI World Cup](http://aiworldcup.org) can download the program to develop their own algorithm for AI Soccer, AI Commentator, or AI Reporter. After development, participants of [AI World Cup](http://aiworldcup.org) can upload their algorithm online and test against others' on server provided by us. The online simulation running on our server for test matches can be used through [AI World Cup Web Simulator page](http://aiworldcup.org/web-si). As the qualifying/main rounds will be run in a same environment with the web simulation, please make sure that the developed program works in the web simulator.

- There are two ways to download the AI World Cup simulation program.
- AI World Cup simulation program requires Webots Robot Simulator. Please refer to Webots official website's [installation procedure](https://www.cyberbotics.com/doc/guide/installation-procedure) to install Webots.
- Downloading ZIP file through 'Download ZIP' will not work. It does not download the submodules related to the program.
- To use git command, use '--recurse-submodules' option to clone submodules along with the main repository (git clone https://(address) --recurse-submodules).
- Follow below to download the program directly from the web browser.

**How to download the program**
**How to download the simulation program**

Method 1. Go to [releases](https://github.com/aiwc/test_world/releases) and download the latest version (test_world.v0.5.zip).

Method 2. Use following git command

1. Go to releases (https://github.com/aiwc/test_world/releases)
2. Download the latest version of 'test_world' (zip for windows, tar.gz for linux)
## Windows only. Carriage return will invalidate simulation files.
git config --global core.autocrlf false

**How to install and run the program**
## Both Linux and Windows
git clone https://github.com/aiwc/test_world.git --recurse-submodules

1. Go to Wiki page (https://github.com/aiwc/test_world/wiki)
2. Refer to Webots-related pages
**How to run the simulation program**

**Directory Description**
Please refer to the [Wiki pages](https://github.com/aiwc/test_world/wiki).

**controllers**: Contains programs for managing AI Soccer simulation system. **(Programs in this directory are managed by us and need not be modified)**
**Descriptions**

- soccer_robot: Program that changes robot wheel movements based on received data.
**controllers**: Contains programs for managing AI World Cup simulation system **(Programs in this directory are managed by us and must not be modified)**

- supervisor: Referee program that manages AI Soccer game.
- soccer_robot: Program that changes robot wheel movements based on received data

**examples**: Contains sample programs participants can refer to. **(Participants can implement AI Soccer program in similar way with the sample programs in this directory)**
- supervisor: Referee program that manages AI Soccer game

- common: Contains a basic interface for information handling and communication with the simulator.
**examples**: Contains sample programs participants can refer to **(Participants may implement AI programs referring to the sample programs provided in this directory)**

- extlibs: Contains external libraries used in sample programs.
- common: Contains a basic interface for information handling and communication with the simulation program

- (role-prefix)_data: Directories where participants' program may write some files into if needed.
- extlibs: Contains external libraries used in sample programs

- (role-prefix)_data: Directories where participants' program may write some files into if needed

- Remaining directories contain samples participants can refer to. The sample directory names follow format '(role-prefix)_(program-description)_(programming_language)'.

- (role-prefix): player (AI Soccer), commentator (AI Commentator), reporter (AI Reporter), general (Examples that may help participants from all three competitions).
- (program-description): Breif decsription of what example the program is.
- (programming_language): Programming language used to develop the example (C++ or Python).
- (role-prefix): AI Soccer (player), AI Commentator (commentator), AI Reporter (reporter), general (Examples that may help participants from all three competitions)
- (program-description): Brief description of what the program does
- (programming_language): Programming language used in the example. Currently, we have examples for C++ (cpp) and Python (py).

**extlibs**: Contains external libraries used in AI World Cup simulation **(Files in this directory are managed by us and must not be modified)**

**extlibs**: Contains external libraries used in AI Soccer simulator. **(Files in this directory are managed by us and must not be modified)**
**plugins**: Contains a physics plugin used for ball-robot collision detection **(Files in this directory are managed by us and must not be modified)**

**protos**: Contains AI Soccer object models (robot, ball, stadium, etc.) **(Files in this directory are managed by us and need not be modified)**
**protos**: Contains AI World Cup object models (robot, ball, stadium, etc.) **(Files in this directory are managed by us and must not be modified)**

**worlds**: Contains AI Soccer simulation world file **(Files in this directory can be run using Webots Robot Simulator)**
**reports**: If AI World Cup simulation is run with an AI Reporter, the report will be stored in this directory after the game. The created file's name will be (reporter team name specified in config.json).txt. **(Only related to AI Reporters)**

- aiwc_linux.wbt: Webots world file for linux
**worlds**: Contains AI World Cup simulation world files **(Files in this directory can be run using Webots Robot Simulator)**

- aiwc_windows.wbt: Webots world file for windows
- aiwc.wbt: Webots world file
- aiwc_simple.wbt: A simplified version of aiwc.wbt without visual decorations (stadium, grass field, etc.). This world can be run faster than aiwc.wbt without any differences in data observed by the participant's AI program.

**config.json**: Configuration file for setting player executables, setting game duration, and setting some rules on/off for effective training. Please refer to the [Wiki page](https://github.com/aiwc/test_world/wiki/How-to-use-AI-World-Cup-simulation-program) for parameter descriptions **(Participants should modify the player information in this file to tell the simulation which program to execute)**
28 changes: 28 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{
"rule": {
"game_time": 300,
"deadlock": true,
"goal_area_foul": true,
"penalty_area_foul": true
},
"team_a": {
"name": "teamA",
"executable": "examples/player_rulebased_py/player_rulebased.py",
"datapath": "examples/team_a_data"
},
"team_b": {
"name": "teamB",
"executable": "examples/player_rulebased_py/player_rulebased.py",
"datapath": "examples/team_b_data"
},
"commentator": {
"name": "commentator",
"executable": "",
"datapath": "../../examples/commentator_data"
},
"reporter": {
"name": "reporter",
"executable": "",
"datapath": "../../examples/reporter_data"
}
}
Binary file modified controllers/soccer_robot/soccer_robot
Binary file not shown.
5 changes: 1 addition & 4 deletions controllers/soccer_robot/soccer_robot.cpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// File: soccer_robot.cpp
// Date: Jan. 23, 2018
// Description: AI World Cup soccer robot controller
// Author(s): Inbae Jeong, Chansol Hong
// Current Developer: Chansol Hong ([email protected])
// Maintainer: Chansol Hong ([email protected])

#include <webots/Robot.hpp>
#include <webots/Motor.hpp>
Expand Down
Binary file modified controllers/soccer_robot/soccer_robot.exe
Binary file not shown.
Binary file added controllers/supervisor/.supervisor.exe.signature
Binary file not shown.
Binary file added controllers/supervisor/.supervisor.signature
Binary file not shown.
5 changes: 3 additions & 2 deletions controllers/supervisor/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ LFLAGS = -pthread

CFLAGS += -I ../../extlibs/bonefish/include \
-I ../../extlibs/msgpack-c/include \
-I ../../extlibs/autobahn-cpp/include
-I ../../extlibs/autobahn-cpp/include \
-I ../../extlibs/rapidjson/include

CXX_SOURCES += supervisor.cpp game.cpp image_buffer.cpp

Expand All @@ -26,7 +27,7 @@ ifneq ($(OSTYPE),windows)
# need >=boost-1.64. use bundled boost for systems that has lower version of boost
CFLAGS += -I ../../extlibs/boost-1.65.1/include
LFLAGS += -L ../../extlibs/boost-1.65.1/lib/$(OSTYPE)
BOOST_POSTFIX =
BOOST_POSTFIX =
else
# webots for windows contains boost
# winsock
Expand Down
50 changes: 22 additions & 28 deletions controllers/supervisor/constants.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
// File: constants.hpp
// Date: Jan. 23, 2018
// Description: AI World Cup header for constants
// Author(s): Inbae Jeong, Chansol Hong
// Current Developer: Chansol Hong ([email protected])
// Maintainer: Chansol Hong ([email protected])

#ifndef H_CONSTANTS_HPP
#define H_CONSTANTS_HPP
Expand All @@ -24,6 +21,7 @@ namespace constants {
const std::string DEF_STADIUM = "DEF_STADIUM";
const std::string NAME_CAMA = "cam_a";
const std::string NAME_CAMB = "cam_b";
const std::string NAME_RECV = "recv";

// these DEF names are for dynamically created node such as ball and robots
const std::string DEF_BALL = "DEF_BALL";
Expand All @@ -32,11 +30,12 @@ namespace constants {
const std::string DEF_ROBOT_PREFIX = "DEF_ROBOT";

// cams
constexpr std::size_t RESOLUTION_X = 640;
constexpr std::size_t RESOLUTION_Y = 480;
constexpr std::size_t SUBIMAGE_NX = 40;
constexpr std::size_t SUBIMAGE_NY = 40;
constexpr std::size_t CAM_PERIOD_MS = 50; // 20 fps = 50 ms
constexpr std::size_t RESOLUTION_X = 640;
constexpr std::size_t RESOLUTION_Y = 480;
constexpr std::size_t SUBIMAGE_NX = 40;
constexpr std::size_t SUBIMAGE_NY = 40;
constexpr std::size_t CAM_PERIOD_MS = 50; // 20 fps = 50 ms
constexpr std::size_t RECV_PERIOD_MS = 50;
constexpr std::size_t ESTIMATED_SUBIMAGE_SIZE = (RESOLUTION_X / SUBIMAGE_NX) * (RESOLUTION_Y / SUBIMAGE_NY) * 4 + 100;

// Field Dimensions
Expand All @@ -61,11 +60,7 @@ namespace constants {

// robot
constexpr std::size_t NUMBER_OF_ROBOTS = 5;
constexpr double MAX_FORCE = 0.1;
constexpr double SLIP_NOISE = 0;//.05;
constexpr double MAX_LINEAR_VELOCITY = 1.8;
constexpr double BODY_MASS = 0.45;
constexpr double WHEEL_MASS = 0.05;
constexpr double MAX_LINEAR_VELOCITY = 1.5;

constexpr double ROBOT_INIT_POSTURE[NUMBER_OF_ROBOTS][3] = {
// x, y, th
Expand All @@ -77,18 +72,15 @@ namespace constants {
};

constexpr double ROBOT_FOUL_POSTURE[NUMBER_OF_ROBOTS][3] = {
{-2.0, 0.55, 0},
{-2.0, 0.70, 0},
{-2.0, 0.85, 0},
{-2.0, 1.00, 0},
{-2.0, 1.15, 0},
{-1.99, 0.55, 0},
{-1.99, 0.70, 0},
{-1.99, 0.85, 0},
{-1.99, 1.00, 0},
{-1.99, 1.15, 0},
};

// WAMP router settings
const std::string SERVER_IP = "127.0.0.1";
constexpr std::size_t WS_PORT = 6217;
constexpr std::size_t RS_PORT = 6218;
const std::string RS_PATH = "/tmp/aiwc.sock";
const std::string REALM = "default";

constexpr std::size_t KEY_LENGTH = 10;
Expand All @@ -101,14 +93,16 @@ namespace constants {
constexpr std::size_t WAIT_END_MS = 3 * 1000; // ms
constexpr std::size_t DEFAULT_GAME_TIME_MS = 300 * 1000; // ms
constexpr std::size_t PERIOD_MS = 50; // ms
constexpr std::size_t FOUL_PA_DURATION_MS = 5 * 1000; // ms
constexpr std::size_t FOUL_GA_DURATION_MS = 5 * 1000; // ms
constexpr std::size_t FOUL_PA_DURATION_MS = 1000; // ms
constexpr std::size_t FOUL_GA_DURATION_MS = 500; // ms
constexpr double FOUL_PA_THRESHOLD = 4.; // number of robots in penalty area
constexpr double FOUL_GA_THRESHOLD = 2.; // number of robots in goal area
constexpr double DEADLOCK_DURATION_MS = 5 * 1000; // ms
constexpr double DEADLOCK_THRESHOLD = 0.1; // m/s
constexpr double FOUL_GA_THRESHOLD = 3.; // number of robots in goal area
constexpr std::size_t DEADLOCK_DURATION_MS = 2 * 1000; // ms
constexpr std::size_t DEADLOCK_RESET_MS = 5 * 1000; // ms
constexpr double DEADLOCK_THRESHOLD = 0.4; // m/s
constexpr double DEADLOCK_RANGE = 1.5 * (ROBOT_RADIUS + BALL_RADIUS); // robots within this range near the ball are sent off

constexpr std::size_t NUM_COMMENTS = 10;
constexpr std::size_t NUM_COMMENTS = 5;

constexpr std::size_t MSG_MAX_SIZE = 90000; // bytes

Expand Down
Loading

0 comments on commit 8c80849

Please sign in to comment.