Skip to content

Commit 0a50de1

Browse files
committed
Bug Fixes, Add Isaac Sim 4.5 support for examples
1 parent 2fbffc3 commit 0a50de1

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+727
-192
lines changed

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,20 @@ its affiliates is strictly prohibited.
1010
-->
1111
# Changelog
1212

13+
## Version 0.7.7
14+
15+
### New Features
16+
- Add cpu support for types.math.Pose
17+
- Add cdist fallback for robot segmentation when triton is not available. Requires half the memory.
18+
19+
### BugFixes & Misc.
20+
- Fix bug in LBFGS where buffers were not reinitialized upon change in history.
21+
- Isaac Sim 4.5 support for examples. All but one example works now. ``load_all_robots.py`` does
22+
not work correctly.
23+
- Fix bug in jerk gradient calculation. Improves convergence in trajectory optimization. Multi-arm
24+
reacher is slightly improved (see isaac sim example).
25+
26+
1327
## Version 0.7.6
1428

1529
### Changes in Default Behavior

docker/start_dev_docker.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ if [ $input_arg == "x86" ]; then
4141
--env DISPLAY=unix$DISPLAY \
4242
--volume /tmp/.X11-unix:/tmp/.X11-unix \
4343
--volume /dev:/dev \
44+
--ipc=host \
4445
curobo_docker:user_$input_arg
4546

4647
elif [ $input_arg == "aarch64" ]; then
@@ -60,7 +61,7 @@ elif [ $input_arg == "aarch64" ]; then
6061
curobo_docker:user_$input_arg
6162

6263
elif [[ $input_arg == *isaac_sim* ]] ; then
63-
echo "Isaac Sim Dev Docker is not supported"
64+
echo "Isaac Sim Dev Docker is not supported"
6465

6566
mkdir -p ~/docker/isaac-sim ~/docker/isaac-sim/cache/kit \
6667
~/docker/isaac-sim/cache/ov \
@@ -70,7 +71,7 @@ elif [[ $input_arg == *isaac_sim* ]] ; then
7071
~/docker/isaac-sim/logs \
7172
~/docker/isaac-sim/data \
7273
~/docker/isaac-sim/documents
73-
74+
7475

7576

7677
docker run --name container_$input_arg -it --gpus all -e "ACCEPT_EULA=Y" --rm --network=host \
@@ -89,7 +90,7 @@ elif [[ $input_arg == *isaac_sim* ]] ; then
8990
--volume /dev:/dev \
9091
--mount type=bind,src=/home/$USER/code,target=/home/$USER/code \
9192
curobo_docker:user_$input_arg
92-
93+
9394

9495
else
9596
echo "Unknown docker"

examples/collision_check_example.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@
88
# without an express license agreement from NVIDIA CORPORATION or
99
# its affiliates is strictly prohibited.
1010
#
11-
""" Example computing collisions using curobo
12-
13-
"""
11+
"""Example computing collisions using curobo"""
1412
# Third Party
1513
import torch
1614

examples/isaac_sim/batch_collision_checker.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,13 @@
5151
import numpy as np
5252
from helper import add_extensions
5353
from omni.isaac.core import World
54-
from omni.isaac.core.materials import OmniPBR
54+
55+
try:
56+
from omni.isaac.core.materials import OmniPBR
57+
except ImportError:
58+
from isaacsim.core.api.materials import OmniPBR
59+
60+
5561
from omni.isaac.core.objects import sphere
5662

5763
# CuRobo

examples/isaac_sim/batch_motion_gen_reacher.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,9 +126,11 @@ def main():
126126
"/World/world_" + str(i) + "/",
127127
robot_name="robot_" + str(i),
128128
position=pose.position[0].cpu().numpy(),
129+
initialize_world=False,
129130
)
130131
robot_list.append(r[0])
131132
setup_curobo_logger("warn")
133+
my_world.initialize_physics()
132134

133135
# warmup curobo instance
134136

@@ -195,9 +197,10 @@ def main():
195197
continue
196198
step_index = my_world.current_time_step_index
197199

198-
if step_index <= 2:
199-
my_world.reset()
200+
if step_index <= 10:
201+
# my_world.reset()
200202
for robot in robot_list:
203+
robot._articulation_view.initialize()
201204
idx_list = [robot.get_dof_index(x) for x in j_names]
202205
robot.set_joint_positions(default_config, idx_list)
203206

