Skip to content

Commit

Permalink
Fixes the visualization markers to use the SpawnerCfg class (#162)
Browse files Browse the repository at this point in the history
# Description

* This MR fixes the `VisualizationMarkers` class to use the
`SpawnerCfg`. This makes it consistent with how assets are spawned and
allows more variations.
* The markers also support instanceable meshes. This is done by
disabling their instancing (as PointInstancer does not support
pre-instanced assets) and removing any rigid body APIs from the asset.

Fixes #144 

## Type of change

- Bug fix (non-breaking change which fixes an issue)
- New feature (non-breaking change which adds functionality)
- Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- This change requires a documentation update

## Screenshots

https://github.com/isaac-orbit/orbit/assets/12863862/9d1b095b-99ee-4759-ba30-6175cc3b7d78

## 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
- [x] 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 Dec 22, 2023
1 parent 83ce3dc commit c561b49
Show file tree
Hide file tree
Showing 22 changed files with 481 additions and 217 deletions.
3 changes: 2 additions & 1 deletion .vscode/tools/settings.template.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@
"downsampled",
"arange",
"discretization",
"trimesh"
"trimesh",
"uninstanceable"
],
// This enables python language server. Seems to work slightly better than jedi:
"python.languageServer": "Pylance",
Expand Down
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.6"
version = "0.9.7"

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

0.9.7 (2023-09-26)
~~~~~~~~~~~~~~~~~~

Fixed
^^^^^

* Modified the :class:`omni.isaac.orbit.markers.VisualizationMarkers` to use the
:class:`omni.isaac.orbit.sim.spawner.SpawnerCfg` class instead of their
own configuration objects. This makes it consistent with the other ways to spawn assets in the scene.

Added
^^^^^

* Added the method :meth:`copy` to configclass to allow copying of configuration objects.


0.9.6 (2023-09-26)
~~~~~~~~~~~~~~~~~~

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ def _update_metrics(self):
def _debug_vis_impl(self):
# create the box marker if necessary
if self.box_goal_visualizer is None:
marker_cfg = CUBOID_MARKER_CFG
marker_cfg.markers["cuboid"].color = (1.0, 0.0, 0.0)
marker_cfg = CUBOID_MARKER_CFG.copy()
marker_cfg.prim_path = "/Visuals/Command/position_goal"
marker_cfg.markers["cuboid"].scale = (0.1, 0.1, 0.1)
self.box_goal_visualizer = VisualizationMarkers("/Visuals/Command/position_goal", marker_cfg)
self.box_goal_visualizer = VisualizationMarkers(marker_cfg)
# update the box marker
self.box_goal_visualizer.visualize(self.pos_command_w)
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import omni.isaac.orbit.utils.math as math_utils
from omni.isaac.orbit.assets import Articulation
from omni.isaac.orbit.markers import VisualizationMarkers
from omni.isaac.orbit.markers.config import ARROW_X_MARKER_CFG
from omni.isaac.orbit.markers.config import BLUE_ARROW_X_MARKER_CFG, GREEN_ARROW_X_MARKER_CFG

from .command_generator_base import CommandGeneratorBase

Expand Down Expand Up @@ -163,16 +163,16 @@ def _debug_vis_impl(self):
# create markers if necessary
# -- goal
if self.base_vel_goal_visualizer is None:
marker_cfg = ARROW_X_MARKER_CFG
marker_cfg.markers["arrow"].color = (0.0, 1.0, 0.0)
marker_cfg = GREEN_ARROW_X_MARKER_CFG.copy()
marker_cfg.prim_path = "/Visuals/Command/velocity_goal"
marker_cfg.markers["arrow"].scale = (2.5, 0.1, 0.1)
self.base_vel_goal_visualizer = VisualizationMarkers("/Visuals/Command/velocity_goal", marker_cfg)
self.base_vel_goal_visualizer = VisualizationMarkers(marker_cfg)
# -- current
if self.base_vel_visualizer is None:
marker_cfg = ARROW_X_MARKER_CFG
marker_cfg.markers["arrow"].color = (0.0, 0.0, 1.0)
marker_cfg = BLUE_ARROW_X_MARKER_CFG.copy()
marker_cfg.prim_path = "/Visuals/Command/velocity_current"
marker_cfg.markers["arrow"].scale = (2.5, 0.1, 0.1)
self.base_vel_visualizer = VisualizationMarkers("/Visuals/Command/velocity_current", marker_cfg)
self.base_vel_visualizer = VisualizationMarkers(marker_cfg)
# get marker location
# -- base state
base_pos_w = self.robot.data.root_pos_w.clone()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

from __future__ import annotations

from .config import * # noqa: F401, F403
from .visualization_markers import VisualizationMarkers, VisualizationMarkersCfg

__all__ = ["VisualizationMarkersCfg", "VisualizationMarkers"]
Original file line number Diff line number Diff line change
@@ -1,86 +1,124 @@
# Copyright (c) 2022, NVIDIA CORPORATION & AFFILIATES, ETH Zurich, and University of Toronto
# All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause

from __future__ import annotations

import omni.isaac.orbit.sim as sim_utils
from omni.isaac.orbit.markers.visualization_markers import VisualizationMarkersCfg
from omni.isaac.orbit.utils.assets import ISAAC_NUCLEUS_DIR

from ..visualization_markers import VisualizationMarkersCfg
##
# Sensors.
##

