From 8767e047f4d1e8fd2acadc409f477ad324426a2a Mon Sep 17 00:00:00 2001 From: kellyguo11 Date: Fri, 3 Jan 2025 05:18:45 +0000 Subject: [PATCH] deploy: a29bea03bcc3e3365d47753d256ee9a4a14eb9eb --- .../rigid_object/rigid_object_data.html | 2 +- main/_modules/omni/isaac/lab/envs/common.html | 9 +- .../envs/ui/viewport_camera_controller.html | 46 +- main/genindex.html | 8 +- main/objects.inv | Bin 23778 -> 23789 bytes main/searchindex.js | 2 +- .../source/api/lab/omni.isaac.lab.assets.html | 2 +- main/source/api/lab/omni.isaac.lab.envs.html | 15 +- .../api/lab/omni.isaac.lab.envs.ui.html | 25 +- main/source/how-to/wrap_rl_env.html | 9 +- main/source/refs/changelog.html | 5445 +++++++++-------- 11 files changed, 2838 insertions(+), 2725 deletions(-) diff --git a/main/_modules/omni/isaac/lab/assets/rigid_object/rigid_object_data.html b/main/_modules/omni/isaac/lab/assets/rigid_object/rigid_object_data.html index 35f678c054..408111e707 100644 --- a/main/_modules/omni/isaac/lab/assets/rigid_object/rigid_object_data.html +++ b/main/_modules/omni/isaac/lab/assets/rigid_object/rigid_object_data.html @@ -719,7 +719,7 @@

Source code for omni.isaac.lab.assets.rigid_object.rigid_object_data

@property def body_link_state_w(self): """State of all bodies `[pos, quat, lin_vel, ang_vel]` in simulation world frame. - Shape is (num_instances,1, 13). + Shape is (num_instances, 1, 13). The position, quaternion, and linear/angular velocity are of the body's link frame relative to the world. """ diff --git a/main/_modules/omni/isaac/lab/envs/common.html b/main/_modules/omni/isaac/lab/envs/common.html index 2521ca6f23..1918ca224e 100644 --- a/main/_modules/omni/isaac/lab/envs/common.html +++ b/main/_modules/omni/isaac/lab/envs/common.html @@ -553,7 +553,7 @@

Source code for omni.isaac.lab.envs.common

     Default is (1280, 720).
     """
 
-    origin_type: Literal["world", "env", "asset_root"] = "world"
+    origin_type: Literal["world", "env", "asset_root", "asset_body"] = "world"
     """The frame in which the camera position (eye) and target (lookat) are defined in. Default is "world".
 
     Available options are:
@@ -561,6 +561,7 @@ 

Source code for omni.isaac.lab.envs.common

     * ``"world"``: The origin of the world.
     * ``"env"``: The origin of the environment defined by :attr:`env_index`.
     * ``"asset_root"``: The center of the asset defined by :attr:`asset_name` in environment :attr:`env_index`.
+    * ``"asset_body"``: The center of the body defined by :attr:`body_name` in asset defined by :attr:`asset_name` in environment :attr:`env_index`.
     """
 
     env_index: int = 0
@@ -573,6 +574,12 @@ 

Source code for omni.isaac.lab.envs.common

     """The asset name in the interactive scene for the frame origin. Default is None.
 
     This quantity is only effective if :attr:`origin` is set to "asset_root".
