Skip to content

Commit

Permalink
format
Browse files Browse the repository at this point in the history
  • Loading branch information
qgallouedec committed May 19, 2024
1 parent d6dacd5 commit 8b234be
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 21 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,22 +11,22 @@ https://github.com/perezjln/envs-lowcostrobot/assets/5373778/de8c6448-1ece-4823-

## Installation

```
```sh
cd gym-lowcostrobot
pip install .
```

## Test

```
```sh
pip install pytest
pytest
```

## Format

```
```sh
pip install ruff
ruff format gym_lowcostrobot examples tests setup.py --line-length 119
isort -l 119 .
isort -l 119 gym_lowcostrobot examples tests setup.py
```
1 change: 1 addition & 0 deletions examples/gym_manipulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,6 @@ def do_env_sim():
)
env.reset()


if __name__ == "__main__":
do_env_sim()
1 change: 1 addition & 0 deletions examples/gym_manipulation_img_multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ def do_env_sim_image():

env.render()


if __name__ == "__main__":
do_env_sim_image()
4 changes: 1 addition & 3 deletions examples/mujoco_ctrl_range.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import mujoco
import numpy as np


if __name__ == "__main__":

# Load the model from the XML file
model = mujoco.MjModel.from_xml_path("assets/scene_one_cube.xml")

Expand All @@ -13,4 +11,4 @@

# Print the control ranges
for i, (lower, upper) in enumerate(control_ranges):
print(f"Actuator {i} control range: lower = {lower}, upper = {upper}")
print(f"Actuator {i} control range: lower = {lower}, upper = {upper}")
2 changes: 1 addition & 1 deletion examples/mujoco_simple_invk.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import time
import numpy as np

import mujoco
import mujoco.viewer
import numpy as np

from gym_lowcostrobot.simulated_robot import SimulatedRobot

Expand Down
3 changes: 2 additions & 1 deletion examples/simple.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import gym_lowcostrobot
import gymnasium as gym

import gym_lowcostrobot

env = gym.make("ReachCube-v0")

# env.reset()
Expand Down
5 changes: 1 addition & 4 deletions gym_lowcostrobot/envs/base_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@


class BaseEnv(gym.Env):
metadata = {"render_modes": ["human", "rgb_array"],
"render_fps": 4,
"image_state": ["single", "multi"]}
metadata = {"render_modes": ["human", "rgb_array"], "render_fps": 4, "image_state": ["single", "multi"]}

def __init__(
self,
Expand Down Expand Up @@ -104,7 +102,6 @@ def base_step_action_withgrasp(self, action):
self.current_step += 1

def get_info(self):

if self.image_state == "single":
self.renderer.update_scene(self.data)
img = self.renderer.render()
Expand Down
2 changes: 1 addition & 1 deletion gym_lowcostrobot/envs/lift_cube_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def __init__(self, image_state=None, action_mode="joint", render_mode=None):
xml_path="assets/scene_one_cube.xml",
image_state=image_state,
action_mode=action_mode,
render_mode=render_mode
render_mode=render_mode,
)

# Define the action space and observation space
Expand Down
5 changes: 2 additions & 3 deletions gym_lowcostrobot/envs/pick_place_cube_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, image_state=None, action_mode="joint", render_mode=None):
xml_path="assets/scene_one_cube.xml",
image_state=image_state,
action_mode=action_mode,
render_mode=render_mode
render_mode=render_mode,
)

# Define the action space and observation space
Expand Down Expand Up @@ -52,9 +52,8 @@ def reset(self, seed=None, options=None):
self.step_start = time.time()

self.current_step = 0

info = self.get_info()

info = self.get_info()

return self.get_observation(), info

Expand Down
2 changes: 1 addition & 1 deletion gym_lowcostrobot/envs/push_cube_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, image_state=None, action_mode="joint", render_mode=None):
xml_path="assets/scene_one_cube.xml",
image_state=image_state,
action_mode=action_mode,
render_mode=render_mode
render_mode=render_mode,
)

# Define the action space and observation space
Expand Down
4 changes: 2 additions & 2 deletions gym_lowcostrobot/envs/reach_cube_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@


class ReachCubeEnv(BaseRobotEnv):
def __init__(self, image_state=False,action_mode="joint", render_mode=None):
def __init__(self, image_state=False, action_mode="joint", render_mode=None):
super().__init__(
xml_path="assets/scene_one_cube.xml",
image_state=image_state,
action_mode=action_mode,
render_mode=render_mode
render_mode=render_mode,
)

# Define the action space and observation space
Expand Down
2 changes: 1 addition & 1 deletion gym_lowcostrobot/envs/stack_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self, image_state=None, action_mode="joint", render_mode=None):
xml_path="assets/scene_two_cubes.xml",
image_state=image_state,
action_mode=action_mode,
render_mode=render_mode
render_mode=render_mode,
)

# Define the action space and observation space
Expand Down

0 comments on commit 8b234be

Please sign in to comment.