In order to use the Mujoco model for reinforcement learning, it is necessary to create a Python environment of the model.
The environment and therefore the model can be used like this:
import gym
import HexapodEnvironment
import time
env = gym.make('Hexapod-v0')
obs = env.reset()
obs_dim = env.observation_space.shape[0]
act_dim = env.action_space.shape[0]
for i in range(500):
env.render()
action = np.array([0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0, 1.0])
action = action.reshape((1,-1)).astype(np.float32)
obs, reward, done, info = env.step(np.squeeze(action, axis=0))
time.sleep(.2)
Problems with Mujoco
- No collision detection
- Poor documentation -> No tutorials. Examples do not cover all elements (e.g. Sensors).