Repository navigation
Removes Single Articulation Dependencies in RMPflow - #4800
Conversation
|
@ooctipus Is this good to merge? We (@rebeccazhang0707) tested it and it works on our end :) |
Signed-off-by: Kelly Guo <[email protected]>
Greptile SummaryThis PR removes the Key changes:
Issues found:
Confidence Score: 3/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Env as ManagerBasedEnv
participant Action as RMPFlowAction
participant Controller as RmpFlowController
participant Lula as RmpFlow (Lula)
Note over Action,Controller: reset() — called on env reset
Env->>Action: reset(env_ids)
Action->>Controller: initialize(num_envs, joint_names)
loop for each robot
Controller->>Lula: RmpFlow(...) — new instance
Controller->>Lula: get_active_joints()
Controller->>Lula: get_watched_joints()
Note over Controller: build active_indices, watched_indices<br/>from joint_names lookup (KeyError risk)
end
Note over Action,Controller: process_actions() — called each env.step()
Env->>Action: process_actions(actions)
Action->>Controller: set_command(ee_pose_des)
Note over Action,Controller: apply_actions() — called each sim.step()
Env->>Action: apply_actions()
Action->>Action: _compute_frame_pose()
alt ee_quat norm != 0
Action->>Controller: compute(joint_pos, joint_vel)
loop for each robot
Controller->>Lula: set_end_effector_target(pos, orientation)
Controller->>Controller: slice active_pos, active_vel,<br/>watched_pos, watched_vel via indices
Controller->>Lula: compute_joint_targets(active_pos, active_vel,<br/>watched_pos, watched_vel, dt)
Lula-->>Controller: pos_targets, vel_targets
end
Controller-->>Action: dof_pos_target, dof_vel_target
else ee_quat norm == 0
Action->>Action: joint_pos_des = current joint_pos
Action->>Action: joint_vel_des = zeros
end
Action->>Env: set_joint_position_target_index(...)
Action->>Env: set_joint_velocity_target_index(...)
Last reviewed commit: d1f0dc2 |
| active_indices = np.array([name_to_idx[n] for n in rmpflow.get_active_joints()], dtype=np.intp) | ||
| watched_indices = np.array([name_to_idx[n] for n in rmpflow.get_watched_joints()], dtype=np.intp) |
There was a problem hiding this comment.
KeyError gives no diagnostic context on joint name mismatch
If any joint name returned by rmpflow.get_active_joints() or rmpflow.get_watched_joints() is not present in the joint_names list provided by the articulation, a bare KeyError is raised with no indication of which joint is missing, what the full set of expected joints is, or which robot index caused the failure. This makes misconfiguration extremely hard to debug.
Consider a pre-validation step with an explicit error message:
active_joint_names = rmpflow.get_active_joints()
watched_joint_names = rmpflow.get_watched_joints()
missing = [n for n in active_joint_names + watched_joint_names if n not in name_to_idx]
if missing:
raise ValueError(
f"RMPflow joints {missing} not found in articulation joint_names. "
f"Available joints: {joint_names}"
)
active_indices = np.array([name_to_idx[n] for n in active_joint_names], dtype=np.intp)
watched_indices = np.array([name_to_idx[n] for n in watched_joint_names], dtype=np.intp)| def reset(self, env_ids: Sequence[int] | None = None) -> None: | ||
| self._raw_actions[env_ids] = 0.0 | ||
| self._rmpflow_controller.initialize(self.cfg.articulation_prim_expr) | ||
| self._rmpflow_controller.initialize(self.num_envs, list(self._asset.joint_names)) |
There was a problem hiding this comment.
initialize called on every reset, even for partial resets
reset is called with a subset of env_ids during normal training (e.g., when only some environments terminate), yet initialize unconditionally rebuilds all num_robots RMPflow policy instances — including downloading/resolving all config files in a loop. This is both expensive and semantically incorrect: environments that are not being reset have their controller state silently discarded and recreated.
The reset_idx method on the controller already handles per-robot policy resets efficiently. Consider only calling initialize once (e.g., during first setup) and forwarding env_ids to reset_idx on subsequent calls:
def reset(self, env_ids: Sequence[int] | None = None) -> None:
self._raw_actions[env_ids] = 0.0
if not hasattr(self._rmpflow_controller, 'num_robots'):
# First-time initialization
self._rmpflow_controller.initialize(self.num_envs, list(self._asset.joint_names))
else:
ids = torch.tensor(list(env_ids), device=self.device) if env_ids is not None else None
self._rmpflow_controller.reset_idx(ids)
Description
This PR removes SingleArticulation dependencies from isaacsim in rmpflow controller implementation, should make rmpflow dependent environments work again.
this should help #4744
Fixes # (issue)
Type of change
Screenshots
Please attach before and after screenshots of the change if applicable.
Checklist
pre-commitchecks with./isaaclab.sh --formatconfig/extension.tomlfileCONTRIBUTORS.mdor my name already exists there