melbournehighschoolrobotics / ev3sim Goto Github PK
View Code? Open in Web Editor NEWA simulator for soccer robots programmed with ev3dev.
Home Page: https://ev3sim.mhsrobotics.club
License: Other
A simulator for soccer robots programmed with ev3dev.
Home Page: https://ev3sim.mhsrobotics.club
License: Other
When we add randomisation using presets will be useful to have an indication of the currently running preset within the UI. Having the ev3sim version number in the UI will be useful for checking that students are on the latest version.
Need only be small text out of the way somewhere.
A system to alert the user on startup if an update is available.
Pretty simple to implement using requests. But means the application would need to access the internet. Thoughts?
Because dragging the pygame window pauses execution on that thread, no tick update data is sent which causes Simulation Died
in the communications threads, if waiting for a send/recv.
Unsure what the best way to fix this is.
Not entirely sure how this would work - maybe a panel that can be shown and hidden
The more I look at this codebase the more I'm noticing inconsistencies in codestyle which probably should be unified, and checked for new PRs. I remember @Dalordish was using black
on the MindPile project, so maybe we add that to this project? Otherwise open to other options.
Uninstalling US Language pack causes pygame to not launch a game window
Currently, using ev3dev2.motor.MotorSet
(or the child classes MoveTank
, MoveSteering
, MoveJoystick
and MoveDifferential
) causes an exception as the reset
command, which is called in the __init__
function, is not implemented.
This is at least the case for the artefact generation for the docs, not sure if this is also an issue for the Python checks.
Currently resetting the match clock also resets the score. Would be good to have some way of having a second half and swapping the direction the teams are shooting.
Would also be nice to make match length variable (in preset is fine).
If scores a level time on is sometimes also needed.
Would be nice to not require the base_plate be defined and load sensible defaults if this is the case, simplify the .yaml file for students getting started.
@glipR how hard do you think this is? Given I probably need to record the video tomorrow (24th), would need to be done pretty quickly to be useful.
When a robot that is already in the penalty box is clicked and dragged in a second time an assertion error occurs because key UI-penalty-0 is already in use.
I think this may only occur on a trackpad. Weird.
Otherwise lots of code just won't work on the sim. In normal use mode shouldn't change much and therefore won't be an issue with timing.
https://stackoverflow.com/questions/2970612/pygame-in-a-thread seems to indicate that on a Mac we can't have the visual logic occuring in a child thread :(((. A possible fix seems to be porting the existing code in single_run.py
to use multiprocessing
rather than threading
.
If linting fails the rest of the tests don't run. This means that it may be harder to see which commit breaks something (once tests exist) if linting isn't being run on every commit (which is likely).
Picking up a robot and attempting to move it to another robot without dropping it causes unintended movement of a moving robot.
Possible solution:
Other noted consequences:
Is firing even before a tag has been created. Think will move to branch based deploy using a protected release branch. Can still tag the releases in that branch, but won't use the tag as a trigger for the release to Pip.
Thoughts @Dalordish ?
This is just a dummy issue for adding trying out the contributors thing. Will close once its all sorted :)
Possibly too fast at the moment
When a goal is scored, all damaged robots should reenter play.
Need a way to be able to turn it off - either in the UI or through preset.
The main functionality is:
Slightly harder to implement and not as important is to detect when lack of progress occurs and move ball and robots appropriately.
We probably want to wait a few seconds before teleporting the ball back in, to mimic the delay in real life. Because robots shouldn't follow the ball out, even if it goes out.
If there is a robot on the teleport location, should pick the nearest location that doesn't have a robot there (normally the centre).
No idea how this would work at the moment and not a priority. This is sort of related to #84 in that the notification to the robot could be used to track program effectiveness.
Currently when the game is paused robot code pauses automatically. But in a real game, the program needs to be started by a team member on the referees signal through a button press. To ensure compatibility with this and require students to implement pause in the main loop, should probably mimic this functionality, possibly through binding to a button press configurable in the yaml file for each robot.
But don't want to break compatibility until after the current competition is complete.
Reproduce:
ev3sim bot.yaml
, drag ball into goal :(((
When ever a yaml file is ran in the simulator it shoots this error
Traceback (most recent call last):
File "c:\users\alex\appdata\local\programs\python\python38\lib\runpy.py", line 193, in _run_module_as_main
return _run_code(code, main_globals, None,
File "c:\users\alex\appdata\local\programs\python\python38\lib\runpy.py", line 86, in run_code
exec(code, run_globals)
File "C:\Users\Alex\AppData\Local\Programs\Python\Python38\Scripts\ev3sim.exe_main.py", line 7, in
File "c:\users\alex\appdata\local\programs\python\python38\lib\site-packages\ev3sim\sim.py", line 35, in main
from ev3sim.simulation.communication import start_server_with_shared_data
File "c:\users\alex\appdata\local\programs\python\python38\lib\site-packages\ev3sim\simulation\communication.py", line 11, in
import ev3sim.simulation.comm_schema_pb2
File "c:\users\alex\appdata\local\programs\python\python38\lib\site-packages\ev3sim\simulation\comm_schema_pb2.py", line 21, in
create_key=_descriptor._internal_create_key,
AttributeError: module 'google.protobuf.descriptor' has no attribute '_internal_create_key'
I tried running multiple .yaml files such as bot.yaml and controllable .yaml and check if the program is installed.
Another thing that's been brought to my attention is that relative imports don't work with ev3attach.
I've been messing with importlib for a while now but haven't got too far. Here's my current progress on changing some of the code in attach.py
, although this doesn't fix the issue:
import os
from importlib.machinery import SourceFileLoader
from importlib.util import spec_from_loader, module_from_spec
class ModLoader(SourceFileLoader):
def get_filename(self, fullname):
if self.path.endswith('.py'):
return self.path
return os.path.join(self.path, '__init__.py')
loader = ModLoader('__main__', fname)
spec = spec_from_loader(loader.name, loader)
module = module_from_spec(spec)
loader.exec_module(module)
If we want to implement this for the senior division we need to discuss how this will be done and start work soon.
The simulated InfraredSensor, when in 'all values (modulated)' mode (AC-ALL
) returns 7 values, unlike the ev3dev drivers where (according to the documentation) 6 values are returned (7 values are returned in the unmodulated mode DC-ALL
).
I'm not sure what the best solution to this would be, since the 7th value could be used in existing programs, such as TemplateBot/templateBot.py in the (private) template repo, line 69.
Currently reads in ev3dev2 code are nonblocking - meaning that they don't rely on any communication being made between threads.
This can cause a lot of errors, especially when certain threads are eating up all the processing time.
As such I think it's best that we check that any reads use information received in the past 0.2 seconds or so (Using the builtin time, not the mocked time) and block if this is not the case.
There is risk that this completely stops code altogether, where we get only 1 read per tick, so this wait time will need to be configured.
For things like team names, match length etc
Adjust GAME_TICK_RATE, VISUAL_TICK_RATE, TIME_SCALE defaults in ScriptLoader (some 30 and some 60) and in soccer.yaml preset (both 30).
Move from loader to use settings (or is this not possible because not a singleton class?)
Add corresponding documentation including for TIME_SCALE
Can slightly reduce the package size by removing dependencies from the main requirements file. Namely black.
Will need to modify the Lint with Black GitHub action to explicitly install black.
(venv) C:\Users\sachi\PycharmProjects\RoboCup_Simulator>python .\run.py --preset=presets/field_no_teams.yaml robot/examples/controllable.yaml
Loading chipmunk for Windows (64bit) [C:\Users\sachi\PycharmProjects\RoboCup_Simulator\venv\lib\site-packages\pymunk\chipmunk.dll]
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File ".\run.py", line 18, in <module>
runFromConfig(config)
File "C:\Users\sachi\PycharmProjects\RoboCup_Simulator\simulation\loader.py", line 127, in runFromConfig
sl.simulate()
File "C:\Users\sachi\PycharmProjects\RoboCup_Simulator\simulation\loader.py", line 85, in simulate
if interactor.tick(tick):
File "C:\Users\sachi\PycharmProjects\RoboCup_Simulator\presets\soccer.py", line 123, in tick
self.ball_centre.body.position = ScriptLoader.instance.object_map['IR_BALL'].body.position
AttributeError: 'SoccerInteractor' object has no attribute 'ball_centre'
@alanlu776 is getting the same error
I took a look at the code but I'm not familiar enough with it or Pymunk to figure out why it doesn't work.
For example
preset_file: soccer.yaml
team1-bots:
- name: templateBot.yaml
scripts:
- templateBot.py
team2-bots:
- name: templateBot.yaml
scripts:
- templateBot.py
Would need to maintain backwards compatibility.
The difference between RAW and RGB_RAW is more than just calibration in ev3dev2 - which LEDs are turned on changes.
https://github.com/MelbourneHighSchoolRobotics/ev3sim/tree/main/ev3sim/robots/scripts
Not a hard change, but need to update all locations that link here - including potentially outside this repository.
Have two different ways of doing very similar functionality. The settings override is more general and should probably be kept for that reason, but is not a full superset of the functionality offered by specifying kwargs.
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.