-
Notifications
You must be signed in to change notification settings - Fork 5
Add task <adjust_pose> and corresponding example <adjust_dexcube_pose> #305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
dbce802
Update docs link in the README. (#270)
alexmillane 790f25a
Cherrypick commits into 0.1.1 (#271)
xyao-nv b557d3f
multi-versioned docs (#272) (#300)
viiik-inside 94556e5
Fix/point to correct docs (#301)
viiik-inside 0212b1a
add warning to release (#303)
viiik-inside 2818018
Add task: adjust object pose.
Nyquist0 4ce3f4f
Merge remote-tracking branch 'origin/release/0.1.1' into lance/featur…
Nyquist0 ca8e9a0
Merge branch 'main' into lance/feature/adjust_pose_task
Nyquist0 5f4a5be
correct the wrongly changed file by automerge
Nyquist0 7224773
rename "adjust_pose" to "goal_pose"
Nyquist0 024faf6
update term func
Nyquist0 1feebaf
update dict to parameters with signature
Nyquist0 bff00f2
Merge branch 'main' into lance/feature/adjust_pose_task
Nyquist0 9cb9dc5
add franka init pose as a parameter
Nyquist0 1306a6e
remove duplicated DexCube
Nyquist0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,136 @@ | ||
| # Copyright (c) 2025, The Isaac Lab Arena Project Developers (https://github.com/isaac-sim/IsaacLab-Arena/blob/main/CONTRIBUTORS.md). | ||
| # All rights reserved. | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| import numpy as np | ||
| from dataclasses import MISSING | ||
|
|
||
| import isaaclab.envs.mdp as mdp_isaac_lab | ||
| from isaaclab.envs.common import ViewerCfg | ||
| from isaaclab.managers import EventTermCfg, SceneEntityCfg, TerminationTermCfg | ||
| from isaaclab.scene import InteractiveSceneCfg | ||
| from isaaclab.utils import configclass | ||
|
|
||
| from isaaclab_arena.assets.asset import Asset | ||
| from isaaclab_arena.metrics.metric_base import MetricBase | ||
| from isaaclab_arena.metrics.object_moved import ObjectMovedRateMetric | ||
| from isaaclab_arena.metrics.success_rate import SuccessRateMetric | ||
| from isaaclab_arena.tasks.task_base import TaskBase | ||
| from isaaclab_arena.tasks.terminations import goal_pose_task_termination | ||
| from isaaclab_arena.terms.events import set_object_pose | ||
| from isaaclab_arena.utils.cameras import get_viewer_cfg_look_at_object | ||
|
|
||
|
|
||
| class GoalPoseTask(TaskBase): | ||
| def __init__( | ||
| self, | ||
| object: Asset, | ||
| episode_length_s: float | None = None, | ||
| target_x_range: tuple[float, float] | None = None, | ||
| target_y_range: tuple[float, float] | None = None, | ||
| target_z_range: tuple[float, float] | None = None, | ||
| target_orientation_wxyz: tuple[float, float, float, float] | None = None, | ||
| target_orientation_tolerance_rad: float | None = None, | ||
| ): | ||
| """ | ||
| Args: | ||
| object: The object asset for the goal pose task. | ||
| episode_length_s: Episode length in seconds. | ||
| target_x_range: Success zone x-range [min, max] in meters. | ||
| target_y_range: Success zone y-range [min, max] in meters. | ||
| target_z_range: Success zone z-range [min, max] in meters. | ||
| target_orientation_wxyz: Target quaternion [w, x, y, z]. | ||
| target_orientation_tolerance_rad: Angular tolerance in radians (default: 0.1). | ||
| """ | ||
| super().__init__(episode_length_s=episode_length_s) | ||
| self.object = object | ||
| # this is needed to revise the default env_spacing in arena_env_builder: priority task > embodiment > scene > default | ||
| self.scene_config = InteractiveSceneCfg(num_envs=1, env_spacing=3.0, replicate_physics=False) | ||
| self.events_cfg = GoalPoseEventCfg(self.object) | ||
| self.termination_cfg = self.make_termination_cfg( | ||
| target_x_range=target_x_range, | ||
| target_y_range=target_y_range, | ||
| target_z_range=target_z_range, | ||
| target_orientation_wxyz=target_orientation_wxyz, | ||
| target_orientation_tolerance_rad=target_orientation_tolerance_rad, | ||
| ) | ||
|
|
||
| def get_scene_cfg(self): | ||
| return self.scene_config | ||
|
|
||
| def get_termination_cfg(self): | ||
| return self.termination_cfg | ||
|
|
||
| def make_termination_cfg( | ||
| self, | ||
| target_x_range: tuple[float, float] | None = None, | ||
| target_y_range: tuple[float, float] | None = None, | ||
| target_z_range: tuple[float, float] | None = None, | ||
| target_orientation_wxyz: tuple[float, float, float, float] | None = None, | ||
| target_orientation_tolerance_rad: float | None = None, | ||
| ): | ||
| params: dict = {"object_cfg": SceneEntityCfg(self.object.name)} | ||
| if target_x_range is not None: | ||
| params["target_x_range"] = target_x_range | ||
| if target_y_range is not None: | ||
| params["target_y_range"] = target_y_range | ||
| if target_z_range is not None: | ||
| params["target_z_range"] = target_z_range | ||
| if target_orientation_wxyz is not None: | ||
| params["target_orientation_wxyz"] = target_orientation_wxyz | ||
| if target_orientation_tolerance_rad is not None: | ||
| params["target_orientation_tolerance_rad"] = target_orientation_tolerance_rad | ||
|
|
||
| success = TerminationTermCfg( | ||
| func=goal_pose_task_termination, | ||
| params=params, | ||
| ) | ||
| return TerminationsCfg(success=success) | ||
|
|
||
| def get_events_cfg(self): | ||
| return self.events_cfg | ||
|
|
||
| def get_prompt(self): | ||
| raise NotImplementedError("Function not implemented yet.") | ||
|
|
||
| def get_mimic_env_cfg(self, embodiment_name: str): | ||
| raise NotImplementedError("Function not implemented yet.") | ||
|
|
||
| def get_metrics(self) -> list[MetricBase]: | ||
| return [ | ||
| SuccessRateMetric(), | ||
| ObjectMovedRateMetric(self.object), | ||
| ] | ||
|
|
||
| def get_viewer_cfg(self) -> ViewerCfg: | ||
| return get_viewer_cfg_look_at_object(lookat_object=self.object, offset=np.array([1.5, 1.5, 1.5])) | ||
|
|
||
|
|
||
| @configclass | ||
| class TerminationsCfg: | ||
| """Termination terms for the MDP.""" | ||
|
|
||
| time_out: TerminationTermCfg = TerminationTermCfg(func=mdp_isaac_lab.time_out) | ||
| success: TerminationTermCfg = MISSING | ||
|
|
||
|
|
||
| @configclass | ||
| class GoalPoseEventCfg: | ||
| """Configuration for goal pose.""" | ||
|
|
||
| reset_object_pose: EventTermCfg = MISSING | ||
|
|
||
| def __init__(self, object: Asset): | ||
| initial_pose = object.get_initial_pose() | ||
| if initial_pose is not None: | ||
| self.reset_object_pose = EventTermCfg( | ||
| func=set_object_pose, | ||
| mode="reset", | ||
| params={ | ||
| "pose": initial_pose, | ||
| "asset_cfg": SceneEntityCfg(object.name), | ||
| }, | ||
| ) | ||
| else: | ||
| raise ValueError(f"Initial pose is not set for the object {object.name}") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.