@@ -223,6 +226,8 @@ def main():
223226
past_goal = ik_goal.clone()
224227
sim_js_names = robot_list[0].dof_names
225228
sim_js = robot_list[0].get_joints_state()
229+
if sim_js is None:
230+
continue
226231
full_js = JointState(
227232
position=tensor_args.to_device(sim_js.positions).view(1, -1),
228233
velocity=tensor_args.to_device(sim_js.velocities).view(1, -1) * 0.0,

examples/isaac_sim/collision_checker.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@
5454
import numpy as np
5555
from helper import add_extensions
5656
from omni.isaac.core import World
57-
from omni.isaac.core.materials import OmniPBR
57+
58+
try:
59+
from omni.isaac.core.materials import OmniPBR
60+
except ImportError:
61+
from isaacsim.core.api.materials import OmniPBR
5862
from omni.isaac.core.objects import sphere
5963

6064
# CuRobo
@@ -73,7 +77,10 @@
7377

7478
def draw_line(start, gradient):
7579
# Third Party
76-
from omni.isaac.debug_draw import _debug_draw
80+
try:
81+
from omni.isaac.debug_draw import _debug_draw
82+
except ImportError:
83+
from isaacsim.util.debug_draw import _debug_draw
7784

7885
draw = _debug_draw.acquire_debug_draw_interface()
7986
# if draw.get_num_points() > 0:
@@ -194,7 +201,10 @@ def main():
194201

195202
else:
196203
# Third Party
197-
from omni.isaac.debug_draw import _debug_draw
204+
try:
205+
from omni.isaac.debug_draw import _debug_draw
206+
except ImportError:
207+
from isaacsim.util.debug_draw import _debug_draw
198208

199209
draw = _debug_draw.acquire_debug_draw_interface()
200210
# if draw.get_num_points() > 0:

examples/isaac_sim/constrained_reacher.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,11 @@
5858
# Third Party
5959
import carb
6060
from omni.isaac.core import World
61-
from omni.isaac.core.materials import OmniGlass, OmniPBR
61+
62+
try:
63+
from omni.isaac.core.materials import OmniGlass, OmniPBR
64+
except ImportError:
65+
from isaacsim.core.api.materials import OmniGlass, OmniPBR
6266
from omni.isaac.core.objects import cuboid, sphere
6367
from omni.isaac.core.utils.types import ArticulationAction
6468

@@ -207,8 +211,9 @@
207211
continue
208212
step_index = my_world.current_time_step_index
209213

210-
if step_index <= 2:
211-
my_world.reset()
214+
if step_index <= 10:
215+
# my_world.reset()
216+
robot._articulation_view.initialize()
212217
idx_list = [robot.get_dof_index(x) for x in j_names]
213218
robot.set_joint_positions(default_config, idx_list)
214219

@@ -218,7 +223,7 @@
218223

219224
if False and step_index % 50 == 0.0: # No obstacle update
220225
obstacles = usd_help.get_obstacles_from_stage(
221-
# only_paths=[obstacles_path],
226+
only_paths=["/World"],
222227
reference_prim_path=robot_prim_path,
223228
ignore_substring=[
224229
robot_prim_path,

examples/isaac_sim/helper.py

Lines changed: 69 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import numpy as np
1717
from matplotlib import cm
1818
from omni.isaac.core import World
19-
from omni.isaac.core.materials import OmniPBR
2019
from omni.isaac.core.objects import cuboid
2120
from omni.isaac.core.robots import Robot
2221
from pxr import UsdPhysics
@@ -26,14 +25,28 @@
2625
from curobo.util.usd_helper import set_prim_transform
2726

2827
ISAAC_SIM_23 = False
28+
ISAAC_SIM_45 = False
2929
try:
3030
# Third Party
3131
from omni.isaac.urdf import _urdf # isaacsim 2022.2
3232
except ImportError:
3333
# Third Party
34-
from omni.importer.urdf import _urdf # isaac sim 2023.1 or above
34+
try:
35+
from omni.importer.urdf import _urdf # isaac sim 2023.1 or above
36+
except ImportError:
37+
from isaacsim.asset.importer.urdf import _urdf # isaac sim 4.5+
3538

39+
ISAAC_SIM_45 = True
3640
ISAAC_SIM_23 = True
41+
42+
try:
43+
# import for older isaacsim installations
44+
from omni.isaac.core.materials import OmniPBR
45+
except ImportError:
46+
# import for isaac sim 4.5+
47+
from isaacsim.core.api.materials import OmniPBR
48+
49+
3750
# Standard Library
3851
from typing import Optional
3952

@@ -67,6 +80,7 @@ def add_robot_to_scene(
6780
subroot: str = "",
6881
robot_name: str = "robot",
6982
position: np.array = np.array([0, 0, 0]),
83+
initialize_world: bool = True,
7084
):
7185

7286
urdf_interface = _urdf.acquire_urdf_interface()
@@ -91,18 +105,57 @@ def add_robot_to_scene(
91105
and robot_config["kinematics"]["external_asset_path"] is not None
92106
):
93107
asset_path = robot_config["kinematics"]["external_asset_path"]
108+
109+
# urdf_path:
110+
# meshes_path:
111+
# meshes path should be a subset of urdf_path
94112
full_path = join_path(asset_path, robot_config["kinematics"]["urdf_path"])
113+
# full path contains the path to urdf
114+
# Get meshes path
95115
robot_path = get_path_of_dir(full_path)
96116
filename = get_filename(full_path)
97-
imported_robot = urdf_interface.parse_urdf(robot_path, filename, import_config)
98-
dest_path = subroot
99-
robot_path = urdf_interface.import_robot(
100-
robot_path,
101-
filename,
102-
imported_robot,
103-
import_config,
104-
dest_path,
105-
)
117+
if ISAAC_SIM_45:
118+
from isaacsim.core.utils.extensions import get_extension_path_from_name
119+
import omni.kit.commands
120+
import omni.usd
121+
122+
# Retrieve the path of the URDF file from the extension
123+
extension_path = get_extension_path_from_name("isaacsim.asset.importer.urdf")
124+
root_path = robot_path
125+
file_name = filename
126+
127+
# Parse the robot's URDF file to generate a robot model
128+
129+
dest_path = join_path(
130+
root_path, get_filename(file_name, remove_extension=True) + "_temp.usd"
131+
)
132+
133+
result, robot_path = omni.kit.commands.execute(
134+
"URDFParseAndImportFile",
135+
urdf_path="{}/{}".format(root_path, file_name),
136+
import_config=import_config,
137+
dest_path=dest_path,
138+
)
139+
prim_path = omni.usd.get_stage_next_free_path(
140+
my_world.scene.stage,
141+
str(my_world.scene.stage.GetDefaultPrim().GetPath()) + robot_path,
142+
False,
143+
)
144+
robot_prim = my_world.scene.stage.OverridePrim(prim_path)
145+
robot_prim.GetReferences().AddReference(dest_path)
146+
robot_path = prim_path
147+
else:
148+
149+
imported_robot = urdf_interface.parse_urdf(robot_path, filename, import_config)
150+
dest_path = subroot
151+
152+
robot_path = urdf_interface.import_robot(
153+
robot_path,
154+
filename,
155+
imported_robot,
156+
import_config,
157+
dest_path,
158+
)
106159

107160
base_link_name = robot_config["kinematics"]["base_link"]
108161

@@ -117,6 +170,11 @@ def add_robot_to_scene(
117170
set_prim_transform(linkp, [position[0], position[1], position[2], 1, 0, 0, 0])
118171

119172
robot = my_world.scene.add(robot_p)
173+
if initialize_world:
174+
if ISAAC_SIM_45:
175+
my_world.initialize_physics()
176+
robot.initialize()
177+
120178
return robot, robot_path
121179

122180

examples/isaac_sim/ik_reachability.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ def get_pose_grid(n_x, n_y, n_z, max_x, max_y, max_z):
112112

113113
def draw_points(pose, success):
114114
# Third Party
115-
from omni.isaac.debug_draw import _debug_draw
115+
try:
116+
from omni.isaac.debug_draw import _debug_draw
117+
except ImportError:
118+
from isaacsim.util.debug_draw import _debug_draw
116119

117120
draw = _debug_draw.acquire_debug_draw_interface()
118121
N = 100
@@ -236,9 +239,8 @@ def main():
236239
continue
237240

238241
step_index = my_world.current_time_step_index
239-
# print(step_index)
240-
if step_index <= 2:
241-
my_world.reset()
242+
if step_index <= 10:
243+
# my_world.reset()
242244
idx_list = [robot.get_dof_index(x) for x in j_names]
243245
robot.set_joint_positions(default_config, idx_list)
244246

@@ -251,7 +253,7 @@ def main():
251253
if step_index == 50 or step_index % 500 == 0.0: # and cmd_plan is None:
252254
print("Updating world, reading w.r.t.", robot_prim_path)
253255
obstacles = usd_help.get_obstacles_from_stage(
254-
# only_paths=[obstacles_path],
256+
only_paths=["/World"],
255257
reference_prim_path=robot_prim_path,
256258
ignore_substring=[
257259
robot_prim_path,

0 commit comments

Comments
 (0)