+    """
+
+    body_name: str | None = None
+    """The name of the body in :attr:`asset_name` in the interactive scene for the frame origin. Default is None.
+
+    This quantity is only effective if :attr:`origin` is set to "asset_body".
     """
diff --git a/main/_modules/omni/isaac/lab/envs/ui/viewport_camera_controller.html b/main/_modules/omni/isaac/lab/envs/ui/viewport_camera_controller.html index 152e45b91f..9cbb6031a9 100644 --- a/main/_modules/omni/isaac/lab/envs/ui/viewport_camera_controller.html +++ b/main/_modules/omni/isaac/lab/envs/ui/viewport_camera_controller.html @@ -532,6 +532,8 @@

Source code for omni.isaac.lab.envs.ui.viewport_camera_controller

import omni.kit.app import omni.timeline +from omni.isaac.lab.assets.articulation.articulation import Articulation + if TYPE_CHECKING: from omni.isaac.lab.envs import DirectRLEnv, ManagerBasedEnv, ViewerCfg @@ -576,12 +578,15 @@

Source code for omni.isaac.lab.envs.ui.viewport_camera_controller

self.set_view_env_index(self.cfg.env_index) # set the camera origin to the center of the environment self.update_view_to_env() - elif self.cfg.origin_type == "asset_root": + elif self.cfg.origin_type == "asset_root" or self.cfg.origin_type == "asset_body": # note: we do not yet update camera for tracking an asset origin, as the asset may not yet be # in the scene when this is called. Instead, we subscribe to the post update event to update the camera # at each rendering step. if self.cfg.asset_name is None: raise ValueError(f"No asset name provided for viewer with origin type: '{self.cfg.origin_type}'.") + if self.cfg.origin_type == "asset_body": + if self.cfg.body_name is None: + raise ValueError(f"No body name provided for viewer with origin type: '{self.cfg.origin_type}'.") else: # set the camera origin to the center of the world self.update_view_to_world() @@ -677,6 +682,41 @@

Source code for omni.isaac.lab.envs.ui.viewport_camera_controller

# update the camera view self.update_view_location()
+
[docs] def update_view_to_asset_body(self, asset_name: str, body_name: str): + """Updates the viewer's origin based upon the body of an asset in the scene. + + Args: + asset_name: The name of the asset in the scene. The name should match the name of the + asset in the scene. + body_name: The name of the body in the asset. + + Raises: + ValueError: If the asset is not in the scene or the body is not valid. + """ + # check if the asset is in the scene + if self.cfg.asset_name != asset_name: + asset_entities = [*self._env.scene.rigid_objects.keys(), *self._env.scene.articulations.keys()] + if asset_name not in asset_entities: + raise ValueError(f"Asset '{asset_name}' is not in the scene. Available entities: {asset_entities}.") + # check if the body is in the asset + asset: Articulation = self._env.scene[asset_name] + if body_name not in asset.body_names: + raise ValueError( + f"'{body_name}' is not a body of Asset '{asset_name}'. Available bodies: {asset.body_names}." + ) + # get the body index + body_id, _ = asset.find_bodies(body_name) + # update the asset name + self.cfg.asset_name = asset_name + # set origin type to asset_body + self.cfg.origin_type = "asset_body" + # update the camera origins + self.viewer_origin = ( + self._env.scene[self.cfg.asset_name].data.body_link_pos_w[self.cfg.env_index, body_id].view(3) + ) + # update the camera view + self.update_view_location()
+
[docs] def update_view_location(self, eye: Sequence[float] | None = None, lookat: Sequence[float] | None = None): """Updates the camera view pose based on the current viewer origin and the eye and lookat positions. @@ -706,7 +746,9 @@

Source code for omni.isaac.lab.envs.ui.viewport_camera_controller

# update the camera view if the origin is set to asset_root # in other cases, the camera view is static and does not need to be updated continuously if self.cfg.origin_type == "asset_root" and self.cfg.asset_name is not None: - self.update_view_to_asset_root(self.cfg.asset_name)
+ self.update_view_to_asset_root(self.cfg.asset_name) + if self.cfg.origin_type == "asset_body" and self.cfg.asset_name is not None and self.cfg.body_name is not None: + self.update_view_to_asset_body(self.cfg.asset_name, self.cfg.body_name)
diff --git a/main/genindex.html b/main/genindex.html index 9561a23cea..761e8f1741 100644 --- a/main/genindex.html +++ b/main/genindex.html @@ -1230,14 +1230,14 @@

B

  • (omni.isaac.lab.assets.RigidObjectData property)
  • - - + @@ -3251,6 +3252,9 @@

    Common

    asset_name

    The asset name in the interactive scene for the frame origin.

    +

    body_name

    +

    The name of the body in asset_name in the interactive scene for the frame origin.

    +

    @@ -3282,13 +3286,14 @@

    Common
    -origin_type: Literal['world', 'env', 'asset_root']#
    +origin_type: Literal['world', 'env', 'asset_root', 'asset_body']#

    The frame in which the camera position (eye) and target (lookat) are defined in. Default is “world”.

    Available options are:

    • "world": The origin of the world.

    • "env": The origin of the environment defined by env_index.

    • "asset_root": The center of the asset defined by asset_name in environment env_index.

    • +
    • "asset_body": The center of the body defined by body_name in asset defined by asset_name in environment env_index.

    @@ -3306,6 +3311,13 @@

    CommonThis quantity is only effective if origin is set to “asset_root”.

    +
    +
    +body_name: str | None#
    +

    The name of the body in asset_name in the interactive scene for the frame origin. Default is None.

    +

    This quantity is only effective if origin is set to “asset_body”.

    +
    + @@ -3548,6 +3560,7 @@

    CommonViewerCfg.origin_type
  • ViewerCfg.env_index
  • ViewerCfg.asset_name
  • +
  • ViewerCfg.body_name
  • diff --git a/main/source/api/lab/omni.isaac.lab.envs.ui.html b/main/source/api/lab/omni.isaac.lab.envs.ui.html index aa0c56c367..39f4fa83c0 100644 --- a/main/source/api/lab/omni.isaac.lab.envs.ui.html +++ b/main/source/api/lab/omni.isaac.lab.envs.ui.html @@ -600,6 +600,7 @@

    Contents

  • ViewportCameraController.update_view_to_world()
  • ViewportCameraController.update_view_to_env()
  • ViewportCameraController.update_view_to_asset_root()
  • +
  • ViewportCameraController.update_view_to_asset_body()
  • ViewportCameraController.update_view_location()
  • @@ -750,7 +751,10 @@

    Viewport Camera Controller

    update_view_to_asset_root(asset_name)

    Updates the viewer's origin based upon the root of an asset in the scene.

    -

    update_view_location([eye, lookat])

    +

    update_view_to_asset_body(asset_name, body_name)

    +

    Updates the viewer's origin based upon the body of an asset in the scene.

    + +

    update_view_location([eye, lookat])

    Updates the camera view pose based on the current viewer origin and the eye and lookat positions.

    @@ -832,6 +836,24 @@

    Viewport Camera Controller +
    +update_view_to_asset_body(asset_name: str, body_name: str)[source]#
    +

    Updates the viewer’s origin based upon the body of an asset in the scene.

    +
    +
    Parameters:
    +
      +
    • asset_name – The name of the asset in the scene. The name should match the name of the +asset in the scene.

    • +
    • body_name – The name of the body in the asset.

    • +
    +
    +
    Raises:
    +

    ValueError – If the asset is not in the scene or the body is not valid.

    +
    +
    +
    +
    update_view_location(eye: Sequence[float] | None = None, lookat: Sequence[float] | None = None)[source]#
    @@ -919,6 +941,7 @@

    Viewport Camera ControllerViewportCameraController.update_view_to_world()
  • ViewportCameraController.update_view_to_env()
  • ViewportCameraController.update_view_to_asset_root()
  • +
  • ViewportCameraController.update_view_to_asset_body()
  • ViewportCameraController.update_view_location()
  • diff --git a/main/source/how-to/wrap_rl_env.html b/main/source/how-to/wrap_rl_env.html index f51eaf9e7b..8f2ede2579 100644 --- a/main/source/how-to/wrap_rl_env.html +++ b/main/source/how-to/wrap_rl_env.html @@ -673,7 +673,7 @@

    Wrapper for recording videos Default is (1280, 720). """ - origin_type: Literal["world", "env", "asset_root"] = "world" + origin_type: Literal["world", "env", "asset_root", "asset_body"] = "world" """The frame in which the camera position (eye) and target (lookat) are defined in. Default is "world". Available options are: @@ -681,6 +681,7 @@

    Wrapper for recording videos * ``"world"``: The origin of the world. * ``"env"``: The origin of the environment defined by :attr:`env_index`. * ``"asset_root"``: The center of the asset defined by :attr:`asset_name` in environment :attr:`env_index`. + * ``"asset_body"``: The center of the body defined by :attr:`body_name` in asset defined by :attr:`asset_name` in environment :attr:`env_index`. """ env_index: int = 0 @@ -693,6 +694,12 @@

    Wrapper for recording videos """The asset name in the interactive scene for the frame origin. Default is None. This quantity is only effective if :attr:`origin` is set to "asset_root". + """ + + body_name: str | None = None + """The name of the body in :attr:`asset_name` in the interactive scene for the frame origin. Default is None. + + This quantity is only effective if :attr:`origin` is set to "asset_body". """ diff --git a/main/source/refs/changelog.html b/main/source/refs/changelog.html index 097b6c4208..66b483e7e6 100644 --- a/main/source/refs/changelog.html +++ b/main/source/refs/changelog.html @@ -581,1400 +581,1404 @@

    Contents