Skip to content

Commit 27d79fe

Browse files
committed
Merge the rebuilt handover and camera manager base
# Conflicts: # source/isaaclab_tasks/changelog.d/task-cleanup-dex-part08.major.rst # source/isaaclab_tasks/isaaclab_tasks/core/reorient/mdp/__init__.pyi # source/isaaclab_tasks/isaaclab_tasks/core/reorient/mdp/rewards.py # source/isaaclab_tasks/isaaclab_tasks/core/reorient/mdp/terminations.py # source/isaaclab_tasks/isaaclab_tasks/core/reorient/reorient_manager_env_cfg.py
2 parents 0b20fad + f86d21c commit 27d79fe

6 files changed

Lines changed: 10 additions & 609 deletions

File tree

source/isaaclab_tasks/changelog.d/task-cleanup-dex-part08.major.rst

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,14 @@ Added
1010
retraining).
1111
* Added a Newton physics preset to the manager-based Allegro environment.
1212

13-
Deprecated
14-
^^^^^^^^^^
13+
Removed
14+
^^^^^^^
1515

16-
* Deprecated the legacy manager-based reorientation configuration
17-
:class:`~isaaclab_tasks.core.reorient.reorient_manager_env_cfg.ReorientObjectEnvCfg`
18-
and the manager terms only it consumes (:func:`~isaaclab_tasks.core.reorient.mdp.success_bonus`,
19-
:func:`~isaaclab_tasks.core.reorient.mdp.track_pos_l2`,
20-
:func:`~isaaclab_tasks.core.reorient.mdp.track_orientation_inv_l2`,
21-
:func:`~isaaclab_tasks.core.reorient.mdp.max_consecutive_success`, and
22-
:func:`~isaaclab_tasks.core.reorient.mdp.object_away_from_goal`) in favor of
23-
the Direct-compatible manager configurations and terms (e.g.
16+
* Removed the legacy manager-based reorientation configuration
17+
``ReorientObjectEnvCfg`` and the manager terms only it consumed
18+
(``success_bonus``, ``track_pos_l2``, ``track_orientation_inv_l2``,
19+
``max_consecutive_success``, and ``object_away_from_goal``). Use the
20+
Direct-compatible manager configurations and terms instead (e.g.
2421
:class:`~isaaclab_tasks.core.reorient.mdp.ReorientReward` and
2522
:class:`~isaaclab_tasks.core.reorient.mdp.ReorientTimeout`).
2623

source/isaaclab_tasks/isaaclab_tasks/core/reorient/__init__.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,9 @@
88
This package consolidates the direct-workflow and manager-based-workflow in-hand
99
manipulation tasks, where a dexterous hand reorients an object to match a goal
1010
orientation. The shared direct base environment lives in
11-
:mod:`~isaaclab_tasks.core.reorient.reorient_direct_env` and the shared manager-based
12-
base configuration in :mod:`~isaaclab_tasks.core.reorient.reorient_manager_env_cfg`.
13-
Robot-specific tasks are organized under the ``config`` subpackage
14-
(``config/allegro_hand`` and ``config/shadow_hand``).
11+
:mod:`~isaaclab_tasks.core.reorient.reorient_direct_env`; the manager-based
12+
configurations live with their robot-specific tasks under the ``config``
13+
subpackage (``config/allegro_hand`` and ``config/shadow_hand``).
1514
1615
These environments are based on the `dexterous cube manipulation`_ environments
1716
provided in IsaacGymEnvs repository from NVIDIA. However, they contain certain

source/isaaclab_tasks/isaaclab_tasks/core/reorient/mdp/__init__.pyi

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,9 @@ __all__ = [
2121
"reorient_last_action",
2222
"OpenAIPolicyObservation",
2323
"goal_quat_diff",
24-
"success_bonus",
25-
"track_orientation_inv_l2",
26-
"track_pos_l2",
2724
"evaluate_reorient_success",
2825
"reorient_reward",
2926
"ReorientReward",
30-
"max_consecutive_success",
31-
"object_away_from_goal",
3227
"object_away_from_robot",
3328
"object_reorientation_out_of_reach",
3429
"ReorientTimeout",
@@ -56,14 +51,9 @@ from .rewards import (
5651
ReorientReward,
5752
reorient_reward,
5853
evaluate_reorient_success,
59-
success_bonus,
60-
track_orientation_inv_l2,
61-
track_pos_l2,
6254
)
6355
from .terminations import (
6456
ReorientTimeout,
65-
max_consecutive_success,
66-
object_away_from_goal,
6757
object_away_from_robot,
6858
object_reorientation_out_of_reach,
6959
)

source/isaaclab_tasks/isaaclab_tasks/core/reorient/mdp/rewards.py

Lines changed: 0 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from __future__ import annotations
99

10-
import warnings
1110
from collections.abc import Sequence
1211
from typing import TYPE_CHECKING
1312

@@ -22,123 +21,6 @@
2221
from isaaclab.assets import RigidObject
2322
from isaaclab.envs import ManagerBasedRLEnv
2423

25-
from .commands import ReorientCommand
26-
27-
28-
def success_bonus(
29-
env: ManagerBasedRLEnv, command_name: str, object_cfg: SceneEntityCfg = SceneEntityCfg("object")
30-
) -> torch.Tensor:
31-
"""Bonus reward for successfully reaching the goal.
32-
33-
.. deprecated:: 9.0.0
34-
Only consumed by the deprecated
35-
:class:`~isaaclab_tasks.core.reorient.reorient_manager_env_cfg.ReorientObjectEnvCfg`.
36-
Use :class:`ReorientReward` instead.
37-
38-
The object is considered to have reached the goal when the object orientation is within the threshold.
39-
The reward is 1.0 if the object has reached the goal, otherwise 0.0.
40-
41-
Args:
42-
env: The environment object.
43-
command_name: The command term to be used for extracting the goal.
44-
object_cfg: The configuration for the scene entity. Default is "object".
45-
"""
46-
if not getattr(success_bonus, "_deprecation_warned", False):
47-
success_bonus._deprecation_warned = True
48-
warnings.warn(
49-
"success_bonus() is deprecated; use ReorientReward instead.",
50-
DeprecationWarning,
51-
stacklevel=2,
52-
)
53-
# extract useful elements
54-
asset: RigidObject = env.scene[object_cfg.name]
55-
command_term: ReorientCommand = env.command_manager.get_term(command_name)
56-
57-
# obtain the goal orientation
58-
goal_quat_w = command_term.command[:, 3:7]
59-
# obtain the threshold for the orientation error
60-
threshold = command_term.cfg.orientation_success_threshold
61-
# calculate the orientation error
62-
dtheta = math_utils.quat_error_magnitude(asset.data.root_quat_w.torch, goal_quat_w)
63-
64-
return dtheta <= threshold
65-
66-
67-
def track_pos_l2(
68-
env: ManagerBasedRLEnv, command_name: str, object_cfg: SceneEntityCfg = SceneEntityCfg("object")
69-
) -> torch.Tensor:
70-
"""Reward for tracking the object position using the L2 norm.
71-
72-
.. deprecated:: 9.0.0
73-
Only consumed by the deprecated
74-
:class:`~isaaclab_tasks.core.reorient.reorient_manager_env_cfg.ReorientObjectEnvCfg`.
75-
Use :class:`ReorientReward` instead.
76-
77-
The reward is the distance between the object position and the goal position.
78-
79-
Args:
80-
env: The environment object.
81-
command_term: The command term to be used for extracting the goal.
82-
object_cfg: The configuration for the scene entity. Default is "object".
83-
"""
84-
if not getattr(track_pos_l2, "_deprecation_warned", False):
85-
track_pos_l2._deprecation_warned = True
86-
warnings.warn(
87-
"track_pos_l2() is deprecated; use ReorientReward instead.",
88-
DeprecationWarning,
89-
stacklevel=2,
90-
)
91-
# extract useful elements
92-
asset: RigidObject = env.scene[object_cfg.name]
93-
command_term: ReorientCommand = env.command_manager.get_term(command_name)
94-
95-
# obtain the goal position
96-
goal_pos_e = command_term.command[:, 0:3]
97-
# obtain the object position in the environment frame
98-
object_pos_e = asset.data.root_pos_w.torch - env.scene.env_origins
99-
100-
return torch.linalg.norm(goal_pos_e - object_pos_e, ord=2, dim=-1)
101-
102-
103-
def track_orientation_inv_l2(
104-
env: ManagerBasedRLEnv,
105-
command_name: str,
106-
object_cfg: SceneEntityCfg = SceneEntityCfg("object"),
107-
rot_eps: float = 1e-3,
108-
) -> torch.Tensor:
109-
"""Reward for tracking the object orientation using the inverse of the orientation error.
110-
111-
.. deprecated:: 9.0.0
112-
Only consumed by the deprecated
113-
:class:`~isaaclab_tasks.core.reorient.reorient_manager_env_cfg.ReorientObjectEnvCfg`.
114-
Use :class:`ReorientReward` instead.
115-
116-
The reward is the inverse of the orientation error between the object orientation and the goal orientation.
117-
118-
Args:
119-
env: The environment object.
120-
command_name: The command term to be used for extracting the goal.
121-
object_cfg: The configuration for the scene entity. Default is "object".
122-
rot_eps: The threshold for the orientation error. Default is 1e-3.
123-
"""
124-
if not getattr(track_orientation_inv_l2, "_deprecation_warned", False):
125-
track_orientation_inv_l2._deprecation_warned = True
126-
warnings.warn(
127-
"track_orientation_inv_l2() is deprecated; use ReorientReward instead.",
128-
DeprecationWarning,
129-
stacklevel=2,
130-
)
131-
# extract useful elements
132-
asset: RigidObject = env.scene[object_cfg.name]
133-
command_term: ReorientCommand = env.command_manager.get_term(command_name)
134-
135-
# obtain the goal orientation
136-
goal_quat_w = command_term.command[:, 3:7]
137-
# calculate the orientation error
138-
dtheta = math_utils.quat_error_magnitude(asset.data.root_quat_w.torch, goal_quat_w)
139-
140-
return 1.0 / (dtheta + rot_eps)
141-
14224

14325
@torch.jit.script
14426
def evaluate_reorient_success(

source/isaaclab_tasks/isaaclab_tasks/core/reorient/mdp/terminations.py

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
from __future__ import annotations
99

10-
import warnings
1110
from typing import TYPE_CHECKING
1211

1312
import torch
@@ -22,71 +21,6 @@
2221
from .commands import ReorientCommand
2322

2423

25-
def max_consecutive_success(env: ManagerBasedRLEnv, num_success: int, command_name: str) -> torch.Tensor:
26-
"""Check if the task has been completed consecutively for a certain number of times.
27-
28-
.. deprecated:: 9.0.0
29-
Only consumed by the deprecated
30-
:class:`~isaaclab_tasks.core.reorient.reorient_manager_env_cfg.ReorientObjectEnvCfg`.
31-
Use :class:`ReorientTimeout` instead.
32-
33-
Args:
34-
env: The environment object.
35-
num_success: Threshold for the number of consecutive successes required.
36-
command_name: The command term to be used for extracting the goal.
37-
"""
38-
if not globals().get("_warned_max_consecutive_success"):
39-
globals()["_warned_max_consecutive_success"] = True
40-
warnings.warn(
41-
"max_consecutive_success() is deprecated; use ReorientTimeout instead.",
42-
DeprecationWarning,
43-
stacklevel=2,
44-
)
45-
command_term: ReorientCommand = env.command_manager.get_term(command_name)
46-
47-
return command_term.metrics["consecutive_success"] >= num_success
48-
49-
50-
def object_away_from_goal(
51-
env: ManagerBasedRLEnv,
52-
threshold: float,
53-
command_name: str,
54-
object_cfg: SceneEntityCfg = SceneEntityCfg("object"),
55-
) -> torch.Tensor:
56-
"""Check if object has gone far from the goal.
57-
58-
The object is considered to be out-of-reach if the distance between the goal and the object is greater
59-
than the threshold.
60-
61-
.. deprecated:: 9.0.0
62-
Only consumed by the deprecated
63-
:class:`~isaaclab_tasks.core.reorient.reorient_manager_env_cfg.ReorientObjectEnvCfg`.
64-
Use :class:`object_reorientation_out_of_reach` instead.
65-
66-
Args:
67-
env: The environment object.
68-
threshold: The threshold for the distance between the robot and the object.
69-
command_name: The command term to be used for extracting the goal.
70-
object_cfg: The configuration for the scene entity. Default is "object".
71-
"""
72-
if not globals().get("_warned_object_away_from_goal"):
73-
globals()["_warned_object_away_from_goal"] = True
74-
warnings.warn(
75-
"object_away_from_goal() is deprecated; use object_reorientation_out_of_reach instead.",
76-
DeprecationWarning,
77-
stacklevel=2,
78-
)
79-
# extract useful elements
80-
command_term: ReorientCommand = env.command_manager.get_term(command_name)
81-
asset = env.scene[object_cfg.name]
82-
83-
# object pos
84-
asset_pos_e = asset.data.root_pos_w.torch - env.scene.env_origins
85-
goal_pos_e = command_term.command[:, :3]
86-
87-
return torch.linalg.norm(asset_pos_e - goal_pos_e, ord=2, dim=1) > threshold
88-
89-
9024
class object_reorientation_out_of_reach(ManagerTermBase):
9125
"""Terminate when object-to-goal distance is at least the threshold [m].
9226

0 commit comments

Comments
 (0)