robocup-junior / rcj-soccersim Goto Github PK
View Code? Open in Web Editor NEWThe RoboCupJunior Soccer Simulator, based on Webots
Home Page: https://robocupjuniortc.github.io/rcj-soccersim/
License: Apache License 2.0
The RoboCupJunior Soccer Simulator, based on Webots
Home Page: https://robocupjuniortc.github.io/rcj-soccersim/
License: Apache License 2.0
This requires converting some of the objects as well as fixing the x,y,z in the code.
Ball can pass through the wall if it does so in one tick and eventually score a goal (due to moving sideways enough to be behind the goal line)
self.robot = Robot()
self.name = self.robot.getName()
self.name will be one of B1, B2, B3, Y1, Y2, Y3
When a robot turn/flip over and cannot move never again, respawn it
In order to implement rules
We need a way of finding the nearest/furthest unoccupied neutral spot. It would be best to abstract this functionality out so that it can be used from various submodules (such as the penalty area/lack of progress checker(s)).
How to download the webots + our repository
How to run it
How to change the robot script
@javier687 @felipenmartins @Adman Let's see if we can put this together rather quickly
After 15 seconds of no/very little movement
And have an automatic way of checking whether the submitted package (probably a .zip
file) does actually make sense.
The robot may be deemed damaged if it enters the penalty area multiple times within a short timespan.
Since we started documenting the code using Google Docstring style, I would go with that one.
"""Gets and prints the spreadsheet's header columns
Args:
file_loc (str): The file location of the spreadsheet
print_cols (bool): A flag used to print the columns to the console
(default is False)
Returns:
list: a list of strings representing the header columns
"""
When a robot is not responding, end the match and the opponent wins 10:0.
@Adman I guess we'll have to figure this out somehow in the end
Via environment variable
This would give the participants feedback that their code structure is ok and the controller is working.
So that it's not just blue/yellow numbers in the corners
So that the scores, the names of the teams, as well as the reflog (in the bottom-left corner) are visible.
cc @RoboCupJuniorTC/soccer-simulator
So that robot's controller can measure where the ball is located after certain amount of time.
Does this make sense to you?
Choose randomly from 2 or 3 nearest/furthest neutral spots.
Referee - knows the rules and checks whether all robots follow them
Supervisor - know positions of robots, how to i.e. draw a text, move robots, emit message...
Referee gets the instance of supervisor and calls "getters" and "setters".
Pack in docker?
Input several student's .py files and output game playback video and statistics.
As suggested in cyberbotics/webots#2858
Let's see if it is possible that the robot sends some "kick" signal to supervisor and supervisor sets the ball's velocity appropriately.
And potentially 3, 2, 1 countdown at the kickoff perhaps?
Robot respawns with not zero velocity and rotation.
Will be fixed on Webots side in next release (see the issue cyberbotics/webots#2899)
I tried to set up a new simulation world using in scripts > README.md.
In the template world in scripts > templates > soccer.wbt.template, the robots are named "b1", "b2", etc.
In worlds > soccer.wbt, the robots are named "B1", "B2", etc.
This was a breaking change for me (self.name evaluated to "b1" but data uses key "B1"), and worked when I capitalized them. I wasn't sure if this was somehow related to my setup, so I didn't submit a pull request for it.
If this is not just me, the change needed would be all in the file scripts > templates > soccer.wbt.template on lines: 511, 638, 762, 886, 1010, and 1134. Each change is just "b1" to "B1", etc.
Move one of the robots into the center circle at kickoff.
Remember which one
This error happen while I run the Simulation in Mac OS
INFO: rcj_soccer_player: Starting controller: python -u rcj_soccer_player.py
INFO: rcj_soccer_player: Starting controller: python -u rcj_soccer_player.py
INFO: rcj_soccer_player: Starting controller: python -u rcj_soccer_player.py
INFO: rcj_soccer_player: Starting controller: python -u rcj_soccer_player.py
INFO: rcj_soccer_player: Starting controller: python -u rcj_soccer_player.py
INFO: rcj_soccer_player: Starting controller: python -u rcj_soccer_player.py
INFO: rcj_soccer_referee_supervisor: Starting controller: python -u rcj_soccer_referee_supervisor.py
File "rcj_soccer_player.py", line 11
def parse_supervisor_msg(packet: str) -> dict:
^
SyntaxError: invalid syntax
WARNING: 'rcj_soccer_player' controller exited with status: 1.
File "rcj_soccer_player.py", line 11
def parse_supervisor_msg(packet: str) -> dict:
^
SyntaxError: invalid syntax
WARNING: 'rcj_soccer_player' controller exited with status: 1.
File "rcj_soccer_player.py", line 11
def parse_supervisor_msg(packet: str) -> dict:
^
SyntaxError: invalid syntax
WARNING: 'rcj_soccer_player' controller exited with status: 1.
File "rcj_soccer_player.py", line 11
def parse_supervisor_msg(packet: str) -> dict:
^
SyntaxError: invalid syntax
WARNING: 'rcj_soccer_player' controller exited with status: 1.
File "rcj_soccer_player.py", line 11
def parse_supervisor_msg(packet: str) -> dict:
^
SyntaxError: invalid syntax
WARNING: 'rcj_soccer_player' controller exited with status: 1.
File "rcj_soccer_player.py", line 11
def parse_supervisor_msg(packet: str) -> dict:
^
SyntaxError: invalid syntax
WARNING: 'rcj_soccer_player' controller exited with status: 1.
File "rcj_soccer_referee_supervisor.py", line 14
directory: Path,
^
SyntaxError: invalid syntax
WARNING: 'rcj_soccer_referee_supervisor' controller exited with status: 1.
OS: Windows 10 build 19041.685
Python: 3.7.9
Webots: R2020b Revision 2
Error:
INFO: rcj_soccer_player: Starting controller: python3.exe -u rcj_soccer_player.py
INFO: rcj_soccer_player: Starting controller: python3.exe -u rcj_soccer_player.py
INFO: rcj_soccer_player: Starting controller: python3.exe -u rcj_soccer_player.py
INFO: rcj_soccer_player: Starting controller: python3.exe -u rcj_soccer_player.py
INFO: rcj_soccer_player: Starting controller: python3.exe -u rcj_soccer_player.py
INFO: rcj_soccer_referee_supervisor: Starting controller: python3.exe -u rcj_soccer_referee_supervisor.py
Traceback (most recent call last):
File "rcj_soccer_player.py", line 2, in <module>
from controller import Robot
File "C:\Program Files\Webots\lib\controller\python37\controller.py", line 31, in <module>
import _controller
ImportError: DLL load failed: The specified module could not be found.
WARNING: 'rcj_soccer_player' controller exited with status: 1.
Traceback (most recent call last):
File "rcj_soccer_player.py", line 2, in <module>
from controller import Robot
File "C:\Program Files\Webots\lib\controller\python37\controller.py", line 31, in <module>
import _controller
ImportError: DLL load failed: The specified module could not be found.
WARNING: 'rcj_soccer_player' controller exited with status: 1.
Traceback (most recent call last):
File "rcj_soccer_player.py", line 2, in <module>
from controller import Robot
File "C:\Program Files\Webots\lib\controller\python37\controller.py", line 31, in <module>
import _controller
ImportError: DLL load failed: The specified module could not be found.
WARNING: 'rcj_soccer_player' controller exited with status: 1.
Traceback (most recent call last):
File "rcj_soccer_player.py", line 2, in <module>
from controller import Robot
File "C:\Program Files\Webots\lib\controller\python37\controller.py", line 31, in <module>
import _controller
ImportError: DLL load failed: The specified module could not be found.
WARNING: 'rcj_soccer_player' controller exited with status: 1.
Traceback (most recent call last):
File "rcj_soccer_player.py", line 2, in <module>
from controller import Robot
File "C:\Program Files\Webots\lib\controller\python37\controller.py", line 31, in <module>
import _controller
ImportError: DLL load failed: The specified module could not be found.
WARNING: 'rcj_soccer_player' controller exited with status: 1.
Traceback (most recent call last):
File "rcj_soccer_player.py", line 2, in <module>
from controller import Robot
File "C:\Program Files\Webots\lib\controller\python37\controller.py", line 31, in <module>
import _controller
ImportError: DLL load failed: The specified module could not be found.
WARNING: 'rcj_soccer_player' controller exited with status: 1.
Traceback (most recent call last):
File "rcj_soccer_referee_supervisor.py", line 1, in <module>
from controller import Supervisor
File "C:\Program Files\Webots\lib\controller\python37\controller.py", line 31, in <module>
import _controller
ImportError: DLL load failed: The specified module could not be found.
WARNING: 'rcj_soccer_referee_supervisor' controller exited with status: 1.
We'll need to have logs on two levels:
logging
)webots
as well as Python itselfI think one of the better options would be having some JSON lines (https://jsonlines.org/) or something of that sort with action that happened (goal scored, lack of progress, robot's position restarted, ball's position restarted....) as well as some metadata, chiefly among them the timestamp at which the event took place. This would allow us to not just have historical data relevant matches but also to better navigate their recordings (i.e. it should be trivial to see all timestamps at which lack-of-progress took place for instance).
@felipenmartins @javier687 @marcodankel @Adman what do you think
@mrshu @felipenmartins I was thinking that we could provide some template for participants. PR #30 contains demo programs, where we are using this template as well.
###### REQUIRED in order to import abstract robot class
import sys
from pathlib import Path
sys.path.append(str(Path('.').absolute().parent))
from rcj_soccer_player_b1 import rcj_soccer_robot, utils
######
import math
# Feel free to import other built-in libraries here
# You can import also other helper scripts that you create
class MyRobot(rcj_soccer_robot.RCJSoccerRobot):
def run(self):
while self.robot.step(rcj_soccer_robot.TIME_STEP) != -1:
if self.is_new_data():
# READ NEW DATA FROM SUPERVISOR
data = self.get_new_data()
# WRITE YOUR CODE HERE
my_robot = MyRobot()
my_robot.run()
I have just been looking at the code for a couple of days (I am mentoring a couple of teams, we registered one this morning, and I'll have at least two more tomorrow). Thank you to all who have put so much work into it!
I see an issue you might have when you run the submitted code for the competition. Teams will be assigned as Yellow or Blue for each match, so you'll be substituting the three folders for the three robots in the simulation.
The default import statement on line 9 of b2, b3, y2 and y3 needs to be changed depending on which side you're on, or else, if you load up a submitted team as Yellow, but the team has the b1 import in it, it'll import the other team's rcj_soccer_robot
and utils
files instead of their own.
I would say to just force the teams to detect whether they are yellow or blue based on the orientation, but the data is not available yet at the import stage. It can't go in the rcj_soccer_robot file because that import is the issue, it has to go in each of the three of the robot scripts.
The best suggestions I have are:
team = "BLUE"
or team = "YELLOW"
on line 1 of all three robot's control code, and the human referees running the competition would need to set these correctly in each of the six robots' code at the beginning of each match.rcj_soccer_robot
file, for ex. TEAM_NAME = "Bishop's Knights A"
and then change the import in b2, b3, y2, y3 to something like:from rcj_soccer_player_b1 import rcj_soccer_robot, utils
if rcj_soccer_robot.TEAM_NAME == "Bishop's Knights A":
team = "BLUE"
else:
from rcj_soccer_player_y1 import rcj_soccer_robot, utils
team = "YELLOW"
This would make the correct import automatic, but requires teams to set this up correctly. If the base code here had "Default Blue Team" and "Default Yellow Team" pre-set, that would be pretty easy.
3. Require each team to change the folder names to include their own team name, and reset the import statements to match. Again, it requires the teams to set this up correctly, and it also requires some change to the import code. I tried changing the folder name, and the folder wasn't found.
I feel best about #2, if the base code has this set up with default team names, it seems both most likely to succeed and easiest for the people running the competition. If you want me to set that (or something else) up, I can take a fork and submit a pull request.
Best,
Marcus Jaiclin
The Bishop's School
La Jolla, CA, USA
Hello,
I'm just wondering if communication between robots will be supported in the simulation. We are planning to use this to better organise strategies between the robots. If it will be supported, will this be through something like Protobuf or Python's pickle serialiser?
Thanks.
Via the message sent by supervisor
team_name/team_name.py
team_name/robot1.py
team_name/robot2.py
team_name/robot3.py
Hello,
Occasionally, A "ball: lack of progress" is detected and the ball is moved to the center point, after that it takes some time for the robots to reach the ball, but when they reach it and kick it, after several seconds another lack of progress is detected even though the ball is actually moving significantly at that time. However, I'm not sure if this is a bug or if it's actually supposed to be like this (because the total movement of the ball in a certain time window is actually less than a certain threshold).
An example is attached in which the situation occurs around 107 seconds after the initial kickoff. There is also an mp4 clip demonstrating the case:
test.zip
Thanks
Hey @RoboCupJuniorTC/soccer-simulator,
I believe it is about time we've changed the name of the repository. Although it still resembles a playground, I think rcj-soccer-simulator
or rcj-soccer-sim
would probably make it a bit more descriptive than what we currently have.
Once we do that, we can also have a website on the order of rcj-soccer-sim.github.io
, which could host the documentation as well as any other related information.
GitHub is handling renames relatively well (i.e. all the references to the past name will be forwarded to the new one), so I believe the change ought to be relatively painless.
What do you think? Would something like this make sense to you?
If the ball does not change its position within some timespan, move the ball to the nearest unoccupied neutral spot.
What about passing x, y and orientation of the robot to other robot within the same team (or maybe even of all robots)? Teams could incorporate some tactics.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.