Skip to content

Commit

Permalink
Fixes ground color and setting of ground transformation (isaac-sim#224)
Browse files Browse the repository at this point in the history
# Description

This MR fixes the color of the ground in Orbit. It is now black since we
like that color more.

It also fixes the setting of the translation of the ground plane.
Earlier, it was taking z height from the configuration. Instead, now it
expects to get the full translation as an argument to its function. This
is needed to make it consistent with interactive scene designing API.

## Type of change

- Bug fix (non-breaking change which fixes an issue)
- Breaking change (fix or feature that would cause existing
functionality to not work as expected)

## Screenshot


![new_ground](https://github.com/isaac-orbit/orbit/assets/12863862/8e729cb4-875f-476f-aa32-39cab38ad925)

## Checklist

- [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
`./orbit.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
  • Loading branch information
Mayankm96 committed Oct 31, 2023
1 parent 552f162 commit 7203578
Show file tree
Hide file tree
Showing 19 changed files with 105 additions and 89 deletions.
2 changes: 1 addition & 1 deletion source/extensions/omni.isaac.orbit/config/extension.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

# Note: Semantic Versioning is used: https://semver.org/
version = "0.9.27"
version = "0.9.28"

# Description
title = "ORBIT framework for Robot Learning"
Expand Down
11 changes: 11 additions & 0 deletions source/extensions/omni.isaac.orbit/docs/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Changelog
---------

0.9.28 (2023-11-01)
~~~~~~~~~~~~~~~~~~~

Changed
^^^^^^^

* Changed the way the :func:`omni.isaac.orbit.sim.spawners.from_files.spawn_ground_plane` function sets the
height of the ground. Earlier, it was reading the height from the configuration object. Now, it expects the
desired transformation as inputs to the function. This makes it consistent with the other spawner functions.


0.9.27 (2023-10-31)
~~~~~~~~~~~~~~~~~~~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,10 @@ def spawn_from_usd(
prim_path: The prim path or pattern to spawn the asset at. If the prim path is a regex pattern,
then the asset is spawned at all the matching prim paths.
cfg: The configuration instance.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None, in which
case the translation specified in the USD file is used.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None,
in which case the orientation specified in the USD file is used.
Returns:
The prim of the spawned asset.
Expand Down Expand Up @@ -119,8 +121,10 @@ def spawn_from_urdf(
prim_path: The prim path or pattern to spawn the asset at. If the prim path is a regex pattern,
then the asset is spawned at all the matching prim paths.
cfg: The configuration instance.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None, in which
case the translation specified in the generated USD file is used.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None,
in which case the orientation specified in the generated USD file is used.
Returns:
The prim of the spawned asset.
Expand Down Expand Up @@ -166,7 +170,12 @@ def spawn_from_urdf(
return prim_utils.get_prim_at_path(prim_path)


def spawn_ground_plane(prim_path: str, cfg: from_files_cfg.GroundPlaneCfg, **kwargs) -> Usd.Prim:
def spawn_ground_plane(
prim_path: str,
cfg: from_files_cfg.GroundPlaneCfg,
translation: tuple[float, float, float] | None = None,
orientation: tuple[float, float, float, float] | None = None,
) -> Usd.Prim:
"""Spawns a ground plane into the scene.
This function loads the USD file containing the grid plane asset from Isaac Sim. It may
Expand All @@ -180,6 +189,10 @@ def spawn_ground_plane(prim_path: str, cfg: from_files_cfg.GroundPlaneCfg, **kwa
Args:
prim_path: The path to spawn the asset at.
cfg: The configuration instance.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None, in which
case the translation specified in the USD file is used.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None,
in which case the orientation specified in the USD file is used.
Returns:
The prim of the spawned asset.
Expand All @@ -189,7 +202,7 @@ def spawn_ground_plane(prim_path: str, cfg: from_files_cfg.GroundPlaneCfg, **kwa
"""
# Spawn Ground-plane
if not prim_utils.is_prim_path_valid(prim_path):
prim_utils.create_prim(prim_path, usd_path=cfg.usd_path, translation=(0.0, 0.0, cfg.height))
prim_utils.create_prim(prim_path, usd_path=cfg.usd_path, translation=translation, orientation=orientation)
else:
raise ValueError(f"A prim already exists at path: '{prim_path}'.")

Expand Down Expand Up @@ -231,10 +244,13 @@ def spawn_ground_plane(prim_path: str, cfg: from_files_cfg.GroundPlaneCfg, **kwa
omni.kit.commands.execute(
"ChangePropertyCommand",
prop_path=Sdf.Path(prop_path),
value=Gf.Vec3d(*cfg.color),
value=Gf.Vec3f(*cfg.color),
prev=None,
type_to_create_if_not_exist=Sdf.ValueTypeNames.Color3f,
)
# Remove the light from the ground plane
# It isn't bright enough and messes up with the user's lighting settings
omni.kit.commands.execute("ToggleVisibilitySelectedPrims", selected_paths=[f"{prim_path}/SphereLight"])

# return the prim
return prim_utils.get_prim_at_path(prim_path)
Original file line number Diff line number Diff line change
Expand Up @@ -95,14 +95,15 @@ class GroundPlaneCfg(SpawnerCfg):

usd_path: str = f"{ISAAC_NUCLEUS_DIR}/Environments/Grid/default_environment.usd"
"""Path to the USD file to spawn asset from. Defaults to the grid-world ground plane."""
height: float = 0.0
"""The height of the ground plane. Defaults to 0.0."""
color: tuple[float, float, float] | None = (0.065, 0.0725, 0.080)
"""The color of the ground plane. Defaults to (0.065, 0.0725, 0.080).

color: tuple[float, float, float] | None = (0.0, 0.0, 0.0)
"""The color of the ground plane. Defaults to (0.0, 0.0, 0.0).
If None, then the color remains unchanged.
"""

size: tuple[float, float] = (100.0, 100.0)
"""The size of the ground plane. Defaults to 100 m x 100 m."""

physics_material: materials.RigidBodyMaterialCfg = materials.RigidBodyMaterialCfg()
"""Physics material properties. Defaults to the default rigid body material."""
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,9 @@ def spawn_light(
prim_path: The prim path or pattern to spawn the asset at. If the prim path is a regex pattern,
then the asset is spawned at all the matching prim paths.
cfg: The configuration for the light source.
translation: The translation of the prim. Defaults to None.
orientation: The orientation of the prim as ``(w, x, y, z)``. Defaults to None.
translation: The translation of the prim. Defaults to None, in which case this is set to the origin.
orientation: The orientation of the prim as ``(w, x, y, z)``. Defaults to None, in which case this
is set to identity.
Raises:
ValueError: When a prim already exists at the specified prim path.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ def spawn_camera(
prim_path: The prim path or pattern to spawn the asset at. If the prim path is a regex pattern,
then the asset is spawned at all the matching prim paths.
cfg: The configuration instance.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None, in which case
this is set to the origin.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None,
in which case this is set to identity.
Returns:
The created prim.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,10 @@ def spawn_sphere(
prim_path: The prim path or pattern to spawn the asset at. If the prim path is a regex pattern,
then the asset is spawned at all the matching prim paths.
cfg: The configuration instance.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None, in which case
this is set to the origin.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None,
in which case this is set to identity.
Returns:
The created prim.
Expand Down Expand Up @@ -77,8 +79,10 @@ def spawn_cuboid(
prim_path: The prim path or pattern to spawn the asset at. If the prim path is a regex pattern,
then the asset is spawned at all the matching prim paths.
cfg: The configuration instance.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None, in which case
this is set to the origin.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None,
in which case this is set to identity.
Returns:
The created prim.
Expand Down Expand Up @@ -116,8 +120,10 @@ def spawn_cylinder(
prim_path: The prim path or pattern to spawn the asset at. If the prim path is a regex pattern,
then the asset is spawned at all the matching prim paths.
cfg: The configuration instance.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None, in which case
this is set to the origin.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None,
in which case this is set to identity.
Returns:
The created prim.
Expand Down Expand Up @@ -152,8 +158,10 @@ def spawn_capsule(
prim_path: The prim path or pattern to spawn the asset at. If the prim path is a regex pattern,
then the asset is spawned at all the matching prim paths.
cfg: The configuration instance.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None, in which case
this is set to the origin.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None,
in which case this is set to identity.
Returns:
The created prim.
Expand Down Expand Up @@ -188,8 +196,10 @@ def spawn_cone(
prim_path: The prim path or pattern to spawn the asset at. If the prim path is a regex pattern,
then the asset is spawned at all the matching prim paths.
cfg: The configuration instance.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None, in which case
this is set to the origin.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None,
in which case this is set to identity.
Returns:
The created prim.
Expand Down Expand Up @@ -237,9 +247,11 @@ def _spawn_geom_from_prim_type(
cfg: The config containing the properties to apply.
prim_type: The type of prim to create.
attributes: The attributes to apply to the prim.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None.
scale: The scale to apply to the prim. Defaults to None.
translation: The translation to apply to the prim w.r.t. its parent prim. Defaults to None, in which case
this is set to the origin.
orientation: The orientation in (w, x, y, z) to apply to the prim w.r.t. its parent prim. Defaults to None,
in which case this is set to identity.
scale: The scale to apply to the prim. Defaults to None, in which case this is set to identity.
Raises:
ValueError: If a prim already exists at the given path.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,6 @@ def main():
# Set main camera
set_camera_view([2.5, 2.5, 2.5], [0.0, 0.0, 0.0])

# Enable flatcache which avoids passing data over to USD structure
# this speeds up the read-write operation of GPU buffers
if world.get_physics_context().use_gpu_pipeline:
world.get_physics_context().enable_flatcache(True)
# Enable hydra scene-graph instancing
# this is needed to visualize the scene when flatcache is enabled
set_carb_setting(world._settings, "/persistent/omnihydra/useSceneGraphInstancing", True)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def get_checkpoint_path(log_path: str, run_dir: str = "*", checkpoint: str = Non
try:
# find all runs in the directory
runs = [os.path.join(log_path, run) for run in os.scandir(log_path)]
runs = [run for run in runs if os.path.isdir(run)]
# sort by date to handle change of month
runs = sorted(runs, key=os.path.getmtime)
# create last run file path
Expand Down
13 changes: 5 additions & 8 deletions source/standalone/demo/play_arms.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,11 @@ def main():

# Spawn things into stage
# Ground-plane
cfg = sim_utils.GroundPlaneCfg(height=-1.05)
cfg.func("/World/defaultGroundPlane", cfg)
# Lights-1
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(0.75, 0.75, 0.75), radius=2.5)
cfg.func("/World/Light/greyLight", cfg, translation=(4.5, 3.5, 10.0))
# Lights-2
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(1.0, 1.0, 1.0), radius=2.5)
cfg.func("/World/Light/whiteSphere", cfg, translation=(-4.5, 3.5, 10.0))
cfg = sim_utils.GroundPlaneCfg()
cfg.func("/World/defaultGroundPlane", cfg, translation=(0.0, 0.0, -1.05))
# Lights
cfg = sim_utils.DistantLightCfg(intensity=3000.0, color=(0.75, 0.75, 0.75))
cfg.func("/World/Light", cfg)

# Table
cfg = sim_utils.UsdFileCfg(usd_path=f"{ISAAC_NUCLEUS_DIR}/Props/Mounts/SeattleLabTable/table_instanceable.usd")
Expand Down
10 changes: 4 additions & 6 deletions source/standalone/demo/play_camera.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,10 @@ def design_scene():
# Ground-plane
cfg = sim_utils.GroundPlaneCfg()
cfg.func("/World/defaultGroundPlane", cfg)
# Lights-1
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(0.75, 0.75, 0.75), radius=2.5)
cfg.func("/World/Light/greyLight", cfg, translation=(4.5, 3.5, 10.0))
# Lights-2
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(1.0, 1.0, 1.0), radius=2.5)
cfg.func("/World/Light/whiteSphere", cfg, translation=(-4.5, 3.5, 10.0))
# Lights
cfg = sim_utils.DistantLightCfg(intensity=3000.0, color=(0.75, 0.75, 0.75))
cfg.func("/World/Light", cfg)

# Xform to hold objects
prim_utils.create_prim("/World/Objects", "Xform")
# Random objects
Expand Down
13 changes: 5 additions & 8 deletions source/standalone/demo/play_cloner.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,11 @@ def main():

# Spawn things into stage
# Ground-plane
cfg = sim_utils.GroundPlaneCfg(height=-1.05)
cfg.func("/World/defaultGroundPlane", cfg)
# Lights-1
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(0.75, 0.75, 0.75), radius=2.5)
cfg.func("/World/Light/greyLight", cfg, translation=(4.5, 3.5, 10.0))
# Lights-2
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(1.0, 1.0, 1.0), radius=2.5)
cfg.func("/World/Light/whiteSphere", cfg, translation=(-4.5, 3.5, 10.0))
cfg = sim_utils.GroundPlaneCfg()
cfg.func("/World/defaultGroundPlane", cfg, translation=(0.0, 0.0, -1.05))
# Lights
cfg = sim_utils.DistantLightCfg(intensity=3000.0, color=(0.75, 0.75, 0.75))
cfg.func("/World/Light", cfg)
# Table
cfg = sim_utils.UsdFileCfg(usd_path=f"{ISAAC_NUCLEUS_DIR}/Props/Mounts/SeattleLabTable/table_instanceable.usd")
cfg.func("/World/envs/env_0/Table", cfg)
Expand Down
9 changes: 3 additions & 6 deletions source/standalone/demo/play_empty.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,9 @@ def main():
# Ground-plane
cfg = sim_utils.GroundPlaneCfg()
cfg.func("/World/defaultGroundPlane", cfg)
# Lights-1
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(0.75, 0.75, 0.75), radius=2.5)
cfg.func("/World/Light/greyLight", cfg, translation=(4.5, 3.5, 10.0))
# Lights-2
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(1.0, 1.0, 1.0), radius=2.5)
cfg.func("/World/Light/whiteSphere", cfg, translation=(-4.5, 3.5, 10.0))
# Lights
cfg = sim_utils.DistantLightCfg(intensity=3000.0, color=(0.75, 0.75, 0.75))
cfg.func("/World/Light", cfg)

# Play the simulator
sim.reset()
Expand Down
13 changes: 5 additions & 8 deletions source/standalone/demo/play_ik_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,11 @@ def main():

# Spawn things into stage
# Ground-plane
cfg = sim_utils.GroundPlaneCfg(height=-1.05)
cfg.func("/World/defaultGroundPlane", cfg)
# Lights-1
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(0.75, 0.75, 0.75), radius=2.5)
cfg.func("/World/Light/greyLight", cfg, translation=(4.5, 3.5, 10.0))
# Lights-2
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(1.0, 1.0, 1.0), radius=2.5)
cfg.func("/World/Light/whiteSphere", cfg, translation=(-4.5, 3.5, 10.0))
cfg = sim_utils.GroundPlaneCfg()
cfg.func("/World/defaultGroundPlane", cfg, translation=(0.0, 0.0, -1.05))
# Lights
cfg = sim_utils.DistantLightCfg(intensity=3000.0, color=(0.75, 0.75, 0.75))
cfg.func("/World/Light", cfg)
# Table
cfg = sim_utils.UsdFileCfg(usd_path=f"{ISAAC_NUCLEUS_DIR}/Props/Mounts/SeattleLabTable/table_instanceable.usd")
cfg.func("/World/envs/env_0/Table", cfg)
Expand Down
9 changes: 3 additions & 6 deletions source/standalone/demo/play_markers.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,9 @@ def main():
sim.set_camera_view([0.0, 17.0, 12.0], [0.0, 2.0, 0.0])

# Spawn things into stage
# Lights-1
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(0.75, 0.75, 0.75), radius=2.5)
cfg.func("/World/Light/greyLight", cfg, translation=(4.5, 3.5, 10.0))
# Lights-2
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(1.0, 1.0, 1.0), radius=2.5)
cfg.func("/World/Light/whiteSphere", cfg, translation=(-4.5, 3.5, 10.0))
# Lights
cfg = sim_utils.DistantLightCfg(intensity=3000.0, color=(0.75, 0.75, 0.75))
cfg.func("/World/Light", cfg)

# Create markers with various different shapes
marker_cfg = VisualizationMarkersCfg(
Expand Down
9 changes: 3 additions & 6 deletions source/standalone/demo/play_quadrupeds.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,9 @@ def main():
# Ground-plane
cfg = sim_utils.GroundPlaneCfg()
cfg.func("/World/defaultGroundPlane", cfg)
# Lights-1
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(0.75, 0.75, 0.75), radius=2.5)
cfg.func("/World/Light/greyLight", cfg, translation=(4.5, 3.5, 10.0))
# Lights-2
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(1.0, 1.0, 1.0), radius=2.5)
cfg.func("/World/Light/whiteSphere", cfg, translation=(-4.5, 3.5, 10.0))
# Lights
cfg = sim_utils.DistantLightCfg(intensity=3000.0, color=(0.75, 0.75, 0.75))
cfg.func("/World/Light", cfg)

# Robots
# -- anymal-b
Expand Down
9 changes: 3 additions & 6 deletions source/standalone/demo/play_ridgeback_franka.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,9 @@ def main():
# Ground-plane
cfg = sim_utils.GroundPlaneCfg()
cfg.func("/World/defaultGroundPlane", cfg)
# Lights-1
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(0.75, 0.75, 0.75), radius=2.5)
cfg.func("/World/Light/greyLight", cfg, translation=(4.5, 3.5, 10.0))
# Lights-2
cfg = sim_utils.SphereLightCfg(intensity=600.0, color=(1.0, 1.0, 1.0), radius=2.5)
cfg.func("/World/Light/whiteSphere", cfg, translation=(-4.5, 3.5, 10.0))
# Lights
cfg = sim_utils.DistantLightCfg(intensity=3000.0, color=(0.75, 0.75, 0.75))
cfg.func("/World/Light", cfg)

# Robots
robot_cfg = RIDGEBACK_FRANKA_PANDA_CFG
Expand Down
1 change: 0 additions & 1 deletion source/standalone/demo/play_scene.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ class MySceneCfg(InteractiveSceneCfg):
light = AssetBaseCfg(
prim_path="/World/light",
spawn=sim_utils.DistantLightCfg(intensity=3000.0, color=(0.75, 0.75, 0.75)),
init_state=AssetBaseCfg.InitialStateCfg(pos=(0.0, 0.0, 500.0)),
)


Expand Down
Loading

0 comments on commit 7203578

Please sign in to comment.