-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_scene.py
More file actions
76 lines (63 loc) · 2.32 KB
/
run_scene.py
File metadata and controls
76 lines (63 loc) · 2.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
from scripts.isaac.scene import Scene
from scripts.utils import get_display_options_code
# import rclpy
def main(args=None):
# Get desired display options code
display_options = get_display_options_code(
fps=True,
axis=True,
layer=True,
resolution=False,
timeline=False,
camera=False,
grid=False,
selection_outline=True,
light=False,
skeleton=False,
mesh=True,
path_tracing_results=False,
audio=False,
device_memory=True,
host_memory=True,
)
# Create basic scene, which also creates and starts the SimulationApp.
scene = Scene(
display_options=display_options,
data_root="/isaac-sim/project/data",
scripts_root="/isaac-sim/scripts",
omniverse_assets_root="http://omniverse-content-production.s3-us-west-2.amazonaws.com",
add_ground_plane=True,
add_default_light=True,
config_filename="simulation_app_config.json",
)
# Import everything Omniverse related except for the SimulationApp (in this case the Scene) here (after
# SimulationApp initialized)
import omni.isaac.core
# Potentially enable some extensions, for instance the animation timeline at the bottom of the application window.
omni.isaac.core.utils.extensions.enable_extension("omni.anim.window.timeline")
# If you need a ros node:
# rclpy.init()
# my_node = MyNode()
# Optionally reset the world, which stops and restarts the simulation. Otherwise the simulation will be stopped
# until the "Play" button is pressed.
# scene.world.reset()
step_counter = 0
while scene.simulation.is_running():
scene.world.step(render=True)
step_counter += 1
# If there is a ros node, spin here
# rclpy.spin_once(my_node, tieout_sec=0.001)
if scene.world.is_playing():
if step_counter == 1:
...
# Do stuff that needs to be done after play is pressed, before other stuff happens. This usually means
# initializing articulations or sensors.
elif step_counter > 1:
...
# Do actual stuff.
else:
step_counter = 0
# my_node.destroy_node()
scene.simulation.close()
if __name__ == "__main__":
main()