Giter VIP home page Giter VIP logo

rcj-soccersim's People

Contributors

adman avatar aquahika avatar dbscoach avatar fcamichel avatar felipenmartins avatar marcodankel avatar mrshu avatar richom avatar tbsdrj avatar who576 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rcj-soccersim's Issues

"Find furthest/nearest unoccupied neutral spot"

In order to implement rules

  • 1.8 Inside the Penalty Area
  • 1.9 Lack of Progress
  • 1.10 Damaged Robots

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)).

cc @Adman @felipenmartins

Setup isort, black and flake8

  • Create requirements.txt with these packages (use pip-tools for this) + pre-commit package
  • Setup pre-commit hook to check for code style
  • Setup some CI (Jenkins, CircleCI or whatever else)
  • Add info about running code style checkers into README

Fix blue team name's alignment

The yellow team's name is relatively nicely aligned to its score. Sadly, the blue one is not.

Can we perhaps do something to align them both?

cc @RoboCupJuniorTC/soccer-simulator

Screenshot from 2021-01-14 21-10-59

Document the code

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
"""

Halftimes

@Adman I guess we'll have to figure this out somehow in the end

Auto gameplay pipeline

Pack in docker?
Input several student's .py files and output game playback video and statistics.

Clarify submission file

I'm creating this issue so we don't forget about this.

My idea is that teams can submit whole "rcj_soccer_team_blue" controller (with included team_name.txt, logo, etc.), so we don't have to bother them with renaming it to robot.py.

@mrshu @dbscoach @aquahika What do you think?

Kick the ball

Let's see if it is possible that the robot sends some "kick" signal to supervisor and supervisor sets the ball's velocity appropriately.

soccer.wbt.template robot names

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.

Kickoff

Move one of the robots into the center circle at kickoff.

Remember which one

Controller Error Run in MacOS

This error happen while I run the Simulation in Mac OS

image

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.

Supervisor's _controller not loading on Windows

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.

JSON-based game logs

We'll need to have logs on two levels:

  1. Debug logs (probably via Python's logging)
  2. Game logs, which ought to be readable outside of webots as well as Python itself

I 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

Template for participants

@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()

Need a quick way to determine which side you're on

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:

  1. Require each team to put 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.
  2. Require each team to set a variable in their 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

Will inter-robot communication be supported?

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.

Wheels slowly drifting away from the robot

Peek_2020-12-27_15-29

I don't know what has been causing this, it might be a bug related to rotation since I tweaked those values. I'll report any findings related to this bug if I find any.

Detecting ball lack of progress when the ball is actually moving

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

Change repository name

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?

Lack of progress

If the ball does not change its position within some timespan, move the ball to the nearest unoccupied neutral spot.

Pass coordinates of all team players

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.