Commit a972182b authored by Mayank Mittal's avatar Mayank Mittal

Fixes formatting issues in the robot loading benchmark script

parent 92dcb8c0
...@@ -24,7 +24,7 @@ parser.add_argument("--num_envs", type=int, default=32, help="Number of robots t ...@@ -24,7 +24,7 @@ parser.add_argument("--num_envs", type=int, default=32, help="Number of robots t
parser.add_argument( parser.add_argument(
"--robot", "--robot",
type=str, type=str,
choices=['anymal_d', 'h1', 'g1'], choices=["anymal_d", "h1", "g1"],
default="h1", default="h1",
help="Choose which robot to load: anymal_d, h1, or g1.", help="Choose which robot to load: anymal_d, h1, or g1.",
) )
...@@ -69,6 +69,7 @@ imports_time_end = time.perf_counter_ns() ...@@ -69,6 +69,7 @@ imports_time_end = time.perf_counter_ns()
print(f"[INFO]: Imports time: {(imports_time_end - imports_time_begin) / 1e6:.2f} ms") print(f"[INFO]: Imports time: {(imports_time_end - imports_time_begin) / 1e6:.2f} ms")
@configclass @configclass
class RobotSceneCfg(InteractiveSceneCfg): class RobotSceneCfg(InteractiveSceneCfg):
"""Configuration for a simple scene with a robot.""" """Configuration for a simple scene with a robot."""
...@@ -91,6 +92,7 @@ class RobotSceneCfg(InteractiveSceneCfg): ...@@ -91,6 +92,7 @@ class RobotSceneCfg(InteractiveSceneCfg):
else: else:
raise ValueError(f"Unsupported robot type: {args_cli.robot}.") raise ValueError(f"Unsupported robot type: {args_cli.robot}.")
def run_simulator(sim: sim_utils.SimulationContext, scene: InteractiveScene): def run_simulator(sim: sim_utils.SimulationContext, scene: InteractiveScene):
"""Runs the simulation loop.""" """Runs the simulation loop."""
# Extract scene entities # Extract scene entities
...@@ -98,18 +100,15 @@ def run_simulator(sim: sim_utils.SimulationContext, scene: InteractiveScene): ...@@ -98,18 +100,15 @@ def run_simulator(sim: sim_utils.SimulationContext, scene: InteractiveScene):
robot = scene["robot"] robot = scene["robot"]
# Define simulation stepping # Define simulation stepping
sim_dt = sim.get_physics_dt() sim_dt = sim.get_physics_dt()
count = 0
# Start the timer for creating the scene # Start the timer for creating the scene
step_time_begin = time.perf_counter_ns() step_time_begin = time.perf_counter_ns()
num_steps = 2000 num_steps = 2000
# Simulation loop # Simulation loop
for _ in range(num_steps): for count in range(num_steps):
# Reset # Reset
if count % 500 == 0: if count % 500 == 0:
# reset counter
count = 0
# reset the scene entities # reset the scene entities
# root state # root state
# we offset the root state by the origin since the states are written in simulation world frame # we offset the root state by the origin since the states are written in simulation world frame
...@@ -132,8 +131,6 @@ def run_simulator(sim: sim_utils.SimulationContext, scene: InteractiveScene): ...@@ -132,8 +131,6 @@ def run_simulator(sim: sim_utils.SimulationContext, scene: InteractiveScene):
scene.write_data_to_sim() scene.write_data_to_sim()
# Perform step # Perform step
sim.step() sim.step()
# Increment counter
count += 1
# Update buffers # Update buffers
scene.update(sim_dt) scene.update(sim_dt)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment