Crates.io | roboime-next |
lib.rs | roboime-next |
version | 0.1.0 |
source | src |
created_at | 2016-09-05 03:52:04.533951 |
updated_at | 2016-09-05 03:52:04.533951 |
description | RoboIME's core software stack for the RoboCup Small Size League. |
homepage | |
repository | https://github.com/roboime/roboime-next/ |
max_upload_size | |
id | 6243 |
size | 873,398 |
Next iteration of RoboIME's software stack, coded in Rust.
Install the project:
cargo install roboime-next
To run the demo-ai
bot:
roboime-next-gui --blue="python demos/python2/demo.py"
This will resolve, download and compile dependencies, and compile the project in debug mode and run it. That's it. Really!
See the CLI read-me for more demos.
NOTE: in the near future the cli will be installable via cargo, so only
cargo install roboime-next-cli
instead of all of the above.
If you wish to run your own bot you only have to generate an executable that conforms to the protocol described in the Game I/O section,
and call roboime-next-gui
with it:
roboime-next-gui --blue="python demos/python2/demo.py"
NOTE: the
my-awesome-bot
file has to be executable, just make sure it runs withoutcargo run
first.
For more settings like sending to a remote grSim or playing as a different color:
cargo run -- --help
NOTE: an executable is generated on roboime-next/cli/target/debug/roboime-next-cli[.exe] which can be used directly as well.
Please, setup EditorConfig on your editor/IDE. Also, when writing code, aim to respect the surrounding style conventions. In the future code lints will be added to warn about style that deviates from our preference, for now that's not a priority.
cargo run --release
Notes: linear (x
, y
, field measures) units are in meters, angular (w
) are in radians, linear velocities (vx
, vy
) are in
meters per second, and angular velocity in radians per second.
Line 1 version data:
"ROBOIME_AI_PROTOCOL"
: literal string;VERSION
: an integer, currently 1
, this is increased when incompatible changes are made.Before the next line, it will wait for the correct initialization output.
Line 2 field data:
FIELD_LENGTH
: a float.FIELD_WIDTH
: a float.GOAL_WIDTH
: a float.CENTER_CIRCLE_RADIUS
: a float.DEFENSE RADIUS
: a float.DEFENSE STRETCH
: a float.Currently the following line is expected:
COMPATIBLE 1
In the future, the following may be used to state explicit incompatibility:
NOT_COMPATIBLE 1
, given that 1
is the highest compatible versionLine 1 general play data:
COUNTER
: an integrer, counter for the number of received packetsTIMESTAMP
: a float, the time elapsed since the play startedREFEREE_STATE
: a char, indicates the referee state, one of the following:
S
: STOP, stay at least 0.5m away from the ballN
: NORMAL, go wild, score goalsA
: AVOID, go wild, score goals, except the indicated robot must not touch the ballp
: PRE_KICKOFF, return to your field, you will kickoff shortlyk
: KICKOFF, you're authorized to kickoff nowi
: INDIRECT, kick the ball to resume the game, no double touches or direct goals allowedd
: DIRECT, kick the ball to resume the game, no double touches allowedx
: PRE_PENALTY, get your robots behind the "penalty line", wait for the order to shooty
: PENALTY, you may shoot the penalty, and you better score itP
: OPPONENT_PRE_KICKOFF, return to your field, the opponent will kickoff shortlyK
: OPPONENT_KICKOFF, the opponent is authorized to kickoff, you must still stay away from the ball until the state returns to normalI
: OPPONENT_INDIRECT, the opponent must kick the ball to resume the play, wait for the normal state to approach the ballD
: OPPONENT_DIRECT, the opponent must kick the ball to resume the play, wait for the normal state as per aboveX
: OPPONENT_PRE_PENALTY, get your robots ready, the opponent will shoot a penalty shortlyY
: OPPONENT_PENALTY, the opponent may shoot now, save itREFEREE_MORE_INFO
: an integer, when REFEREE_STATE
is AVOID this will be the id of the robot, for all other cases it's -1SCORE_PLAYER
: an integrer, your team scoreSCORE_OPPONENT
: an integrer, the opponent team scoreGOALIE_ID_PLAYER
: an integrer, the id of your goalkeeper (the robot allowed inside the defense area)GOALIE_ID_OPPONENT
: an integrer, the id of the opponent team goalkeeperLine 2 ball status data:
BALL_X
: a float, ball x positionBALL_Y
: a float, ball y positionBALL_VX
: a float, ball x velocityBALL_VY
: a float, ball y velocityNext line:
ROBOT_COUNT_PLAYER
: an integrer, number of robots in your teamNext ROBOT_COUNT_PLAYER
lines, robots data:
ROBOT_ID
: an integrer, robot identifierROBOT_X
: a float, robot x positionROBOT_Y
: a float, robot y positionROBOT_W
: a float, robot angular positionROBOT_VX
: a float, robot x velocityROBOT_VY
: a float, robot y velocityROBOT_VW
: a float, robot angular velocityNext line:
ROBOT_COUNT_OPPONENT
: an integrer, number of robots in the opponent teamNext ROBOT_COUNT_OPPONENT
lines, robots data:
ROBOT_ID
: an integrer, robot identifierROBOT_X
: a float, robot x positionROBOT_Y
: a float, robot y positionROBOT_W
: a float, robot angular positionROBOT_VX
: a float, robot x velocityROBOT_VY
: a float, robot y velocityROBOT_VW
: a float, robot angular velocityLine 1, command counter:
COUNTER
: an integrer, of counter for the number of sent packages;Next ROBOT_COUNT_PLAYER
lines, robots commands:
V_TANGENT
: a float, robot tangencial velocityV_NORMAL
: a float, robot normal velocityV_ANGULAR
: a float, robot angular velocityKICK_FORCE
: a float, robot kick force (currently this is the shooting velocity)CHIP_FORCE
: a float, robot chip kick force, similar to KICK_FORCE
but is shot at a 45 degrees angleDRIBBLE
: a bool, true (1
) if the dribbler will be turned on, else (0
) it will be offNOTE: only one of KICK_FORCE, CHIP_FORCE and DRIBBLE will be in effect at any given moment, in the future the protocol may be amended to make this more explicit.
These actions will be applied on the robots in the order they were given.
The robot diameter is always 0.180
, we'll call it ROBOT_DIAM
here.
0 <= COUNTER < 1000000
0 <= OUR_SCORE, OPPONENT_SCORE, <= 10
0 <= ROBOT_ID <= 12
|ROBOT_X|, |BALL_X| <= FIELD_LENGTH / 2 + ROBOT_DIAM
|ROBOT_Y|, |BALL_Y| <= FIELD_WIDTH / 2 + ROBOT_DIAM
|ROBOT_W| <= π
||ROBOT_VX, ROBOT_VY||, ||BALL_VX, BALL_VY|| <= 20.0
|ROBOT_VW| <= 10.0 * π
There is a GUI: roboime-next-gui
.
Main objectives include:
This code is licensed under the Mozilla Public License 2.0, of which a textual copy is available at LICENSE.txt.
You are allowed and encouraged to use this software on the RoboCup competitions. If you do, please let us know.
Although not required, we think it's best for all if improvements are shared.