Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
KincoActuatorIsaacLab
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
kevin
KincoActuatorIsaacLab
Commits
a972182b
Commit
a972182b
authored
Oct 11, 2024
by
Mayank Mittal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes formatting issues in the robot loading benchmark script
parent
92dcb8c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
benchmark_load_robot.py
source/standalone/benchmarks/benchmark_load_robot.py
+8
-11
No files found.
source/standalone/benchmarks/benchmark_load_robot.py
View file @
a972182b
...
@@ -22,9 +22,9 @@ from omni.isaac.lab.app import AppLauncher
...
@@ -22,9 +22,9 @@ from omni.isaac.lab.app import AppLauncher
parser
=
argparse
.
ArgumentParser
(
description
=
"Benchmark loading different robots."
)
parser
=
argparse
.
ArgumentParser
(
description
=
"Benchmark loading different robots."
)
parser
.
add_argument
(
"--num_envs"
,
type
=
int
,
default
=
32
,
help
=
"Number of robots to simulate."
)
parser
.
add_argument
(
"--num_envs"
,
type
=
int
,
default
=
32
,
help
=
"Number of robots to simulate."
)
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,11 +131,9 @@ def run_simulator(sim: sim_utils.SimulationContext, scene: InteractiveScene):
...
@@ -132,11 +131,9 @@ 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
)
# Stop the timer for reset
# Stop the timer for reset
step_time_end
=
time
.
perf_counter_ns
()
step_time_end
=
time
.
perf_counter_ns
()
print
(
f
"[INFO]: Per step time: {(step_time_end - step_time_begin) / num_steps / 1e6:.2f} ms"
)
print
(
f
"[INFO]: Per step time: {(step_time_end - step_time_begin) / num_steps / 1e6:.2f} ms"
)
...
@@ -149,7 +146,7 @@ def main():
...
@@ -149,7 +146,7 @@ def main():
sim
=
SimulationContext
(
sim_cfg
)
sim
=
SimulationContext
(
sim_cfg
)
# Set main camera
# Set main camera
sim
.
set_camera_view
([
2.5
,
0.0
,
4.0
],
[
0.0
,
0.0
,
2.0
])
sim
.
set_camera_view
([
2.5
,
0.0
,
4.0
],
[
0.0
,
0.0
,
2.0
])
# Start the timer for creating the scene
# Start the timer for creating the scene
setup_time_begin
=
time
.
perf_counter_ns
()
setup_time_begin
=
time
.
perf_counter_ns
()
# Design scene
# Design scene
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment