diff --git a/robosuite/models/assets/demonstrations/lift/demo.hdf5 b/robosuite/models/assets/demonstrations/lift/demo.hdf5 new file mode 100644 index 0000000000..cb61411194 Binary files /dev/null and b/robosuite/models/assets/demonstrations/lift/demo.hdf5 differ diff --git a/robosuite/scripts/browse_mjcf_model.py b/robosuite/scripts/browse_mjcf_model.py index e8b55dfd32..02f87f6eda 100644 --- a/robosuite/scripts/browse_mjcf_model.py +++ b/robosuite/scripts/browse_mjcf_model.py @@ -3,15 +3,17 @@ Loads MJCF XML models from file and renders it on screen. Example: - $ python browse_arena_model.py --filepath ../models/assets/arenas/table_arena.xml + $ python browse_mjcf_model.py --filepath ../models/assets/arenas/table_arena.xml """ import argparse import os -from mujoco_py import MjSim, MjViewer, load_model_from_path +import mujoco import robosuite as suite +from robosuite.utils import OpenCVRenderer +from robosuite.utils.binding_utils import MjRenderContext, MjSim if __name__ == "__main__": @@ -21,9 +23,11 @@ parser.add_argument("--filepath", type=str, default=arena_file) args = parser.parse_args() - model = load_model_from_path(args.filepath) + model = mujoco.MjModel.from_xml_path(args.filepath) sim = MjSim(model) - viewer = MjViewer(sim) + render_context = MjRenderContext(sim) + sim.add_render_context(render_context) + viewer = OpenCVRenderer(sim) print("Press ESC to exit...") while True: diff --git a/robosuite/scripts/collect_human_demonstrations.py b/robosuite/scripts/collect_human_demonstrations.py index cd47782fb3..bce59432f8 100644 --- a/robosuite/scripts/collect_human_demonstrations.py +++ b/robosuite/scripts/collect_human_demonstrations.py @@ -1,9 +1,7 @@ """ -A script to collect a batch of human demonstrations that can be used -to generate a learning curriculum (see `demo_learning_curriculum.py`). +A script to collect a batch of human demonstrations. -The demonstrations can be played back using the `playback_demonstrations_from_pkl.py` -script. +The demonstrations can be played back using the `playback_demonstrations_from_hdf5.py` script. """ import argparse diff --git a/robosuite/scripts/compile_mjcf_model.py b/robosuite/scripts/compile_mjcf_model.py index b8037cb0fa..b5b9334a00 100644 --- a/robosuite/scripts/compile_mjcf_model.py +++ b/robosuite/scripts/compile_mjcf_model.py @@ -11,7 +11,7 @@ import sys from shutil import copyfile -from mujoco_py import load_model_from_path +import mujoco def print_usage(): @@ -31,7 +31,7 @@ def print_usage(): tempfile = os.path.join(input_folder, ".robosuite_temp_model.xml") copyfile(input_file, tempfile) - model = load_model_from_path(tempfile) + model = mujoco.MjModel.from_xml_path(tempfile) xml_string = model.get_xml() with open(output_file, "w") as f: f.write(xml_string) diff --git a/robosuite/scripts/playback_demonstrations_from_hdf5.py b/robosuite/scripts/playback_demonstrations_from_hdf5.py index ad375e59fc..0decbd1b6e 100644 --- a/robosuite/scripts/playback_demonstrations_from_hdf5.py +++ b/robosuite/scripts/playback_demonstrations_from_hdf5.py @@ -10,7 +10,7 @@ --visualize-gripper (optional): If set, will visualize the gripper site Example: - $ python playback_demonstrations_from_hdf5.py --folder ../models/assets/demonstrations/SawyerPickPlace/ + $ python playback_demonstrations_from_hdf5.py --folder ../models/assets/demonstrations/lift/ """ import argparse @@ -59,7 +59,7 @@ while True: print("Playing back random episode... (press ESC to quit)") - # # select an episode randomly + # select an episode randomly ep = random.choice(demos) # read the model xml, using the metadata stored in the attribute for this episode diff --git a/robosuite/scripts/tune_joints.py b/robosuite/scripts/tune_joints.py index 47f162e3bf..09dedbd5fb 100644 --- a/robosuite/scripts/tune_joints.py +++ b/robosuite/scripts/tune_joints.py @@ -180,7 +180,7 @@ def _toggle_arm(self): Toggle between arms in the environment to set as current active arm """ if isinstance(self.active_robot, SingleArm): - self.active_robot_num = (self.active_robot_num + 1) // self.num_robots + self.active_robot_num = (self.active_robot_num + 1) % self.num_robots robot = self.active_robot_num else: # Bimanual case self.active_arm = "left" if self.active_arm == "right" else "right"