Add planning group world queries#2695
Conversation
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
Greptile SummaryThis PR teaches world backends (Drake and RoboPlan) and
Confidence Score: 5/5Safe to merge — the new group-scoped FK/Jacobian paths are well-isolated behind explicit group IDs, and the legacy wrappers fail loudly rather than silently producing wrong results. All group-lookup, stale-state, and no-pose-group conditions are tested end-to-end across Drake, RoboPlan, and WorldMonitor. The only finding is a diagnostic message that says 'IK result' on a code path that handles current robot state, which won't affect correctness. The refactored _joint_state_to_q in both backends now uses the shared joint_state_to_ordered_positions, and both validation-before-mutation patterns correctly prevent partial state corruption. No files require special attention beyond the single diagnostic message in dimos/manipulation/planning/groups/utils.py. Important Files Changed
Sequence Diagram%%{init: {'theme': 'neutral'}}%%
sequenceDiagram
participant Caller
participant WorldMonitor
participant PlanningGroupRegistry
participant WorldSpec
Caller->>WorldMonitor: get_group_ee_pose(group_id, joint_state?)
WorldMonitor->>PlanningGroupRegistry: get(group_id) → PlanningGroup
WorldMonitor->>WorldMonitor: _robot_ids_by_name[group.robot_name] → robot_id
alt joint_state is None
WorldMonitor->>WorldMonitor: is_state_stale? → raise stale
WorldMonitor->>WorldMonitor: get_current_joint_state(robot_id) → None? raise unavailable
end
WorldMonitor->>WorldSpec: scratch_context() → ctx
WorldMonitor->>WorldSpec: set_joint_state(ctx, robot_id, joint_state)
WorldMonitor->>WorldSpec: get_group_ee_pose(ctx, group_id)
WorldSpec->>WorldSpec: _planning_group_from_id(group_id) → group
WorldSpec->>WorldSpec: GetBodyByName(group.tip_link) → ee_body
WorldSpec-->>WorldMonitor: PoseStamped
WorldMonitor-->>Caller: PoseStamped
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
sequenceDiagram
participant Caller
participant WorldMonitor
participant PlanningGroupRegistry
participant WorldSpec
Caller->>WorldMonitor: get_group_ee_pose(group_id, joint_state?)
WorldMonitor->>PlanningGroupRegistry: get(group_id) → PlanningGroup
WorldMonitor->>WorldMonitor: _robot_ids_by_name[group.robot_name] → robot_id
alt joint_state is None
WorldMonitor->>WorldMonitor: is_state_stale? → raise stale
WorldMonitor->>WorldMonitor: get_current_joint_state(robot_id) → None? raise unavailable
end
WorldMonitor->>WorldSpec: scratch_context() → ctx
WorldMonitor->>WorldSpec: set_joint_state(ctx, robot_id, joint_state)
WorldMonitor->>WorldSpec: get_group_ee_pose(ctx, group_id)
WorldSpec->>WorldSpec: _planning_group_from_id(group_id) → group
WorldSpec->>WorldSpec: GetBodyByName(group.tip_link) → ee_body
WorldSpec-->>WorldMonitor: PoseStamped
WorldMonitor-->>Caller: PoseStamped
Reviews (3): Last reviewed commit: "test: fix joint state ordering assertion" | Re-trigger Greptile |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Problem
Planning-group definitions exist, but world backends and monitors still answered FK, Jacobian, and state queries through robot-scoped APIs. Callers needed to infer tip frames and local/global joint mappings instead of querying a selected planning group directly.
Closes: N/A
Solution
WorldSpecand implement them for Drake and RoboPlan.How to Test
API change, so only unit tests
Contributor License Agreement