Skip to content

Task: Add meaningful manipulation tests#1765

Open
mustafab0 wants to merge 7 commits intodevfrom
task/mustafa/fix-manip-tests
Open

Task: Add meaningful manipulation tests#1765
mustafab0 wants to merge 7 commits intodevfrom
task/mustafa/fix-manip-tests

Conversation

@mustafab0
Copy link
Copy Markdown
Contributor

Problem

The manipulation module used a single flat joint namespace which broke when multiple robots were connected — joint names collided and state updates routed to the wrong robot. Blueprint configs also had redundant or None patterns, and drake_world.py had dead code left over from a removed model cache.


Solution

Added unit tests for the two most critical pieces of new logic:

  • _on_joint_state: routing, splitting, missing-joint handling, init capture, multi-robot correctness
  • PickAndPlaceModule heuristics: object detection lookup, occlusion offset math, grasp orientation, place_back guard

Breaking Changes

joint_name_mapping on RobotModelConfig now uses / as the prefix separator (e.g. left/joint1 instead of left_joint1). Existing blueprints in this repo are already updated. External code that constructs RobotModelConfig with custom joint_name_mapping dicts needs to adopt the new convention.


How to Test

  1. Run the unit tests: pytest dimos/manipulation/test_manipulation_unit.py dimos/manipulation/test_pick_and_place_unit.py -v
  2. Run the full manipulation integration suite: pytest dimos/manipulation/ -v

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 9, 2026

Greptile Summary

This PR adds unit tests for ManipulationModule._on_joint_state (routing, splitting, init-joint capture, multi-robot correctness) and PickAndPlaceModule heuristics (object lookup, occlusion-offset math, grasp orientation, place_back guard), and removes a now-redundant test_robot_config.py. The test structure is sound and the coverage of the new joint-namespace logic is meaningful.

Confidence Score: 5/5

Safe to merge — all remaining findings are P2 test quality improvements, not correctness blockers.

The PR is test-only. Both P2 findings (missing _init_joints in _make_module() and the weak norm-only quaternion assertion) are quality/fragility concerns rather than defects in the tests that exist today. No production code is changed.

No files require special attention.

Vulnerabilities

No security concerns identified. All files are test-only additions/deletions with no production code paths, credential handling, or external input processing.

Important Files Changed

Filename Overview
dimos/manipulation/test_manipulation_unit.py New unit tests for ManipulationModule covering state machine, robot selection, joint-name translation, execute, and the critical _on_joint_state routing; generally sound but _make_module() omits _init_joints initialization, leaving tests one refactor away from an AttributeError.
dimos/manipulation/test_pick_and_place_unit.py New unit tests for PickAndPlaceModule covering object lookup, occlusion-offset math, grasp orientation, and place_back guard; the grasp-orientation near-object test only checks quaternion norm (always ~1), not the actual top-down orientation.

Sequence Diagram

sequenceDiagram
    participant Driver as JointState Driver
    participant MM as ManipulationModule
    participant Monitor as WorldMonitor

    Driver->>MM: _on_joint_state(aggregated_msg)
    MM->>MM: Build name-to-index map
    loop For each robot
        MM->>MM: get_coordinator_joint_names()
        alt All joints present
            MM->>MM: Extract sub-positions and sub-velocities
            MM->>Monitor: on_joint_state(sub_msg, robot_id)
            MM->>MM: Capture _init_joints on first call
        else Missing joints
            MM->>MM: Log warning and skip robot
        end
    end
Loading

Comments Outside Diff (1)

  1. dimos/manipulation/test_manipulation_unit.py, line 89-103 (link)

    P2 _make_module() missing _init_joints initialization

    _on_joint_state unconditionally reads self._init_joints (line 286 of manipulation_module.py) after the early if self._world_monitor is None: return guard. Any future test that uses _make_module() directly (instead of _make_module_with_monitor) and calls _on_joint_state with a non-None world monitor will hit AttributeError: 'ManipulationModule' object has no attribute '_init_joints'. _make_module_with_monitor adds this attribute, but the base helper does not.

Reviews (1): Last reviewed commit: "deleted unnecessary robot config test" | Re-trigger Greptile

@mustafab0 mustafab0 force-pushed the task/mustafa/fix-manip-tests branch from ae279fb to 4e1c032 Compare April 9, 2026 21:08
@mustafab0 mustafab0 force-pushed the task/mustafa/fix-manip-tests branch from 4e1c032 to 1fae3a1 Compare April 9, 2026 23:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants