Fix: 모터의 갯수를 6개로 수정
Browse files
env.py
CHANGED
|
@@ -27,22 +27,22 @@ class SO101SimEnv(gym.Env):
|
|
| 27 |
self.render_mode = render_mode
|
| 28 |
self.viewer = None
|
| 29 |
|
| 30 |
-
#
|
| 31 |
self.action_space = gym.spaces.Box(
|
| 32 |
-
low=-1.0, high=1.0, shape=(
|
| 33 |
)
|
| 34 |
-
#
|
| 35 |
self.observation_space = gym.spaces.Box(
|
| 36 |
-
low=-np.inf, high=np.inf, shape=(
|
| 37 |
)
|
| 38 |
|
| 39 |
def _get_obs(self):
|
| 40 |
-
return np.concatenate([self.data.qpos[:
|
| 41 |
np.float32
|
| 42 |
)
|
| 43 |
|
| 44 |
def step(self, action):
|
| 45 |
-
self.data.ctrl[:
|
| 46 |
mujoco.mj_step(self.model, self.data)
|
| 47 |
if self.render_mode == "human":
|
| 48 |
self.render()
|
|
|
|
| 27 |
self.render_mode = render_mode
|
| 28 |
self.viewer = None
|
| 29 |
|
| 30 |
+
# 6개 모터
|
| 31 |
self.action_space = gym.spaces.Box(
|
| 32 |
+
low=-1.0, high=1.0, shape=(6,), dtype=np.float32
|
| 33 |
)
|
| 34 |
+
# 12개 상태 (6개 관절 각도 + 6개 관절 속도)
|
| 35 |
self.observation_space = gym.spaces.Box(
|
| 36 |
+
low=-np.inf, high=np.inf, shape=(12,), dtype=np.float32
|
| 37 |
)
|
| 38 |
|
| 39 |
def _get_obs(self):
|
| 40 |
+
return np.concatenate([self.data.qpos[:6], self.data.qvel[:6]]).astype(
|
| 41 |
np.float32
|
| 42 |
)
|
| 43 |
|
| 44 |
def step(self, action):
|
| 45 |
+
self.data.ctrl[:6] = action
|
| 46 |
mujoco.mj_step(self.model, self.data)
|
| 47 |
if self.render_mode == "human":
|
| 48 |
self.render()
|