Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

27 match sim timing to robot #36

Merged
merged 20 commits into from
Dec 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.stl filter=lfs diff=lfs merge=lfs -text
.step filter=lfs diff=lfs merge=lfs -text
.f3z filter=lfs diff=lfs merge=lfs -text
87 changes: 84 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,87 @@
default_language_version:
python: python3

repos:
- repo: https://gitlab.com/pycqa/flake8
rev: 3.7.9
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
# list of supported hooks: https://pre-commit.com/hooks.html
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-docstring-first
- id: check-yaml
- id: debug-statements
- id: detect-private-key
- id: check-executables-have-shebangs
- id: check-toml
- id: check-case-conflict
- id: check-added-large-files

# python code formatting
- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
args: [--line-length, "99"]

# python import sorting
- repo: https://github.com/PyCQA/isort
rev: 5.10.1
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]

# python upgrading syntax to newer version
- repo: https://github.com/asottile/pyupgrade
rev: v2.32.1
hooks:
- id: flake8
- id: pyupgrade
args: [--py38-plus]

# python docstring formatting
- repo: https://github.com/myint/docformatter
rev: v1.4
hooks:
- id: docformatter
args: [--in-place, --wrap-summaries=99, --wrap-descriptions=99]

# python check (PEP8), programming errors and code complexity
- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
args:
[
"--extend-ignore",
"E203,E402,E501,F401,F841",
"--exclude",
"logs/*,data/*",
]

# yaml formatting
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
- id: prettier
types: [yaml]

# # jupyter notebook cell output clearing
# - repo: https://github.com/kynan/nbstripout
# rev: 0.5.0
# hooks:
# - id: nbstripout

# # jupyter notebook linting
# - repo: https://github.com/nbQA-dev/nbQA
# rev: 1.4.0
# hooks:
# - id: nbqa-black
# args: ["--line-length=99"]
# - id: nbqa-isort
# args: ["--profile=black"]
# - id: nbqa-flake8
# args:
# [
# "--extend-ignore=E203,E402,E501,F401,F841",
# "--exclude=logs/*,data/*",
# ]
10 changes: 5 additions & 5 deletions furuta_gym/__init__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from gym.envs.registration import register
from gymnasium.envs.registration import register

register(
id='FurutaReal-v0',
entry_point='furuta_gym.envs:FurutaReal',
id="FurutaReal-v0",
entry_point="furuta_gym.envs:FurutaReal",
)
register(
id='FurutaSim-v0',
entry_point='furuta_gym.envs:FurutaSim',
id="FurutaSim-v0",
entry_point="furuta_gym.envs:FurutaSim",
)
16 changes: 16 additions & 0 deletions furuta_gym/algos.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import stable_baselines3


# wrapper class for stable-baselines3.SAC
# TODO can we make one class for all algos?
# check if they all have the train freq param
# check if they have other tuple args
# check if it would be cleaner for sb3 to accept list instead of tuple?
# TODO also does having the sb3 import means i need sb3 when importing from everywhere else in the package?
class SAC(stable_baselines3.SAC):
def __init__(self, **kwargs):
# sb3 expects tuple, omegaconf returns list
# so we need to convert kwarg train_freq from tuple to list
kwargs.update({"train_freq": tuple(kwargs["train_freq"])})

super().__init__(**kwargs)
6 changes: 3 additions & 3 deletions furuta_gym/envs/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
from furuta_gym.envs.furuta_base import FurutaBase # noqa F420
from furuta_gym.envs.furuta_real import FurutaReal # noqa F420
from furuta_gym.envs.furuta_sim import FurutaSim # noqa F420
# from furuta_gym.envs.furuta_base import FurutaBase # noqa F420
# from furuta_gym.envs.furuta_real import FurutaReal # noqa F420
# from furuta_gym.envs.furuta_sim import FurutaSim # noqa F420
Loading
Loading