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
parser.add_argument(
"--robot",
type=str,
choices=['anymal_d', 'h1', 'g1'],
choices=["anymal_d", "h1", "g1"],
default="h1",
help="Choose which robot to load: anymal_d, h1, or g1.",
)
......@@ -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")
@configclass
class RobotSceneCfg(InteractiveSceneCfg):
"""Configuration for a simple scene with a robot."""
......@@ -91,6 +92,7 @@ class RobotSceneCfg(InteractiveSceneCfg):
else:
raise ValueError(f"Unsupported robot type: {args_cli.robot}.")
def run_simulator(sim: sim_utils.SimulationContext, scene: InteractiveScene):
"""Runs the simulation loop."""
# Extract scene entities
......@@ -98,18 +100,15 @@ def run_simulator(sim: sim_utils.SimulationContext, scene: InteractiveScene):
robot = scene["robot"]
# Define simulation stepping
sim_dt = sim.get_physics_dt()
count = 0
# Start the timer for creating the scene
step_time_begin = time.perf_counter_ns()
num_steps = 2000
# Simulation loop
for _ in range(num_steps):
for count in range(num_steps):
# Reset
if count % 500 == 0:
# reset counter
count = 0
# reset the scene entities
# root state
# 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):
scene.write_data_to_sim()
# Perform step
sim.step()
# Increment counter
count += 1
# Update buffers
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