move mujoco to examples (#12)
* move mujoco to examples * fix the import mujoco bug * flake8 * flake8 * rm __init__.py
This commit is contained in:
parent
4f843d3f51
commit
0b08a41610
0
examples/mujoco/__init__.py
Normal file
0
examples/mujoco/__init__.py
Normal file
27
examples/mujoco/register.py
Normal file
27
examples/mujoco/register.py
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
from gym.envs.registration import register
|
||||||
|
|
||||||
|
|
||||||
|
def reg():
|
||||||
|
register(
|
||||||
|
id='PointMaze-v0',
|
||||||
|
entry_point='mujoco.point_maze_env:PointMazeEnv',
|
||||||
|
kwargs={
|
||||||
|
"maze_size_scaling": 4,
|
||||||
|
"maze_id": "Maze2",
|
||||||
|
"maze_height": 0.5,
|
||||||
|
"manual_collision": True,
|
||||||
|
"goal": (1, 3),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
register(
|
||||||
|
id='PointMaze-v1',
|
||||||
|
entry_point='mujoco.point_maze_env:PointMazeEnv',
|
||||||
|
kwargs={
|
||||||
|
"maze_size_scaling": 2,
|
||||||
|
"maze_id": "Maze2",
|
||||||
|
"maze_height": 0.5,
|
||||||
|
"manual_collision": True,
|
||||||
|
"goal": (1, 3),
|
||||||
|
}
|
||||||
|
)
|
@ -10,6 +10,7 @@ from tianshou.trainer import offpolicy_trainer
|
|||||||
from tianshou.data import Collector, ReplayBuffer
|
from tianshou.data import Collector, ReplayBuffer
|
||||||
from tianshou.env import VectorEnv, SubprocVectorEnv
|
from tianshou.env import VectorEnv, SubprocVectorEnv
|
||||||
from continuous_net import Actor, Critic
|
from continuous_net import Actor, Critic
|
||||||
|
from mujoco.register import reg
|
||||||
|
|
||||||
|
|
||||||
def get_args():
|
def get_args():
|
||||||
@ -44,6 +45,7 @@ def get_args():
|
|||||||
|
|
||||||
|
|
||||||
def test_td3(args=get_args()):
|
def test_td3(args=get_args()):
|
||||||
|
reg()
|
||||||
env = gym.make(args.task)
|
env = gym.make(args.task)
|
||||||
args.state_shape = env.observation_space.shape or env.observation_space.n
|
args.state_shape = env.observation_space.shape or env.observation_space.n
|
||||||
args.action_shape = env.action_space.shape or env.action_space.n
|
args.action_shape = env.action_space.shape or env.action_space.n
|
||||||
|
2
tianshou/env/__init__.py
vendored
2
tianshou/env/__init__.py
vendored
@ -2,10 +2,8 @@ from tianshou.env.utils import CloudpickleWrapper
|
|||||||
from tianshou.env.common import EnvWrapper, FrameStack
|
from tianshou.env.common import EnvWrapper, FrameStack
|
||||||
from tianshou.env.vecenv import BaseVectorEnv, VectorEnv, \
|
from tianshou.env.vecenv import BaseVectorEnv, VectorEnv, \
|
||||||
SubprocVectorEnv, RayVectorEnv
|
SubprocVectorEnv, RayVectorEnv
|
||||||
from tianshou.env import mujoco
|
|
||||||
|
|
||||||
__all__ = [
|
__all__ = [
|
||||||
'mujoco',
|
|
||||||
'EnvWrapper',
|
'EnvWrapper',
|
||||||
'FrameStack',
|
'FrameStack',
|
||||||
'BaseVectorEnv',
|
'BaseVectorEnv',
|
||||||
|
25
tianshou/env/mujoco/__init__.py
vendored
25
tianshou/env/mujoco/__init__.py
vendored
@ -1,25 +0,0 @@
|
|||||||
from gym.envs.registration import register
|
|
||||||
|
|
||||||
register(
|
|
||||||
id='PointMaze-v0',
|
|
||||||
entry_point='tianshou.env.mujoco.point_maze_env:PointMazeEnv',
|
|
||||||
kwargs={
|
|
||||||
"maze_size_scaling": 4,
|
|
||||||
"maze_id": "Maze2",
|
|
||||||
"maze_height": 0.5,
|
|
||||||
"manual_collision": True,
|
|
||||||
"goal": (1, 3),
|
|
||||||
}
|
|
||||||
)
|
|
||||||
|
|
||||||
register(
|
|
||||||
id='PointMaze-v1',
|
|
||||||
entry_point='tianshou.env.mujoco.point_maze_env:PointMazeEnv',
|
|
||||||
kwargs={
|
|
||||||
"maze_size_scaling": 2,
|
|
||||||
"maze_id": "Maze2",
|
|
||||||
"maze_height": 0.5,
|
|
||||||
"manual_collision": True,
|
|
||||||
"goal": (1, 3),
|
|
||||||
}
|
|
||||||
)
|
|
Loading…
x
Reference in New Issue
Block a user