FRAME_MARKER_CFG = VisualizationMarkersCfg(
RAY_CASTER_MARKER_CFG = VisualizationMarkersCfg(
markers={
"frame": VisualizationMarkersCfg.FileMarkerCfg(
usd_path=f"{ISAAC_NUCLEUS_DIR}/Props/UIElements/frame_prim.usd",
scale=(0.5, 0.5, 0.5),
)
"hit": sim_utils.SphereCfg(
radius=0.02,
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(1.0, 0.0, 0.0)),
),
}
)
"""Configuration for the frame marker."""
"""Configuration for the ray-caster marker."""

POSITION_GOAL_MARKER_CFG = VisualizationMarkersCfg(

CONTACT_SENSOR_MARKER_CFG = VisualizationMarkersCfg(
markers={
"target_far": VisualizationMarkersCfg.MarkerCfg(
prim_type="Sphere",
color=(1.0, 0.0, 0.0),
attributes={"radius": 0.01},
"contact": sim_utils.SphereCfg(
radius=0.02,
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(1.0, 0.0, 0.0)),
),
"target_near": VisualizationMarkersCfg.MarkerCfg(
prim_type="Sphere",
color=(0.0, 1.0, 0.0),
attributes={"radius": 0.01},
),
"target_invisible": VisualizationMarkersCfg.MarkerCfg(
prim_type="Sphere",
color=(0.0, 0.0, 1.0),
attributes={"radius": 0.01},
"no_contact": sim_utils.SphereCfg(
radius=0.02,
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(0.0, 1.0, 0.0)),
visible=False,
),
}
},
)
"""Configuration for the end-effector tracking marker."""
"""Configuration for the contact sensor marker."""

RAY_CASTER_MARKER_CFG = VisualizationMarkersCfg(

##
# Frames.
##

FRAME_MARKER_CFG = VisualizationMarkersCfg(
markers={
"hit": VisualizationMarkersCfg.MarkerCfg(
prim_type="Sphere",
color=(1.0, 0.0, 0.0),
attributes={"radius": 0.02},
),
},
"frame": sim_utils.UsdFileCfg(
usd_path=f"{ISAAC_NUCLEUS_DIR}/Props/UIElements/frame_prim.usd",
scale=(0.5, 0.5, 0.5),
)
}
)
"""Configuration for the ray-caster marker."""
"""Configuration for the frame marker."""


CONTACT_SENSOR_MARKER_CFG = VisualizationMarkersCfg(
RED_ARROW_X_MARKER_CFG = VisualizationMarkersCfg(
markers={
"contact": VisualizationMarkersCfg.MarkerCfg(
prim_type="Sphere",
color=(1.0, 0.0, 0.0),
attributes={"radius": 0.02},
),
"no_contact": VisualizationMarkersCfg.MarkerCfg(
visible=False,
prim_type="Sphere",
color=(0.0, 1.0, 0.0),
attributes={"radius": 0.02},
),
},
"arrow": sim_utils.UsdFileCfg(
usd_path=f"{ISAAC_NUCLEUS_DIR}/Props/UIElements/arrow_x.usd",
scale=(1.0, 0.1, 0.1),
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(1.0, 0.0, 0.0)),
)
}
)
"""Configuration for the contact sensor marker."""
"""Configuration for the red arrow marker (along x-direction)."""


ARROW_X_MARKER_CFG = VisualizationMarkersCfg(
BLUE_ARROW_X_MARKER_CFG = VisualizationMarkersCfg(
markers={
"arrow": VisualizationMarkersCfg.FileMarkerCfg(
"arrow": sim_utils.UsdFileCfg(
usd_path=f"{ISAAC_NUCLEUS_DIR}/Props/UIElements/arrow_x.usd",
scale=[1.0, 0.1, 0.1],
scale=(1.0, 0.1, 0.1),
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(0.0, 0.0, 1.0)),
)
}
)
"""Configuration for the arrow marker (along x-direction)."""
"""Configuration for the blue arrow marker (along x-direction)."""

CUBOID_MARKER_CFG = VisualizationMarkersCfg(
GREEN_ARROW_X_MARKER_CFG = VisualizationMarkersCfg(
markers={
"cuboid": VisualizationMarkersCfg.MarkerCfg(
prim_type="Cube",
"arrow": sim_utils.UsdFileCfg(
usd_path=f"{ISAAC_NUCLEUS_DIR}/Props/UIElements/arrow_x.usd",
scale=(1.0, 0.1, 0.1),
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(0.0, 1.0, 0.0)),
)
}
)
"""Configuration for the green arrow marker (along x-direction)."""


##
# Goals.
##

CUBOID_MARKER_CFG = VisualizationMarkersCfg(
markers={
"cuboid": sim_utils.CuboidCfg(
size=(0.1, 0.1, 0.1),
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(1.0, 0.0, 0.0)),
),
}
)
"""Configuration for the cuboid marker."""

POSITION_GOAL_MARKER_CFG = VisualizationMarkersCfg(
markers={
"target_far": sim_utils.SphereCfg(
radius=0.01,
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(1.0, 0.0, 0.0)),
),
"target_near": sim_utils.SphereCfg(
radius=0.01,
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(0.0, 1.0, 0.0)),
),
"target_invisible": sim_utils.SphereCfg(
radius=0.01,
visual_material=sim_utils.PreviewSurfaceCfg(diffuse_color=(0.0, 0.0, 1.0)),
visible=False,
),
}
)
"""Configuration for the end-effector tracking marker."""
Loading

0 comments on commit c561b49

Please sign in to comment.