Skip to content

Commit

Permalink
chore: Update XML path for reach_cube_env and mujoco_simple_invk and …
Browse files Browse the repository at this point in the history
…mujoco_interactive_simulation
  • Loading branch information
perezjln committed Jun 16, 2024
1 parent 804cdff commit 2757da6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions examples/gym_manipulation.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
from gym_lowcostrobot.envs.push_cube_env import PushCubeEnv
import gymnasium as gym
import gym_lowcostrobot


def do_env_sim():
env = PushCubeEnv(render_mode="human", action_mode="ee")
env = gym.make("PushCube-v0", observation_mode="state", render_mode="human", action_mode="ee")
env.reset()

max_step = 1000000
Expand Down
5 changes: 3 additions & 2 deletions examples/gym_manipulation_sb3.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import gymnasium as gym
import gym_lowcostrobot
import torch
from gymnasium.wrappers.filter_observation import FilterObservation
from gymnasium.wrappers.flatten_observation import FlattenObservation
Expand All @@ -23,7 +24,7 @@ def do_td3_push():

def make_env():
env = gym.make("PushCube-v0", observation_mode="state", render_mode=None)
env = FilterObservation(env, ["arm_qpos", "object_qpos", "target_qpos"])
env = FilterObservation(env, ["arm_qpos", "cube_pos", "target_pos"])
env = FlattenObservation(env)
return env

Expand All @@ -38,7 +39,7 @@ def do_ppo_push(device="cpu", render=True):

# Evaluate the agent
env_test = gym.make("PushCube-v0", observation_mode="state", render_mode=None)
env_test = FilterObservation(env_test, ["arm_qpos", "object_qpos", "target_qpos"])
env_test = FilterObservation(env_test, ["arm_qpos", "cube_pos", "target_pos"])
env_test = FlattenObservation(env_test)
mean_reward, std_reward = evaluate_policy(model, env_test, n_eval_episodes=10, render=render)
print(f"Mean reward: {mean_reward} +/- {std_reward}")
Expand Down
2 changes: 1 addition & 1 deletion examples/mujoco_interactive_simulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

def do_interactive_sim(robot_id):
if robot_id == "6dof":
m = mujoco.MjModel.from_xml_path("gym_lowcostrobot/assets/low_cost_robot_6dof/scene_one_cube.xml")
m = mujoco.MjModel.from_xml_path("gym_lowcostrobot/assets/low_cost_robot_6dof/reach_cube.xml")

data = mujoco.MjData(m)

Expand Down

0 comments on commit 2757da6

Please sign in to comment.