Commit 598cc3cd authored by Kelly Guo's avatar Kelly Guo Committed by Kelly Guo

Updates physics APIs based on latest omni.physics changes (#205)

Some changes and updates were introduced in the latest physics build for
Isaac Sim 4.5. This PR updates Isaac Lab to leverage some new APIs:

- Kinematic bodies now require an additional API call to populate
kinematic transforms to fabric, which will allow for rendering of
kinematic bodies
- A new `enable_env_ids` flag was introduced in the cloning and physics
replication APIs that will now automatically filter collisions across
environments. This replaces the previous calls to filter collisions,
which helps speed up the scene creation process.

<!-- As you go through the list, delete the ones that are not
applicable. -->

- New feature (non-breaking change which adds functionality)

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./isaaclab.sh --format`
- [ ] I have made corresponding changes to the documentation
- [x] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] I have updated the changelog and the corresponding version in the
extension's `config/extension.toml` file
- [ ] I have added my name to the `CONTRIBUTORS.md` or my name already
exists there

<!--
As you go through the checklist above, you can mark something as done by
putting an x character in it

For example,
- [x] I have done this task
- [ ] I have not done this task
-->

---------
Signed-off-by: 's avatarKelly Guo <kellyg@nvidia.com>
parent d494e00e
......@@ -98,7 +98,7 @@ def overwrite_python_analysis_extra_paths(isaaclab_settings: str) -> str:
)
# add the path names that are in the Isaac Lab extensions directory
isaaclab_extensions = os.listdir(os.path.join(ISAACLAB_DIR, "source", "extensions"))
isaaclab_extensions = os.listdir(os.path.join(ISAACLAB_DIR, "source"))
path_names.extend(['"${workspaceFolder}/source/' + ext + '"' for ext in isaaclab_extensions])
# combine them into a single string
......
......@@ -59,6 +59,7 @@ keywords = ["experience", "app", "usd"]
"omni.graph.ui_nodes" = {}
"omni.hydra.engine.stats" = {}
"omni.hydra.rtx" = {}
"omni.kit.loop" = {}
"omni.kit.mainwindow" = {}
"omni.kit.manipulator.camera" = {}
"omni.kit.manipulator.prim" = {}
......
[package]
# Note: Semantic Versioning is used: https://semver.org/
version = "0.32.8"
version = "0.33.6"
# Description
title = "Isaac Lab framework for Robot Learning"
......
Changelog
---------
0.32.8 (2025-01-30)
0.33.6 (2025-01-30)
~~~~~~~~~~~~~~~~~~~
Fixed
......@@ -12,7 +12,7 @@ Fixed
to the event being triggered at the wrong time after the reset.
0.32.7 (2025-01-17)
0.33.5 (2025-01-17)
~~~~~~~~~~~~~~~~~~~
Fixed
......@@ -42,7 +42,7 @@ Fixed
the :class:`omni.isaac.lab.assets.RigidObjectCollection` class.
0.32.6 (2025-01-14)
0.33.4 (2025-01-14)
~~~~~~~~~~~~~~~~~~~
Fixed
......@@ -51,7 +51,7 @@ Fixed
* Fixed the respawn of only wrong object samples in :func:`repeated_objects_terrain` of :mod:`omni.isaac.lab.terrains.trimesh` module. Previously, the function was respawning all objects in the scene instead of only the wrong object samples, which in worst case could lead to infinite respawn loop.
0.32.5 (2025-01-08)
0.33.3 (2025-01-08)
~~~~~~~~~~~~~~~~~~~
Fixed
......@@ -61,7 +61,7 @@ Fixed
In body properties sections, the second dimension should be num_bodies but was documented as 1.
0.32.4 (2025-01-02)
0.33.2 (2025-01-02)
~~~~~~~~~~~~~~~~~~~
Added
......@@ -70,7 +70,17 @@ Added
* Added body tracking as an origin type to :class:`omni.isaac.lab.envs.ViewerCfg` and :class:`omni.isaac.lab.envs.ui.ViewportCameraController`.
0.32.3 (2024-12-22)
0.33.1 (2024-12-26)
~~~~~~~~~~~~~~~~~~~
Changed
^^^^^^^
* Added kinematics initialization call for populating kinematic prim transforms to fabric for rendering.
* Added ``enable_env_ids`` flag for cloning and replication to replace collision filtering.
0.33.0 (2024-12-22)
~~~~~~~~~~~~~~~~~~~
Fixed
......
......@@ -138,6 +138,7 @@ class InteractiveScene:
prim_paths=self.env_prim_paths,
replicate_physics=False,
copy_from_source=True,
enable_env_ids=True, # this automatically filters collisions between environments
)
self._default_env_origins = torch.tensor(env_origins, device=self.device, dtype=torch.float32)
else:
......@@ -159,10 +160,9 @@ class InteractiveScene:
prim_paths=self.env_prim_paths,
base_env_path=self.env_ns,
root_path=self.env_regex_ns.replace(".*", ""),
enable_env_ids=True,
)
self.filter_collisions(self._global_prim_paths)
def clone_environments(self, copy_from_source: bool = False):
"""Creates clones of the environment ``/World/envs/env_0``.
......@@ -188,6 +188,7 @@ class InteractiveScene:
prim_paths=self.env_prim_paths,
replicate_physics=self.cfg.replicate_physics,
copy_from_source=copy_from_source,
enable_env_ids=True, # this automatically filters collisions between environments
)
# in case of heterogeneous cloning, the env origins is specified at init
......
......@@ -431,6 +431,9 @@ class SimulationContext(_SimulationContext):
def reset(self, soft: bool = False):
super().reset(soft=soft)
# enable kinematic rendering with fabric
if self.physics_sim_view:
self.physics_sim_view._backend.initialize_kinematic_bodies()
# perform additional rendering steps to warm up replicator buffers
# this is only needed for the first time we set the simulation
if not soft:
......
......@@ -293,7 +293,11 @@ class TestTerrainImporter(unittest.TestCase):
# Clone the scene
cloner.define_base_env("/World/envs")
envs_prim_paths = cloner.generate_paths("/World/envs/env", num_paths=num_balls)
cloner.clone(source_prim_path="/World/envs/env_0", prim_paths=envs_prim_paths, replicate_physics=True)
cloner.clone(
source_prim_path="/World/envs/env_0",
prim_paths=envs_prim_paths,
replicate_physics=True,
)
physics_scene_path = sim.get_physics_context().prim_path
cloner.filter_collisions(
physics_scene_path, "/World/collisions", prim_paths=envs_prim_paths, global_paths=["/World/ground"]
......
# Copyright (c) 2022-2024, The Isaac Lab Project Developers.
# Copyright (c) 2022-2025, The Isaac Lab Project Developers.
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
......
# Copyright (c) 2022-2024, The Isaac Lab Project Developers.
# Copyright (c) 2022-2025, The Isaac Lab Project Developers.
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
......
# Copyright (c) 2022-2024, The Isaac Lab Project Developers.
# Copyright (c) 2022-2025, The Isaac Lab Project Developers.
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
......
......@@ -64,9 +64,8 @@ class AnymalCEnv(DirectRLEnv):
self.cfg.terrain.num_envs = self.scene.cfg.num_envs
self.cfg.terrain.env_spacing = self.scene.cfg.env_spacing
self._terrain = self.cfg.terrain.class_type(self.cfg.terrain)
# clone, filter, and replicate
# clone and replicate
self.scene.clone_environments(copy_from_source=False)
self.scene.filter_collisions(global_prim_paths=[self.cfg.terrain.prim_path])
# add lights
light_cfg = sim_utils.DomeLightCfg(intensity=2000.0, color=(0.75, 0.75, 0.75))
light_cfg.func("/World/Light", light_cfg)
......
......@@ -80,9 +80,8 @@ class CartDoublePendulumEnv(DirectMARLEnv):
self.robot = Articulation(self.cfg.robot_cfg)
# add ground plane
spawn_ground_plane(prim_path="/World/ground", cfg=GroundPlaneCfg())
# clone, filter, and replicate
# clone and replicate
self.scene.clone_environments(copy_from_source=False)
self.scene.filter_collisions(global_prim_paths=[])
# add articulation to scene
self.scene.articulations["robot"] = self.robot
# add lights
......
......@@ -121,9 +121,8 @@ class CartpoleCameraEnv(DirectRLEnv):
self._cartpole = Articulation(self.cfg.robot_cfg)
self._tiled_camera = TiledCamera(self.cfg.tiled_camera)
# clone, filter, and replicate
# clone and replicate
self.scene.clone_environments(copy_from_source=False)
self.scene.filter_collisions(global_prim_paths=[])
# add articulation and sensors to scene
self.scene.articulations["cartpole"] = self._cartpole
......
......@@ -71,9 +71,8 @@ class CartpoleEnv(DirectRLEnv):
self.cartpole = Articulation(self.cfg.robot_cfg)
# add ground plane
spawn_ground_plane(prim_path="/World/ground", cfg=GroundPlaneCfg())
# clone, filter, and replicate
# clone and replicate
self.scene.clone_environments(copy_from_source=False)
self.scene.filter_collisions(global_prim_paths=[])
# add articulation to scene
self.scene.articulations["cartpole"] = self.cartpole
# add lights
......
......@@ -173,7 +173,6 @@ class FactoryEnv(DirectRLEnv):
self._large_gear_asset = Articulation(self.cfg_task.large_gear_cfg)
self.scene.clone_environments(copy_from_source=False)
self.scene.filter_collisions()
self.scene.articulations["robot"] = self._robot
self.scene.articulations["fixed_asset"] = self._fixed_asset
......@@ -639,7 +638,6 @@ class FactoryEnv(DirectRLEnv):
joint_vel = torch.zeros_like(joint_pos)
joint_effort = torch.zeros_like(joint_pos)
self.ctrl_target_joint_pos[env_ids, :] = joint_pos
print(f"Resetting {len(env_ids)} envs...")
self._robot.set_joint_position_target(self.ctrl_target_joint_pos[env_ids], env_ids=env_ids)
self._robot.write_joint_state_to_sim(joint_pos, joint_vel, env_ids=env_ids)
self._robot.reset()
......@@ -761,7 +759,6 @@ class FactoryEnv(DirectRLEnv):
)
ik_attempt += 1
print(f"IK Attempt: {ik_attempt}\tBad Envs: {bad_envs.shape[0]}")
self.step_sim_no_action()
......
......@@ -271,9 +271,8 @@ class FrankaCabinetEnv(DirectRLEnv):
self.cfg.terrain.env_spacing = self.scene.cfg.env_spacing
self._terrain = self.cfg.terrain.class_type(self.cfg.terrain)
# clone, filter, and replicate
# clone and replicate
self.scene.clone_environments(copy_from_source=False)
self.scene.filter_collisions(global_prim_paths=[self.cfg.terrain.prim_path])
# add lights
light_cfg = sim_utils.DomeLightCfg(intensity=2000.0, color=(0.75, 0.75, 0.75))
......
......@@ -51,9 +51,8 @@ class LocomotionEnv(DirectRLEnv):
self.cfg.terrain.num_envs = self.scene.cfg.num_envs
self.cfg.terrain.env_spacing = self.scene.cfg.env_spacing
self.terrain = self.cfg.terrain.class_type(self.cfg.terrain)
# clone, filter, and replicate
# clone and replicate
self.scene.clone_environments(copy_from_source=False)
self.scene.filter_collisions(global_prim_paths=[self.cfg.terrain.prim_path])
# add articulation to scene
self.scene.articulations["robot"] = self.robot
# add lights
......
......@@ -137,9 +137,8 @@ class QuadcopterEnv(DirectRLEnv):
self.cfg.terrain.num_envs = self.scene.cfg.num_envs
self.cfg.terrain.env_spacing = self.scene.cfg.env_spacing
self._terrain = self.cfg.terrain.class_type(self.cfg.terrain)
# clone, filter, and replicate
# clone and replicate
self.scene.clone_environments(copy_from_source=False)
self.scene.filter_collisions(global_prim_paths=[self.cfg.terrain.prim_path])
# add lights
light_cfg = sim_utils.DomeLightCfg(intensity=2000.0, color=(0.75, 0.75, 0.75))
light_cfg.func("/World/Light", light_cfg)
......
# Copyright (c) 2022-2024, The Isaac Lab Project Developers.
# Copyright (c) 2022-2025, The Isaac Lab Project Developers.
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
......
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