[Task Clean-up][Manager] Dexterous Part 5/8: Add the reorientation manager counterparts#6418
[Task Clean-up][Manager] Dexterous Part 5/8: Add the reorientation manager counterparts#6418hujc7 wants to merge 4 commits into
Conversation
Greptile SummaryThis PR rewrites the Allegro Hand manager-based reorientation environment to match the Direct task's observation, action, reward, reset, termination, and success contracts, and adds a Newton physics preset. It lands the shared MDP terms (commands, events, observations, rewards, terminations) that the upcoming Shadow manager parts 9–11 will reuse.
Confidence Score: 4/5Safe to merge for the Allegro scope; the The Allegro config is solid and validated on both PhysX and Newton. The main concern is
Important Files Changed
|
| def direct_reorient_timeout( | ||
| env: ManagerBasedRLEnv, | ||
| command_name: str, | ||
| reward_name: str, | ||
| success_tolerance: float, | ||
| max_successes: int, | ||
| object_cfg: SceneEntityCfg = SceneEntityCfg("object"), | ||
| ) -> torch.Tensor: | ||
| """Apply the Direct OpenAI progress-reset and timeout semantics. | ||
|
|
||
| Args: | ||
| env: Environment containing the object, goal, and reward term. | ||
| command_name: Goal command term name. | ||
| reward_name: Reorientation reward term name. | ||
| success_tolerance: Goal orientation tolerance [rad]. | ||
| max_successes: Goals after which the episode terminates. | ||
| object_cfg: Object scene entity. | ||
|
|
||
| Returns: | ||
| Per-environment timeout flags. | ||
| """ | ||
| object_asset = env.scene[object_cfg.name] | ||
| target_quat = env.command_manager.get_command(command_name)[:, 3:7] | ||
| goal_reached, _ = evaluate_reorient_success(object_asset.data.root_quat_w.torch, target_quat, success_tolerance) | ||
| env.episode_length_buf = torch.where( | ||
| goal_reached, | ||
| torch.zeros_like(env.episode_length_buf), | ||
| env.episode_length_buf, | ||
| ) | ||
| reward_term: DirectReorientReward = env.reward_manager.get_term_cfg(reward_name).func | ||
| max_success_reached = reward_term.successes >= max_successes | ||
| return (env.episode_length_buf >= env.max_episode_length - 1) | max_success_reached |
There was a problem hiding this comment.
Side-effecting termination mutates shared episode state
direct_reorient_timeout writes directly to env.episode_length_buf inside what the framework expects to be a stateless predicate. When a goal is reached the counter is zeroed, which effectively hides elapsed time from every other termination term evaluated after this one in the same step. If a second fall or out-of-reach termination runs after this one, the reset can mask conditions that had been accumulating. The function is not wired into the current Allegro config (direct_timeout is used instead), but the PR description states it will be adopted by the Shadow manager parts 9–11, so the risk will materialize.
| def reset(self, env_ids: Sequence[int] | None = None) -> None: | ||
| if env_ids is None: | ||
| env_ids = slice(None) | ||
| threshold = self.cfg.params["success_count_threshold"] | ||
| self._env.extras.setdefault("log", {})["Metrics/success_rate"] = ( | ||
| (self._successes[env_ids] >= threshold).float().mean().item() | ||
| ) | ||
| for statistic, value in self._orientation_error.reset(env_ids).items(): | ||
| self._env.extras["log"][f"Diagnostics/episode_min_orientation_error_{statistic}"] = value | ||
| self._successes[env_ids] = 0.0 |
There was a problem hiding this comment.
Partial-reset logging overwrites the global success-rate metric
reset is called with only the env_ids terminating in the current step; when a fraction of environments reset, the logged Metrics/success_rate reflects only that fraction and overwrites any earlier value from the same training step. Training dashboards may see a highly-variable or systematically biased metric depending on the batch composition at each reset boundary. Consider always computing the mean over all envs (ignoring env_ids) so the logged value is representative of the full population.
|
|
||
|
|
||
| @configclass | ||
| class ObservationsCfg: | ||
| """Full 124-dimensional state observation in Direct order.""" | ||
|
|
There was a problem hiding this comment.
set_num_envs double-writes the physx backend via its default alias
self.default is the same Python object as self.physx (assigned by default = physx), so self.default.num_envs = num_envs and self.physx.num_envs = num_envs are redundant. The second assignment is a no-op today but could confuse readers or silently break if default is ever re-pointed to a different backend.
| @configclass | |
| class ObservationsCfg: | |
| """Full 124-dimensional state observation in Direct order.""" | |
| def set_num_envs(self, num_envs: int) -> None: | |
| """Set the environment count on every backend alternative.""" | |
| self.physx.num_envs = num_envs | |
| self.newton_mjwarp.num_envs = num_envs | |
| self.ovphysx.num_envs = num_envs | |
| self.default = self.physx |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Add a behavioral Metrics/success_rate signal (goal-reach streaks per episode) and threshold-independent episode orientation-error diagnostics to the Direct reorientation environments, with the shared helpers in isaaclab_tasks.core.utils and torch math tests. The task logic is torch-first per the mainline convention; success gates task health while reward stays diagnostic. Also fix hand resets that could initialize joints below their lower position limits.
3b4f0cc to
d4d1290
Compare
…nager runtime (#6412) ## Summary - Fixes OVPhysX actuator joint indices to follow the common actuator indexing contract. - Fixes OVPhysX initialization alongside Kit by reusing Kit's registered PhysX schema provider. - Fixes the OVPhysX manager to support both the declared public runtime API and the current runtime API. - Regression tests included. Validated by full dexterous training runs on the OVPhysX backend; split out of the lumped validation branch #6324 (Part 2 of 11). ## Dependencies - None. ## Series review map Full integrated diff + training/validation evidence: the lumped validation PR #6324 (DO-NOT-MERGE). | Part | PR | |---|---| | Docs: regenerate the environment overview table | #6410 | | Part 1/11: Newton runtime fixes (cloner rows, cubric fallback, viz teardown) | #6411 | | **Part 2/11: OVPhysX runtime fixes (this PR)** | #6412 | | Part 3/11: success-rate metrics for the Direct reorientation tasks | #6413 | | Part 4/11: RSL-RL training for the handover Direct task | #6414 | | Part 5/11: success-rate support in the benchmark utilities | #6415 | | Part 6/11: renderer presets for the Direct camera task | #6416 | | Part 7/11: OVPhysX presets for the dexterous tasks | #6417 | | Part 8/11: Allegro manager counterpart | #6418 | | Part 9/11: Shadow + OpenAI manager counterparts | #6419 | | Part 10/11: Shadow camera manager counterpart | #6420 | | Part 11/11: Shadow handover manager counterpart | #6421 | --- ### Exact changes in this PR - OVPhysX backend changes + tests: 1f7a433
Fold the reviewed lump changes that belong to this part's content: - Share per-family sim settings through task-cfg base mixins. - Deduplicate backend scene presets via inner-class defaults and nest single-consumer helper cfgs in the shadow-hand Direct cfg. - Compute the orientation error through isaaclab.utils.math.quat_error_magnitude and delete the local direct_reorient_rotation_distance primitive. - Rename direct_reorient_reward to reorient_reward: shared symbols carry no paradigm prefix. Source commits on the lump branch: 2c22af0, 792e400, 42675b6, c6140f9, 173e9dc.
f8b3611 to
c5195e8
Compare
970a1cf to
da863b8
Compare
Part 3 share of the lump readability round (cdaadac): the Direct cfg files keep only task values; asset and marker cfgs, name lists, backend presets, and noise cfgs move to shadow_hand_common and allegro_hand_common, task geometry to reorient_common, and reorient_task_base is removed. The Shadow Direct files carry the workflow marker in their names.
Rebuilt from the reviewed lump so the manager counterparts land with the review rounds folded in: inline section values per file (drift guarded by the value-parity test incl. sim), identity from the common modules, the OpenAI variant in its own module, and no sim mixins. Lump review commits folded: 2c22af0, 792e400, 42675b6, 1f05f85, c6140f9, 173e9dc, 2727616, 1732493, 3659a33, ee272c9, cdaadac.
da863b8 to
957322a
Compare
Review Map
Summary
ReorientObjectEnvCfgand its terms are deprecated in favor of the Direct-compatible ones.Stacking
Validation