Compare commits
No commits in common. "main" and "main" have entirely different histories.
232
.gitignore
vendored
|
@ -1,232 +0,0 @@
|
|||
### C++ ###
|
||||
# Prerequisites
|
||||
*.d
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
### PlatformIO ###
|
||||
.pioenvs
|
||||
.piolibdeps
|
||||
.clang_complete
|
||||
.gcc-flags.json
|
||||
.pio
|
||||
|
||||
### Python ###
|
||||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
share/python-wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
MANIFEST
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
*.py,cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
cover/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
.pybuilder/
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
# For a library or package, you might want to ignore these files since the code is
|
||||
# intended to run in multiple environments; otherwise, check them in:
|
||||
# .python-version
|
||||
|
||||
# pipenv
|
||||
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
|
||||
# However, in case of collaboration, if having platform-specific dependencies or dependencies
|
||||
# having no cross-platform support, pipenv may install dependencies that don't work, or not
|
||||
# install all needed dependencies.
|
||||
#Pipfile.lock
|
||||
|
||||
# poetry
|
||||
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
|
||||
# This is especially recommended for binary packages to ensure reproducibility, and is more
|
||||
# commonly ignored for libraries.
|
||||
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
|
||||
#poetry.lock
|
||||
|
||||
# pdm
|
||||
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
|
||||
#pdm.lock
|
||||
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
|
||||
# in version control.
|
||||
# https://pdm.fming.dev/#use-with-ide
|
||||
.pdm.toml
|
||||
|
||||
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
|
||||
__pypackages__/
|
||||
|
||||
# Celery stuff
|
||||
celerybeat-schedule
|
||||
celerybeat.pid
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
# pytype static type analyzer
|
||||
.pytype/
|
||||
|
||||
# Cython debug symbols
|
||||
cython_debug/
|
||||
|
||||
# PyCharm
|
||||
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
|
||||
# be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
|
||||
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
||||
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
||||
#.idea/
|
||||
|
||||
### Python Patch ###
|
||||
# Poetry local configuration file - https://python-poetry.org/docs/configuration/#local-configuration
|
||||
poetry.toml
|
||||
|
||||
# ruff
|
||||
.ruff_cache/
|
||||
|
||||
# LSP config files
|
||||
pyrightconfig.json
|
||||
|
||||
### Vim ###
|
||||
# Swap
|
||||
[._]*.s[a-v][a-z]
|
||||
!*.svg # comment out if you don't need vector files
|
||||
[._]*.sw[a-p]
|
||||
[._]s[a-rt-v][a-z]
|
||||
[._]ss[a-gi-z]
|
||||
[._]sw[a-p]
|
||||
|
||||
# Session
|
||||
Session.vim
|
||||
Sessionx.vim
|
||||
|
||||
# Temporary
|
||||
.netrwhist
|
||||
*~
|
||||
# Auto-generated tag files
|
||||
tags
|
||||
# Persistent undo
|
||||
[._]*.un~
|
|
@ -1,66 +0,0 @@
|
|||
# Create Component part for Fritzing
|
||||
|
||||
## Installation
|
||||
|
||||
Install:
|
||||
* Fritzing
|
||||
* Inkscape
|
||||
|
||||
Fritzing installation (Debian 12):
|
||||
|
||||
`
|
||||
$ sudo apt install fritzing
|
||||
`
|
||||
|
||||
Inkscape installation (Debian 12):
|
||||
|
||||
`
|
||||
$ sudo apt install inkscape`
|
||||
|
||||
## Fonts installation
|
||||
|
||||
Install fonts for Fritzing components definition:
|
||||
* download file from [](https://fritzing.org/learning/tutorials/creating-custom-parts/download-fonts-and-templates)
|
||||
|
||||
`
|
||||
$ wget https://fritzing.org/media/uploads/learning/graphic_standards/fontsandtemplates.zip
|
||||
`
|
||||
|
||||
Install fonts from the zip file:
|
||||
|
||||
* DroidSans
|
||||
* OCR A
|
||||
|
||||
## Inkscape
|
||||
|
||||
Use Inkscape to define:
|
||||
* the Fritzing breadboard svg file
|
||||
* the Fritzing schematic svg file and
|
||||
* the Fritzing PCB svg file
|
||||
|
||||
You can start using the templates provided in the fontsandtemplates.zip file.
|
||||
|
||||
## Frizting
|
||||
|
||||
Steps to create a new component:
|
||||
* new project
|
||||
* drag and drop in the breadboard and existing component
|
||||
* click Component menu / Edit (new componnent)
|
||||
* load svg file for each tabs (breadboard, schematic, PCB)
|
||||
* change the metadata in Metadata tab
|
||||
* change the number and definition of pins in Connectors tab
|
||||
* for each view, select pin and link it to a graphical part of the svg drawings
|
||||
|
||||
Finally, save the Fritzing new component in **My Parts** tab.
|
||||
|
||||
## This directory content
|
||||
|
||||
This directory contains svg files for:
|
||||
* breadboard and icon: lph_gear_motor_encoder_icon.svg
|
||||
* schematic: lph_gear_motor_encoder_schematic.svg
|
||||
* PCB: lph_gear_motor_encoder_pcb.svg
|
||||
|
||||
# References
|
||||
|
||||
* https://wiki.dfrobot.com/Micro_DC_Motor_with_Encoder-SJ01_SKU__FIT0450
|
||||
* https://github.com/Arduinolibrary/DFRobot_Micro_DC_Geared_Motor_with_Encoder/
|
|
@ -1,150 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
height="124.32"
|
||||
width="257.952"
|
||||
viewBox="0 0 2687.011 1294.646"
|
||||
version="1.1"
|
||||
id="svg580"
|
||||
sodipodi:docname="lph_gear_motor_encoder_icon.svg"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<defs
|
||||
id="defs584" />
|
||||
<sodipodi:namedview
|
||||
id="namedview582"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
showgrid="false"
|
||||
inkscape:zoom="5.9041993"
|
||||
inkscape:cx="91.96844"
|
||||
inkscape:cy="62.159148"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1011"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg580" />
|
||||
<path
|
||||
fill="#e6e6e6"
|
||||
d="M2080.526 0h152.528v1294.646h-152.528z"
|
||||
id="path544" />
|
||||
<g
|
||||
fill="#ffd42a"
|
||||
id="g550">
|
||||
<path
|
||||
d="M1136.29 265.875h1399.36v762.885H1136.29z"
|
||||
id="path546" />
|
||||
<path
|
||||
d="M2471.29 589.442h215.708v115.75H2471.29z"
|
||||
id="path548" />
|
||||
</g>
|
||||
<g
|
||||
fill="#4d4d4d"
|
||||
id="g556">
|
||||
<path
|
||||
d="M28.028 436.43h127.14c15.486 0 28.042 12.542 28.042 28.028V831.65c0 15.472-12.542 28.028-28.042 28.028H28.028C12.542 859.678 0 847.108 0 831.636V464.443c0-15.472 12.542-28.014 28.028-28.014z"
|
||||
id="path552" />
|
||||
<path
|
||||
d="M102.805 343.694h102.597c22.264 0 40.306 18.042 40.306 40.305v528.08c0 22.264-18.056 40.305-40.306 40.305H102.805c-22.264 0-40.306-18.055-40.306-40.305V384c0-22.264 18.056-40.305 40.306-40.305z"
|
||||
id="path554" />
|
||||
</g>
|
||||
<path
|
||||
d="M822.166 293.305l27.903-26.86h22.306m-50.21 734.885l27.903 26.86h22.306"
|
||||
stroke-miterlimit="1"
|
||||
fill="none"
|
||||
stroke="#fc0"
|
||||
stroke-width="7.847"
|
||||
stroke-linecap="round"
|
||||
id="path558" />
|
||||
<path
|
||||
fill="#ffd42a"
|
||||
d="M712.194 289.027h427.82v717.996h-427.82z"
|
||||
id="path560" />
|
||||
<path
|
||||
fill="#d4aa00"
|
||||
stroke="#d4aa00"
|
||||
stroke-width="2.378"
|
||||
d="M1101.193 292.403h31.736v711.26h-31.736z"
|
||||
id="path562" />
|
||||
<path
|
||||
fill="#ccc"
|
||||
d="M183.208 323.444h528.986V972.62H183.208z"
|
||||
id="path564" />
|
||||
<path
|
||||
d="M2687.01 647.318H712.194"
|
||||
opacity=".45"
|
||||
fill="#fc0"
|
||||
stroke="#d4aa00"
|
||||
stroke-width="3.475"
|
||||
id="path566" />
|
||||
<path
|
||||
d="M119.687 293.47a9.83 9.83 0 0 1 9.833 9.847v30.528a9.83 9.83 0 0 1-9.833 9.847 9.84 9.84 0 0 1-9.847-9.847v-30.528a9.85 9.85 0 0 1 9.847-9.847z"
|
||||
fill="#fff"
|
||||
id="path570" />
|
||||
<path
|
||||
d="M114 284.187h9.764v10.458H114zm0 699.986h9.764v10.472H114z"
|
||||
fill="#e6e6e6"
|
||||
id="path576" />
|
||||
<path
|
||||
d="M402.6 867.705V849.69c.028-2.347.792-4.64 2.278-6.86s3.278-3.847 5.375-4.917l18.236-9c3.292-1.694 6.722-2.556 10.306-2.556 3.333 0 6.75.903 10.25 2.708l18.014 9.056a13.86 13.86 0 0 1 5.556 4.986c1.39 2.166 2.083 4.597 2.083 7.264v17.417a4.31 4.31 0 0 1-1.361 3.222c-.903.9-1.972 1.333-3.194 1.333-1.264 0-2.36-.43-3.278-1.333-.917-.875-1.4-1.958-1.4-3.222v-4.778h-53.653v4.667a4.23 4.23 0 0 1-1.39 3.222 4.55 4.55 0 0 1-3.278 1.333 4.33 4.33 0 0 1-3.194-1.333c-.903-.847-1.36-1.917-1.36-3.194zm9.222-13.778h53.764l-.014-3.18c0-2.028-.986-3.528-2.986-4.542l-17.903-9c-2.347-1.125-4.32-1.694-5.917-1.708a12.28 12.28 0 0 0-5.639 1.361l-18.556 9.333c-1.847.972-2.764 2.57-2.764 4.778v2.958zm53.765-73.874V763.6a4.56 4.56 0 0 1 1.333-3.292c.9-.917 1.958-1.4 3.222-1.4s2.333.458 3.222 1.4 1.333 2.028 1.333 3.278v17.042c0 2.167-.68 4.417-2.056 6.722-1.375 2.32-2.903 3.93-4.6 4.833l-20.347 10.528c-2.93 1.417-5.93 2.1-9 2.1-3.403 0-6.347-.667-8.847-2.014l-20.125-10.625c-1.875-1-3.528-2.583-4.958-4.722-1.43-2.125-2.14-4.194-2.14-6.18v-18.014c0-1.264.458-2.333 1.36-3.222.903-.875 1.972-1.333 3.194-1.333a4.55 4.55 0 0 1 3.278 1.333c.917.9 1.4 1.972 1.4 3.222v17.347c0 1.444.86 2.625 2.556 3.542l18.86 10.1c1.486.806 3.236 1.194 5.264 1.18 2.14.014 4.028-.417 5.653-1.292l18.556-9.653c1.917-.903 2.875-2.403 2.86-4.458zM411.722 624.93h17.083c3.986 0 7.194 1.222 9.653 3.694 2.82-2.528 5.9-3.792 9.222-3.792h17.792c2.5 0 4.64.903 6.43 2.708a8.92 8.92 0 0 1 2.681 6.514v32.222c0 1.278-.444 2.347-1.333 3.222a4.38 4.38 0 0 1-3.222 1.333c-1.264 0-2.333-.43-3.222-1.333-.9-.875-1.333-1.958-1.333-3.222V634.15H447.68a4.55 4.55 0 0 0-3.278 1.333c-.917.9-1.4 1.958-1.4 3.222v18.333c0 1.278-.43 2.347-1.306 3.222-.875.9-1.958 1.333-3.25 1.333-1.264 0-2.333-.43-3.222-1.333-.9-.875-1.333-1.958-1.333-3.222v-18.444c0-1.222-.444-2.306-1.333-3.194s-1.958-1.36-3.222-1.36h-17.64v32.555c0 1.278-.444 2.347-1.333 3.222a4.38 4.38 0 0 1-3.222 1.333c-1.264 0-2.333-.43-3.222-1.333-.9-.875-1.333-1.958-1.333-3.222V634.04c0-2.528.9-4.68 2.68-6.458s3.958-2.653 6.444-2.653zm26.638-67.112h4.014a4.55 4.55 0 0 1 3.278 1.333c.917.9 1.4 1.958 1.4 3.222v36.778c0 1.264-.458 2.333-1.4 3.222s-2.014 1.333-3.278 1.333h-4.014a4.38 4.38 0 0 1-4.556-4.556v-36.778c0-1.153.43-2.208 1.278-3.153s1.944-1.403 3.278-1.403zm-35.75-25.875v-4.556c0-1.264.458-2.333 1.36-3.222s1.972-1.333 3.194-1.333a4.38 4.38 0 0 1 4.556 4.556h30.1v-32.125c0-1.222.458-2.306 1.4-3.194s2.014-1.36 3.278-1.36h23.542c1.264 0 2.333.458 3.222 1.4s1.333 2.014 1.333 3.278v36.57c0 1.264-.458 2.36-1.36 3.278s-1.972 1.4-3.194 1.4h-62.875c-1.264 0-2.333-.458-3.222-1.36s-1.333-2.014-1.333-3.306zm48.444-4.458h14.43V499.93h-14.43zm-43.777-104.11h16.764l47.25 18.57c2.292.93 3.43 2.417 3.43 4.43 0 2.125-1.14 3.653-3.417 4.556l-47.25 18.444H407.3c-1.306 0-2.403-.444-3.306-1.333a4.38 4.38 0 0 1-1.36-3.236c0-1.264.458-2.347 1.36-3.236s2.014-1.333 3.306-1.333h14.86l35.375-13.875-35.278-13.875h-14.972c-1.306 0-2.403-.444-3.306-1.333a4.38 4.38 0 0 1-1.36-3.236c0-1.264.458-2.347 1.36-3.236s2-1.306 3.306-1.306z"
|
||||
id="path578" />
|
||||
<rect
|
||||
style="fill:#000000;stroke-width:13.9513"
|
||||
id="rect735"
|
||||
width="46.684719"
|
||||
height="295.86975"
|
||||
x="424.99976"
|
||||
y="32.252914" />
|
||||
<rect
|
||||
style="fill:#999999;stroke-width:13.308"
|
||||
id="rect789"
|
||||
width="82.355682"
|
||||
height="217.49408"
|
||||
x="342.64404"
|
||||
y="32.252914" />
|
||||
<rect
|
||||
style="fill:#999999;stroke-width:13.308"
|
||||
id="rect791"
|
||||
width="82.355682"
|
||||
height="217.49408"
|
||||
x="470.58252"
|
||||
y="32.252914" />
|
||||
<rect
|
||||
style="fill:#000000;stroke-width:10.4167"
|
||||
id="rect793"
|
||||
width="61.088448"
|
||||
height="32.584198"
|
||||
x="281.55557"
|
||||
y="70.205444" />
|
||||
<rect
|
||||
style="fill:#ff0000;stroke-width:10.4167"
|
||||
id="rect899"
|
||||
width="61.088448"
|
||||
height="32.584198"
|
||||
x="281.55557"
|
||||
y="153.53911" />
|
||||
<path
|
||||
style="fill:#ff0000;stroke-width:10.4167"
|
||||
d="m 552.39078,187.21392 v 32.57257 h 61.09644 v -32.57257 z"
|
||||
id="path930" />
|
||||
<path
|
||||
style="fill:#000000;stroke-width:10.4167"
|
||||
d="m 552.39078,145.54709 v 32.57256 h 61.09644 v -32.57256 z"
|
||||
id="path928" />
|
||||
<path
|
||||
style="fill:#0000ff;stroke-width:10.4167"
|
||||
d="m 552.39078,103.88025 v 32.57256 h 61.09644 v -32.57256 z"
|
||||
id="path926" />
|
||||
<path
|
||||
style="fill:#008000;stroke-width:10.4167"
|
||||
d="m 552.39078,62.213415 v 32.572562 h 61.09644 V 62.213415 Z"
|
||||
id="rect901" />
|
||||
</svg>
|
Before Width: | Height: | Size: 7.2 KiB |
|
@ -1,150 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 16.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
version="1.1"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
width="30.24px"
|
||||
height="30.24px"
|
||||
viewBox="0 0 30.24 30.24"
|
||||
enable-background="new 0 0 30.24 30.24"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="lph_gear_motor_encoder_pcb.svg"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs2096">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</defs><sodipodi:namedview
|
||||
id="namedview2094"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
showgrid="false"
|
||||
inkscape:zoom="25.859789"
|
||||
inkscape:cx="15.12"
|
||||
inkscape:cy="15.12"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1011"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" />
|
||||
<g
|
||||
id="silkscreen">
|
||||
<line
|
||||
fill="none"
|
||||
stroke="#FFFFFF"
|
||||
stroke-width="0.75"
|
||||
x1="0.72"
|
||||
y1="0.72"
|
||||
x2="0.72"
|
||||
y2="29.52"
|
||||
id="line2069" />
|
||||
<line
|
||||
fill="none"
|
||||
stroke="#FFFFFF"
|
||||
stroke-width="0.75"
|
||||
x1="0.72"
|
||||
y1="29.52"
|
||||
x2="29.521"
|
||||
y2="29.52"
|
||||
id="line2071" />
|
||||
<line
|
||||
fill="none"
|
||||
stroke="#FFFFFF"
|
||||
stroke-width="0.75"
|
||||
x1="29.521"
|
||||
y1="29.52"
|
||||
x2="29.521"
|
||||
y2="0.72"
|
||||
id="line2073" />
|
||||
<line
|
||||
fill="none"
|
||||
stroke="#FFFFFF"
|
||||
stroke-width="0.75"
|
||||
x1="0.72"
|
||||
y1="0.72"
|
||||
x2="11.52"
|
||||
y2="0.72"
|
||||
id="line2075" />
|
||||
<line
|
||||
fill="none"
|
||||
stroke="#FFFFFF"
|
||||
stroke-width="0.75"
|
||||
x1="18.72"
|
||||
y1="0.72"
|
||||
x2="29.521"
|
||||
y2="0.72"
|
||||
id="line2077" />
|
||||
</g>
|
||||
<circle
|
||||
id="connector5pin"
|
||||
fill="none"
|
||||
stroke="#ffbf00"
|
||||
stroke-width="1.152"
|
||||
cx="25.92"
|
||||
cy="18.719999"
|
||||
r="1.584" /><circle
|
||||
id="connector0pin"
|
||||
fill="none"
|
||||
stroke="#ffbf00"
|
||||
stroke-width="1.152"
|
||||
cx="4.3200002"
|
||||
cy="4.3200002"
|
||||
r="1.584" /><circle
|
||||
id="connector1pin"
|
||||
fill="none"
|
||||
stroke="#ffbf00"
|
||||
stroke-width="1.152"
|
||||
cx="4.3200002"
|
||||
cy="11.52"
|
||||
r="1.584" /><circle
|
||||
id="connector4pin"
|
||||
fill="none"
|
||||
stroke="#ffbf00"
|
||||
stroke-width="1.152"
|
||||
cx="25.92"
|
||||
cy="25.92"
|
||||
r="1.584" /><circle
|
||||
id="connector6pin"
|
||||
fill="none"
|
||||
stroke="#ffbf00"
|
||||
stroke-width="1.152"
|
||||
cx="25.92"
|
||||
cy="11.52"
|
||||
r="1.584" /><circle
|
||||
id="connector7pin"
|
||||
fill="none"
|
||||
stroke="#ffbf00"
|
||||
stroke-width="1.152"
|
||||
cx="25.92"
|
||||
cy="4.3200002"
|
||||
r="1.584" />
|
||||
<g
|
||||
id="keepout">
|
||||
</g>
|
||||
<g
|
||||
id="soldermask">
|
||||
</g>
|
||||
<g
|
||||
id="outline">
|
||||
</g>
|
||||
</svg>
|
Before Width: | Height: | Size: 2.8 KiB |
|
@ -1,303 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Generator: Adobe Illustrator 15.0.2, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
|
||||
<svg
|
||||
version="1.2"
|
||||
id="Layer_1"
|
||||
x="0px"
|
||||
y="0px"
|
||||
width="57.643px"
|
||||
height="71.833px"
|
||||
viewBox="0 0 57.643 71.833"
|
||||
xml:space="preserve"
|
||||
sodipodi:docname="lph_gear_motor_encoder_schematic.svg"
|
||||
inkscape:version="1.2.2 (b0a8486541, 2022-12-01)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"><defs
|
||||
id="defs1455">
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</defs><sodipodi:namedview
|
||||
id="namedview1453"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
showgrid="false"
|
||||
inkscape:zoom="10.886361"
|
||||
inkscape:cx="28.935289"
|
||||
inkscape:cy="31.323598"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1011"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="Layer_1" />
|
||||
|
||||
|
||||
<rect
|
||||
id="part_symbol"
|
||||
x="7.1999998"
|
||||
y="7.1999998"
|
||||
fill="#ffffff"
|
||||
stroke="#000000"
|
||||
stroke-width="0.9002"
|
||||
stroke-linecap="round"
|
||||
width="43.199001"
|
||||
height="57.598999" /><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="4.5px"
|
||||
id="text1426-2"
|
||||
x="14.601288"
|
||||
y="62.0037">V</text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="4.5px"
|
||||
id="text1428-3"
|
||||
x="17.022188"
|
||||
y="62.0037">c</text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="4.5px"
|
||||
id="text1430-7"
|
||||
x="19.106089"
|
||||
y="62.0037">c</text><line
|
||||
fill="none"
|
||||
stroke="#555555"
|
||||
stroke-width="0.7"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
x1="41.336124"
|
||||
y1="-0.1808724"
|
||||
x2="41.336124"
|
||||
y2="7.020124"
|
||||
id="line1370-2" /><g
|
||||
id="g1372">
|
||||
|
||||
<line
|
||||
fill="none"
|
||||
stroke="#555555"
|
||||
stroke-width="0.7"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
x1="28.799999"
|
||||
y1="64.799004"
|
||||
x2="28.799999"
|
||||
y2="72"
|
||||
id="line1370" />
|
||||
</g><g
|
||||
id="g1372-5"
|
||||
transform="translate(-10.687967)">
|
||||
|
||||
<line
|
||||
fill="none"
|
||||
stroke="#555555"
|
||||
stroke-width="0.7"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
x1="28.799999"
|
||||
y1="64.799004"
|
||||
x2="28.799999"
|
||||
y2="72"
|
||||
id="line1370-9" />
|
||||
</g><g
|
||||
id="g1384">
|
||||
|
||||
<line
|
||||
fill="none"
|
||||
stroke="#555555"
|
||||
stroke-width="0.7"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
x1="28.799999"
|
||||
y1="7.2010002"
|
||||
x2="28.799999"
|
||||
y2="0"
|
||||
id="line1382" />
|
||||
</g><g
|
||||
id="g1388"
|
||||
transform="translate(0,10)">
|
||||
|
||||
<line
|
||||
fill="none"
|
||||
stroke="#555555"
|
||||
stroke-width="0.7"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
x1="50.401001"
|
||||
y1="28.799999"
|
||||
x2="57.599998"
|
||||
y2="28.799999"
|
||||
id="line1386" />
|
||||
</g><g
|
||||
id="g1392"
|
||||
transform="translate(0,2)">
|
||||
|
||||
<line
|
||||
fill="none"
|
||||
stroke="#555555"
|
||||
stroke-width="0.7"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
x1="50.401001"
|
||||
y1="21.6"
|
||||
x2="57.599998"
|
||||
y2="21.604"
|
||||
id="line1390" />
|
||||
</g><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="3px"
|
||||
id="text1395"
|
||||
x="53.310799"
|
||||
y="22.154301">5</text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="3px"
|
||||
id="text1397"
|
||||
x="53.1409"
|
||||
y="37.4492">6</text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="3px"
|
||||
id="text1401"
|
||||
x="30.162399"
|
||||
y="3.8729999">1</text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="3px"
|
||||
id="text1403"
|
||||
x="30.162399"
|
||||
y="69.109901">4</text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="3px"
|
||||
id="text1403-22"
|
||||
x="19.382944"
|
||||
y="69.476166">3</text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="3px"
|
||||
id="text1403-2"
|
||||
x="43.751019"
|
||||
y="3.8634784">2</text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="4.5px"
|
||||
id="text1424"
|
||||
x="24.6106"
|
||||
y="62.484901">Gnd</text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="4.5px"
|
||||
id="text1424-9"
|
||||
x="37.544281"
|
||||
y="12.616499">Gnd</text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="4.5px"
|
||||
id="text1426"
|
||||
x="25.511999"
|
||||
y="12.5352">V</text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="4.5px"
|
||||
id="text1428"
|
||||
x="27.932899"
|
||||
y="12.5352">c</text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="4.5px"
|
||||
id="text1430"
|
||||
x="30.0168"
|
||||
y="12.5352">c</text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="4.5px"
|
||||
id="text1440"
|
||||
x="27.99662"
|
||||
y="25.018021"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-family:'Droid Sans Mono';-inkscape-font-specification:'Droid Sans Mono'"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1981"
|
||||
x="27.99662"
|
||||
y="25.018021">Out Blue </tspan><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan1983"
|
||||
x="27.99662"
|
||||
y="30.643021" /></text><text
|
||||
fill="#555555"
|
||||
font-family="DroidSans"
|
||||
font-size="4.5px"
|
||||
id="text1442"
|
||||
x="27.906532"
|
||||
y="39.373055">Out Green</text><text
|
||||
font-family="DroidSans"
|
||||
font-size="6px"
|
||||
id="text1447"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.33333px;font-family:'Droid Sans Mono';-inkscape-font-specification:'Droid Sans Mono'"
|
||||
x="9.6147776"
|
||||
y="17.202038">DC Motor </text><text
|
||||
font-family="DroidSans"
|
||||
font-size="6px"
|
||||
id="text1447-0"
|
||||
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:5.33333px;font-family:'Droid Sans Mono';-inkscape-font-specification:'Droid Sans Mono'"
|
||||
x="13.811852"
|
||||
y="55.412983">DC Coder </text>
|
||||
</svg>
|
Before Width: | Height: | Size: 6.0 KiB |
|
@ -1,25 +0,0 @@
|
|||
# JacoVirt
|
||||
|
||||
## How run the project ?
|
||||
|
||||
|
||||
Clone the project :
|
||||
~~~
|
||||
git clone https://git.afpy.org/MDL29/JacoBot.git
|
||||
~~~
|
||||
Go in the folder of project then in the virtual pad folder
|
||||
~~~
|
||||
cd Jacobot/jacovirt
|
||||
~~~
|
||||
Downloads dependencies and create a virtual environement
|
||||
~~~
|
||||
poetry install
|
||||
~~~
|
||||
Run the virtual pad with :
|
||||
~~~
|
||||
poetry run jacovirt pad
|
||||
~~~
|
||||
Run the virtual bot with :
|
||||
~~~
|
||||
poetry run jacovirt bot
|
||||
~~~
|
Before Width: | Height: | Size: 455 KiB |
Before Width: | Height: | Size: 412 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 2.2 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.0 KiB |
Before Width: | Height: | Size: 3.6 KiB |
Before Width: | Height: | Size: 3.4 KiB |
Before Width: | Height: | Size: 3.5 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 25 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 19 KiB |
Before Width: | Height: | Size: 22 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 18 KiB |
Before Width: | Height: | Size: 16 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 15 KiB |
Before Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 36 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 48 KiB |
Before Width: | Height: | Size: 46 KiB |
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 38 KiB |
Before Width: | Height: | Size: 40 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 29 KiB |
Before Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 24 KiB |
Before Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 13 KiB |
Before Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 23 KiB |
|
@ -1,56 +0,0 @@
|
|||
import argparse
|
||||
import logging
|
||||
|
||||
import jacovirt.logger
|
||||
|
||||
log_level = {
|
||||
"CRITICAL": logging.CRITICAL,
|
||||
"ERROR": logging.ERROR,
|
||||
"WARN": logging.WARNING,
|
||||
"INFO": logging.INFO,
|
||||
"DEBUG": logging.DEBUG,
|
||||
}
|
||||
|
||||
def main():
|
||||
|
||||
# General parser
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
|
||||
# Subparser
|
||||
sub = parser.add_subparsers(dest="sub")
|
||||
|
||||
parser.add_argument(
|
||||
"-l",
|
||||
"--log",
|
||||
choices=log_level.keys(),
|
||||
default="WARN",
|
||||
help=("Set level log"),
|
||||
dest="log",
|
||||
)
|
||||
|
||||
|
||||
# Parser for JacoVirt Pad
|
||||
pad = sub.add_parser("pad", help="Run JacoVirt Pad")
|
||||
|
||||
# Parser for JacoVirt Bot
|
||||
bot = sub.add_parser("bot", help="Run JacoVirt Bot")
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
if args.sub is None:
|
||||
parser.print_help()
|
||||
exit(1)
|
||||
|
||||
logging.getLogger().setLevel(args.log)
|
||||
|
||||
match args.sub:
|
||||
case "pad":
|
||||
logging.info("Lunch JacoVirt Pad")
|
||||
from jacovirt.pad import window
|
||||
window.main()
|
||||
case "bot":
|
||||
logging.info("Lunch JacoVirt Bot")
|
||||
from jacovirt.bot import window
|
||||
window.main()
|
||||
case _:
|
||||
SystemExit
|
|
@ -1,51 +0,0 @@
|
|||
import arcade
|
||||
import logging
|
||||
|
||||
|
||||
class Bot(arcade.Sprite):
|
||||
"""
|
||||
Bot sprite
|
||||
"""
|
||||
def __init__(self, start, grid, scale=0.75):
|
||||
self.sprite = ":resources:images/space_shooter/playerShip1_green.png"
|
||||
|
||||
self.grid = grid
|
||||
self.pos = list(start)
|
||||
|
||||
super().__init__(self.sprite, scale, hit_box_algorithm="None")
|
||||
self.set_pos()
|
||||
self.angle = 270
|
||||
|
||||
def set_pos(self):
|
||||
for tile in self.grid.tiles:
|
||||
if tile.pos == tuple(self.pos):
|
||||
self.position = tile.position
|
||||
logging.debug(f"Move bot to {self.pos} - {self.position}")
|
||||
break
|
||||
|
||||
def left(self):
|
||||
self.angle += 90
|
||||
if self.angle >= 360:
|
||||
self.angle -=360
|
||||
|
||||
def right(self):
|
||||
self.angle -= 90
|
||||
if self.angle < 0:
|
||||
self.angle += 360
|
||||
|
||||
def forward(self):
|
||||
match self.angle:
|
||||
case 0:
|
||||
if self.pos[1] < self.grid.column - 1:
|
||||
self.pos[1] += 1
|
||||
case 90:
|
||||
if self.pos[0] > 0:
|
||||
self.pos[0] -= 1
|
||||
case 180:
|
||||
if self.pos[1] > 0:
|
||||
self.pos[1] -= 1
|
||||
case 270:
|
||||
if self.pos[0] < self.grid.row - 1:
|
||||
self.pos[0] += 1
|
||||
|
||||
self.set_pos()
|
|
@ -1,61 +0,0 @@
|
|||
import arcade
|
||||
|
||||
from importlib import resources
|
||||
|
||||
from jacovirt.bot.level import space as level
|
||||
|
||||
|
||||
class Tile(arcade.Sprite):
|
||||
"""
|
||||
Tile sprite
|
||||
"""
|
||||
def __init__(self, x, y, start_x, start_y, size=100, spacing=10, scale=0.5):
|
||||
self.pos = (x, y)
|
||||
|
||||
self.theme = level.get("theme")
|
||||
self.sprite = level.get(self.pos)
|
||||
|
||||
with resources.path("jacovirt", 'Img') as img_folder :
|
||||
self.image_file_name = f"{img_folder}/bot/{self.theme}/{self.sprite}.png"
|
||||
|
||||
self.size = size
|
||||
self.spacing = spacing
|
||||
|
||||
super().__init__(self.image_file_name, scale, hit_box_algorithm="None")
|
||||
self.position = (
|
||||
start_x + x * (self.size + self.spacing) + self.size / 2,
|
||||
start_y + y * (self.size + self.spacing) + self.size / 2
|
||||
)
|
||||
|
||||
def debug(self, size=10):
|
||||
arcade.draw_text(
|
||||
self.pos,
|
||||
self.left + self.spacing,
|
||||
self.bottom + self.spacing,
|
||||
arcade.color.RED,
|
||||
size,
|
||||
)
|
||||
|
||||
|
||||
class Grid():
|
||||
"""
|
||||
Grid object
|
||||
"""
|
||||
def __init__(self, x, y, row=6, column=6, size=100, spacing=10):
|
||||
self.row = row
|
||||
self.column = column
|
||||
self.pos = (x, y)
|
||||
self.tiles = arcade.SpriteList()
|
||||
|
||||
for r in range(row):
|
||||
for c in range(column):
|
||||
self.tiles.append(
|
||||
Tile(
|
||||
x=r,
|
||||
y=c,
|
||||
start_x=x,
|
||||
start_y=y,
|
||||
size=size,
|
||||
spacing=spacing
|
||||
)
|
||||
)
|
|
@ -1,79 +0,0 @@
|
|||
wooden = {
|
||||
"theme": "wooden",
|
||||
(0,0): "wave",
|
||||
(0,1): "castle",
|
||||
(0,2): "wave",
|
||||
(0,3): "tile_1",
|
||||
(0,4): "R",
|
||||
(0,5): "start",
|
||||
(1,0): "city",
|
||||
(1,1): "tile_6",
|
||||
(1,2): "tile_3",
|
||||
(1,3): "tile_2",
|
||||
(1,4): "tree",
|
||||
(1,5): "tile_1",
|
||||
(2,0): "wave",
|
||||
(2,1): "wave",
|
||||
(2,2): "mountain",
|
||||
(2,3): "tile_4",
|
||||
(2,4): "wave",
|
||||
(2,5): "G",
|
||||
(3,0): "B",
|
||||
(3,1): "tile_2",
|
||||
(3,2): "tile_4",
|
||||
(3,3): "Y",
|
||||
(3,4): "wave",
|
||||
(3,5): "tile_2",
|
||||
(4,0): "wave",
|
||||
(4,1): "P",
|
||||
(4,2): "tile_3",
|
||||
(4,3): "tile_1",
|
||||
(4,4): "tile_2",
|
||||
(4,5): "tile_5",
|
||||
(5,0): "wave",
|
||||
(5,1): "tile_1",
|
||||
(5,2): "wave",
|
||||
(5,3): "boat",
|
||||
(5,4): "tile_1",
|
||||
(5,5): "tile_4",
|
||||
}
|
||||
|
||||
space = {
|
||||
"theme": "space",
|
||||
(0,0): "tile_1",
|
||||
(0,1): "planet_5",
|
||||
(0,2): "tile_10",
|
||||
(0,3): "tile_9",
|
||||
(0,4): "planet_2",
|
||||
(0,5): "start",
|
||||
(1,0): "system",
|
||||
(1,1): "tile_8",
|
||||
(1,2): "tile_1",
|
||||
(1,3): "tile_11",
|
||||
(1,4): "crater",
|
||||
(1,5): "tile_1",
|
||||
(2,0): "tile_11",
|
||||
(2,1): "tile_3",
|
||||
(2,2): "volcano",
|
||||
(2,3): "meteor",
|
||||
(2,4): "satellite",
|
||||
(2,5): "planet_1",
|
||||
(3,0): "planet_4",
|
||||
(3,1): "tile_7",
|
||||
(3,2): "tile_10",
|
||||
(3,3): "planet_3",
|
||||
(3,4): "tile_2",
|
||||
(3,5): "tile_12",
|
||||
(4,0): "meteor",
|
||||
(4,1): "mountain",
|
||||
(4,2): "tile_1",
|
||||
(4,3): "tile_10",
|
||||
(4,4): "tile_13",
|
||||
(4,5): "meteor",
|
||||
(5,0): "tile_13",
|
||||
(5,1): "tile_6",
|
||||
(5,2): "tile_5",
|
||||
(5,3): "rocket",
|
||||
(5,4): "tile_4",
|
||||
(5,5): "tile_13",
|
||||
}
|
|
@ -1,79 +0,0 @@
|
|||
import arcade
|
||||
import jacovirt.logger
|
||||
import logging
|
||||
|
||||
from jacovirt.bot.grid import Grid
|
||||
from jacovirt.bot.bot import Bot
|
||||
|
||||
# Screen title and size
|
||||
SCREEN_TITLE = "JacoVirt Bot"
|
||||
SCREEN_WIDTH = int(1000)
|
||||
SCREEN_HEIGHT = int(1000)
|
||||
|
||||
# Window color
|
||||
BACKGROUND_COLOR = arcade.color.CATALINA_BLUE
|
||||
|
||||
COLUMN = 6
|
||||
ROW = 6
|
||||
TILE_SIZE = 100
|
||||
TILE_SPACING = 10
|
||||
X_START = (SCREEN_HEIGHT - (TILE_SIZE + TILE_SPACING) * ROW) / 2
|
||||
Y_START = (SCREEN_WIDTH - (TILE_SIZE + TILE_SPACING) * COLUMN) / 2
|
||||
|
||||
|
||||
class Window(arcade.Window):
|
||||
"""Main application class"""
|
||||
|
||||
def __init__(self):
|
||||
# Init parent class
|
||||
super().__init__(int(SCREEN_WIDTH), int(SCREEN_HEIGHT), SCREEN_TITLE)
|
||||
# Set background color
|
||||
arcade.set_background_color(BACKGROUND_COLOR)
|
||||
|
||||
self.grid = None
|
||||
self.bot = None
|
||||
|
||||
def setup(self):
|
||||
"""Set up the pad"""
|
||||
logging.info("Set up the bot.")
|
||||
|
||||
self.grid = Grid(X_START, Y_START, ROW, COLUMN, TILE_SIZE, TILE_SPACING)
|
||||
self.bot = Bot((0,5), self.grid)
|
||||
|
||||
def on_draw(self):
|
||||
"""Render the screen"""
|
||||
|
||||
# Clear the screen
|
||||
self.clear()
|
||||
|
||||
# Draw tiles
|
||||
self.grid.tiles.draw()
|
||||
|
||||
# If debug log level, draw info for tiles
|
||||
if logging.root.level <= logging.DEBUG:
|
||||
for tile in self.grid.tiles:
|
||||
tile.debug()
|
||||
|
||||
self.bot.draw()
|
||||
|
||||
def on_key_press(self, symbol, modifiers):
|
||||
"""Called when the user presses key"""
|
||||
if symbol == arcade.key.R:
|
||||
logging.info("Restart !")
|
||||
self.setup()
|
||||
|
||||
if symbol == arcade.key.Q:
|
||||
arcade.exit()
|
||||
|
||||
if symbol == arcade.key.LEFT:
|
||||
self.bot.left()
|
||||
if symbol == arcade.key.RIGHT:
|
||||
self.bot.right()
|
||||
if symbol == arcade.key.UP:
|
||||
self.bot.forward()
|
||||
|
||||
def main():
|
||||
"""Main method"""
|
||||
window = Window()
|
||||
window.setup()
|
||||
arcade.run()
|
|
@ -1,9 +0,0 @@
|
|||
from datetime import datetime
|
||||
from typing import Literal
|
||||
|
||||
from pydantic import BaseModel
|
||||
|
||||
class Instruction(BaseModel):
|
||||
move: Literal["FORWARD", "LEFT", "RIGHT"]
|
||||
timestamp: datetime
|
||||
source: str
|
|
@ -1,8 +0,0 @@
|
|||
import logging
|
||||
from rich.logging import RichHandler
|
||||
|
||||
# Set level INFO log for Arcade library
|
||||
logging.getLogger("arcade").setLevel(logging.INFO)
|
||||
|
||||
# Logger config
|
||||
logging.basicConfig(format="%(asctime)s %(levelname)s %(message)s", datefmt="%m/%d/%Y %H:%M:%S", handlers=[RichHandler()])
|
|
@ -1,54 +0,0 @@
|
|||
import arcade
|
||||
|
||||
class Tile(arcade.SpriteSolidColor):
|
||||
def __init__(self, x, y, start_x, start_y, size=100, spacing=10, scale=0.5, color=arcade.color.AMBER):
|
||||
|
||||
super().__init__(size, size, color=color)
|
||||
|
||||
self.size = size
|
||||
self.spacing = spacing
|
||||
|
||||
self.position = (
|
||||
start_x + x*(size + spacing),
|
||||
start_y - y*(size + spacing)
|
||||
)
|
||||
|
||||
|
||||
class Pad():
|
||||
def __init__(self, x, y, row=6, column=6, size=100, spacing=10):
|
||||
self.row = row
|
||||
self.column = column
|
||||
self.pos = (x, y)
|
||||
self.tiles = arcade.SpriteList()
|
||||
|
||||
for r in range(row):
|
||||
for c in range(column):
|
||||
self.tiles.append(
|
||||
Tile(
|
||||
x=c,
|
||||
y=r,
|
||||
start_x=x,
|
||||
start_y=y,
|
||||
size=size,
|
||||
spacing=spacing
|
||||
)
|
||||
)
|
||||
|
||||
def get_instructions(self, token_list):
|
||||
instructions = []
|
||||
if len(token_list) > 0:
|
||||
for tile in self.tiles:
|
||||
token, distance = arcade.get_closest_sprite(tile, token_list)
|
||||
if arcade.check_for_collision(token, tile):
|
||||
token_type = str(token.token_type)
|
||||
|
||||
if token_type == "forward":
|
||||
instructions.append("forward")
|
||||
|
||||
if token_type == "left":
|
||||
instructions.append("left")
|
||||
|
||||
if token_type == "right":
|
||||
instructions.append("right")
|
||||
|
||||
return instructions
|
|
@ -1,49 +0,0 @@
|
|||
import arcade
|
||||
from importlib import resources
|
||||
|
||||
|
||||
class Token(arcade.Sprite):
|
||||
""" Token sprite """
|
||||
|
||||
def __init__(self, token_type, scale=0.70):
|
||||
# Attributes for token type
|
||||
self.token_type = token_type
|
||||
|
||||
with resources.path("jacovirt", 'Img') as img_folder :
|
||||
self.image_file_name = f"{img_folder}/pad/token/{self.token_type}.png"
|
||||
|
||||
# Call the parent
|
||||
super().__init__(self.image_file_name, scale=scale, hit_box_algorithm="None")
|
||||
|
||||
|
||||
class Token_generator(arcade.Sprite):
|
||||
""" Token generator sprite """
|
||||
|
||||
def __init__(self, token_type, scale=1):
|
||||
# Attributes for token type
|
||||
self.type = token_type
|
||||
|
||||
self.image_file_name = ":resources:images/tiles/boxCrate_double.png"
|
||||
|
||||
self.tokens = arcade.SpriteList()
|
||||
|
||||
# Call the parent
|
||||
super().__init__(self.image_file_name, scale, hit_box_algorithm="None")
|
||||
|
||||
def create_token(self, x, y):
|
||||
# Create a token
|
||||
token = Token(self.type)
|
||||
token.position = x, y
|
||||
self.tokens.append(token)
|
||||
return token
|
||||
|
||||
def draw_tokens(self):
|
||||
self.tokens.draw()
|
||||
|
||||
|
||||
class Token_trash(arcade.SpriteSolidColor):
|
||||
def __init__(self, height, width, color=arcade.color.AMERICAN_ROSE):
|
||||
super().__init__(width, height, color)
|
||||
|
||||
def remove_token(self, held_token):
|
||||
held_token.remove_from_sprite_lists()
|
|
@ -1,233 +0,0 @@
|
|||
import arcade
|
||||
import jacovirt.logger
|
||||
import logging
|
||||
from jacovirt.pad.token import Token_generator, Token_trash
|
||||
from jacovirt.pad.pad import Pad
|
||||
|
||||
# Screen title and size
|
||||
SCREEN_TITLE = "Jaco Pad"
|
||||
SCREEN_WIDTH = int(1100)
|
||||
SCREEN_HEIGHT = int(1000)
|
||||
|
||||
# Window color
|
||||
BACKGROUND_COLOR = (133, 100, 100)
|
||||
|
||||
# Pad
|
||||
PAD_X_START = 600
|
||||
PAD_Y_START = 780
|
||||
PAD_ROW = 5
|
||||
PAD_COLUMN = 4
|
||||
TILE_SIZE = 125
|
||||
TILE_SPACING = 10
|
||||
|
||||
|
||||
class Window(arcade.Window):
|
||||
"""Main application class"""
|
||||
|
||||
def __init__(self):
|
||||
# Init parent class
|
||||
super().__init__(int(SCREEN_WIDTH), int(SCREEN_HEIGHT), SCREEN_TITLE)
|
||||
# Set background color
|
||||
arcade.set_background_color(BACKGROUND_COLOR)
|
||||
|
||||
# List of token generator
|
||||
self.tokens_generator = arcade.SpriteList()
|
||||
|
||||
# List of trash
|
||||
self.tokens_trash = arcade.SpriteList()
|
||||
|
||||
# The held token
|
||||
self.held_token = None
|
||||
|
||||
# List of tokens
|
||||
self.tokens = arcade.SpriteList()
|
||||
|
||||
self.pad = None
|
||||
|
||||
def setup(self):
|
||||
"""Set up the pad"""
|
||||
logging.debug("Set up the pad.")
|
||||
|
||||
# Create a camera
|
||||
self.camera = arcade.Camera()
|
||||
|
||||
# Create a token generator
|
||||
token_generator = Token_generator("forward", 1)
|
||||
token_generator.position = 100, 780
|
||||
self.tokens_generator.append(token_generator)
|
||||
|
||||
# Create a right token generator
|
||||
token_generator = Token_generator("right", 1)
|
||||
token_generator.position = 250, 780
|
||||
self.tokens_generator.append(token_generator)
|
||||
|
||||
# Create a left token generator
|
||||
token_generator = Token_generator("left", 1)
|
||||
token_generator.position = 400, 780
|
||||
self.tokens_generator.append(token_generator)
|
||||
|
||||
# Create a trash for token
|
||||
trash = Token_trash(150, 150)
|
||||
trash.position = 60, 60
|
||||
self.tokens_trash.append(trash)
|
||||
|
||||
# Setup the pad
|
||||
self.pad = Pad(PAD_X_START, PAD_Y_START, PAD_ROW, PAD_COLUMN, TILE_SIZE, TILE_SPACING)
|
||||
|
||||
def on_draw(self):
|
||||
"""Render the screen"""
|
||||
|
||||
# Clear the screen
|
||||
self.clear()
|
||||
|
||||
# Draw the pad
|
||||
self.pad.tiles.draw()
|
||||
|
||||
# Draw the token generator
|
||||
self.tokens_generator.draw()
|
||||
|
||||
# Draw the trash
|
||||
self.tokens_trash.draw()
|
||||
|
||||
# Draw the tokens
|
||||
self.tokens.draw()
|
||||
|
||||
self.camera.use()
|
||||
|
||||
def on_key_press(self, symbol, modifiers):
|
||||
"""Called when the user presses key"""
|
||||
logging.debug(f"User press {symbol}, {modifiers}")
|
||||
|
||||
if symbol == arcade.key.R:
|
||||
# Clear existing tokens and generators
|
||||
self.tokens = arcade.SpriteList()
|
||||
self.tokens_generator = arcade.SpriteList()
|
||||
|
||||
self.setup()
|
||||
logging.info("Restart")
|
||||
|
||||
if symbol == arcade.key.Q:
|
||||
arcade.exit()
|
||||
|
||||
if symbol == arcade.key.S:
|
||||
instruction = self.pad.get_instructions(self.tokens)
|
||||
logging.debug(f"Instruction : {instruction}")
|
||||
|
||||
if symbol == arcade.key.F:
|
||||
# When the user hits f. Flip between full and not full screen.
|
||||
if self.fullscreen:
|
||||
# If in fullscreen, switch to windowed mode
|
||||
self.set_fullscreen(False)
|
||||
|
||||
# Resize the camera to match the window size
|
||||
width, height = self.get_size()
|
||||
self.camera.resize(width, height)
|
||||
|
||||
# Reset camera position
|
||||
self.camera.move((0, 0))
|
||||
|
||||
else:
|
||||
# If not in fullscreen, switch to fullscreen mode
|
||||
|
||||
# Remember the previous window size
|
||||
last_width, last_height = self.get_size()
|
||||
|
||||
# Switch to fullscreen
|
||||
self.set_fullscreen(True)
|
||||
|
||||
# Adjust camera and window size for fullscreen
|
||||
width, height = self.get_size()
|
||||
self.camera.resize(width, height)
|
||||
|
||||
# Calculate the difference in center position between last window size and new fullscreen size
|
||||
self.x_fullscreen_diff = (last_width - width) / 2
|
||||
self.y_fullscreen_diff = (last_height - height) / 2
|
||||
|
||||
# Move camera to keep the same center point in the game
|
||||
self.camera.move((self.x_fullscreen_diff, self.y_fullscreen_diff))
|
||||
|
||||
|
||||
def on_mouse_press(self, x, y, button, key_modifiers):
|
||||
"""Called when the user presses a mouse button"""
|
||||
logging.debug(f"Mouse pressed at {x},{y}")
|
||||
|
||||
# If the game is in fullscreen mode, adjust mouse coordinates
|
||||
if self.fullscreen:
|
||||
x = x + self.x_fullscreen_diff
|
||||
y = y + self.y_fullscreen_diff
|
||||
logging.debug(f"Mouse pressed at {x}, {y} in the game window in full screen")
|
||||
|
||||
# Get list of tokens we've clicked on
|
||||
tokens = arcade.get_sprites_at_point((x, y), self.tokens)
|
||||
|
||||
# Have we clicked on a token?
|
||||
if len(tokens) > 0:
|
||||
# Might be a stack of tokens, get the top one
|
||||
primary_token = tokens[-1]
|
||||
|
||||
# All other tiles, grab the token we are clicking on
|
||||
self.held_token = primary_token
|
||||
self.held_token_original_position = self.held_token.position
|
||||
|
||||
return
|
||||
|
||||
# Get the list of generator we've clicked on
|
||||
generators = arcade.get_sprites_at_point((x, y), self.tokens_generator)
|
||||
|
||||
# Have we clicked on a generator ?
|
||||
if len(generators) > 0:
|
||||
generator = generators[-1]
|
||||
logging.debug(f"Cliced on the generator of {generator.type}")
|
||||
|
||||
# Create a token and take it
|
||||
self.held_token = generator.create_token(*generator.position)
|
||||
self.held_token_original_position = self.held_token.position
|
||||
self.tokens.append(self.held_token)
|
||||
|
||||
def on_mouse_release(self, x, y, button, modifiers):
|
||||
"""Called when the user presses a mouse button"""
|
||||
logging.debug(f"Mouse relase at {x},{y}")
|
||||
|
||||
if self.held_token is not None:
|
||||
# Find the closest trash
|
||||
trash, distance = arcade.get_closest_sprite(self.held_token, self.tokens_trash)
|
||||
|
||||
# See if we are in contact with the closest trash, if yes delete the held token
|
||||
if arcade.check_for_collision(self.held_token, trash):
|
||||
trash.remove_token(self.held_token)
|
||||
|
||||
reset_position = True
|
||||
|
||||
# Find the closest tile
|
||||
tile, distance = arcade.get_closest_sprite(self.held_token, self.pad.tiles)
|
||||
|
||||
# See if we are in contact with the closest tile
|
||||
if arcade.check_for_collision(self.held_token, tile):
|
||||
# Center the token
|
||||
self.held_token.position = tile.center_x, tile.center_y
|
||||
|
||||
# Success, don't reset position of tokens
|
||||
reset_position = False
|
||||
|
||||
if reset_position:
|
||||
# Where-ever we were dropped, it wasn't valid. Reset the each token's position
|
||||
# to its original spot.
|
||||
self.held_token.position = self.held_token_original_position
|
||||
|
||||
# Remove the token from the hand
|
||||
self.held_token = None
|
||||
|
||||
def on_mouse_motion(self, x: float, y: float, dx: float, dy: float):
|
||||
"""Called when the user moves the mouse"""
|
||||
|
||||
# If we are holding token, move it with the mouse
|
||||
if self.held_token != None:
|
||||
self.held_token.center_x += dx
|
||||
self.held_token.center_y += dy
|
||||
|
||||
|
||||
def main():
|
||||
"""Main method"""
|
||||
window = Window()
|
||||
window.setup()
|
||||
arcade.run()
|
|
@ -1,27 +0,0 @@
|
|||
[tool.poetry]
|
||||
name = "jacovirt"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = ["LPH"]
|
||||
readme = "README.md"
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
python = "^3.11"
|
||||
arcade = "^2.6.17"
|
||||
redis = "^5.0.3"
|
||||
pydantic = "^2.7.1"
|
||||
rich = "^13.7.1"
|
||||
|
||||
[tool.poetry.group.dev.dependencies]
|
||||
flake8 = "^7.0.0"
|
||||
pdbr = "^0.8.8"
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
|
||||
[tool.poetry.scripts]
|
||||
jacovirt = "jacovirt.args:main"
|
||||
|
||||
[[tool.poetry.include]]
|
||||
path = "jacovirt/jacovirt/Img/*"
|