Skip to content

Commit

Permalink
Merge pull request #36 from Armandpl/27-match-sim-timing-to-robot
Browse files Browse the repository at this point in the history
27 match sim timing to robot
  • Loading branch information
Armandpl authored Dec 2, 2023
2 parents 939a962 + a634f4a commit 26421e9
Show file tree
Hide file tree
Showing 20 changed files with 730 additions and 217 deletions.
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

0 comments on commit 26421e9

Please sign in to comment.