From 912694850c304c9b18cdae02d1e1607c6d27fa56 Mon Sep 17 00:00:00 2001 From: Benjamin Bolte Date: Tue, 14 May 2024 22:15:17 -0700 Subject: [PATCH] slight tweaks --- sim/scripts/create_fixed_torso.py | 3 ++- sim/scripts/create_mjcf.py | 2 +- sim/scripts/simulate_mjcf.py | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/sim/scripts/create_fixed_torso.py b/sim/scripts/create_fixed_torso.py index d751f70e..0fa0be87 100644 --- a/sim/scripts/create_fixed_torso.py +++ b/sim/scripts/create_fixed_torso.py @@ -2,12 +2,13 @@ """This script updates the URDF file to fix the joints of the robot.""" import xml.etree.ElementTree as ET + from sim.stompy.joints import StompyFixed STOMPY_URDF = "stompy/robot.urdf" -def update_urdf(): +def update_urdf() -> None: tree = ET.parse(STOMPY_URDF) root = tree.getroot() stompy = StompyFixed() diff --git a/sim/scripts/create_mjcf.py b/sim/scripts/create_mjcf.py index 2317a20f..4571a627 100644 --- a/sim/scripts/create_mjcf.py +++ b/sim/scripts/create_mjcf.py @@ -6,7 +6,7 @@ import mujoco -def create_mjcf(): +def create_mjcf() -> None: model_xml = mujoco.MjModel.from_xml_path(os.path.join(os.getenv("MODEL_DIR"), "robot.urdf")) mujoco.mj_saveLastXML(os.path.join(os.getenv("MODEL_DIR"), "robot.xml"), model_xml) diff --git a/sim/scripts/simulate_mjcf.py b/sim/scripts/simulate_mjcf.py index 7480ade6..bab4ce8c 100644 --- a/sim/scripts/simulate_mjcf.py +++ b/sim/scripts/simulate_mjcf.py @@ -4,13 +4,14 @@ Run with mjpython: mjpython mjpython sim/scripts/simulate_mjcf.py """ + import time + import mujoco import mujoco.viewer from sim.env import stompy_mjcf_path - model = mujoco.MjModel.from_xml_path(stompy_mjcf_path()) data = mujoco.MjData(model)