Skip to content

Move presets out of the product directories and add a common robot entry - #135

Draft
stevenaya wants to merge 6 commits into
enactic:mainfrom
stevenaya:refactor/common-robot-entry
Draft

stevenaya wants to merge 6 commits into
enactic:mainfrom
stevenaya:refactor/common-robot-entry

Conversation

@stevenaya

@stevenaya stevenaya commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Dependency

Stacked on #131 (feat/v2-cell-description). Until #131 lands the diff also shows the Cell assets it adds; nothing here modifies them, and the diff shrinks by itself once #131 is merged.

What

Whole-assembly presets described an assembly, not a product, but lived inside each product directory and were reachable only through that product's entry. Move them to a package-level presets/ tree and add one shared entry.

Before After
assets/robot/openarm_v1.0/config/robot_presets/ presets/v1/
assets/robot/openarm_v2.0/config/robot_presets/ presets/v2/
— urdf/openarm.urdf.xacro
— assets/common/robot.xacro (openarm_robot)
# shared entry, full preset identifier
xacro urdf/openarm.urdf.xacro robot_preset:=v2/cell_bimanual

# previews use the same entry
ros2 launch openarm_description display_openarm.launch.py robot_preset:=v2/cell_bimanual

presets/v1 and presets/v2 are preset groups only; they do not constrain component products.

Structure

  • assets/common/robot.xacro loads a preset, runs the existing assembly, applies the CAN defaults and overrides, emits ros2_control and leaves component_descriptions in the caller scope so scripts/preview_config.py can resolve final joint names from the same expansion.
  • urdf/openarm.urdf.xacro only declares arguments and calls that macro. Its defaults follow V2: robot_preset:=v2/default_bimanual, ros2_control:=true, use_fake_hardware:=true, plus can_interface, left_can_interface, right_can_interface and can_fd.
  • The V1 and V2 entries stay as thin wrappers. They keep their arguments, validation and defaults, translate a short preset name into v1/ or v2/, and call the same macro. No include-and-override trick is used.
  • The driver version now comes from the arm component product (openarm_v1.0 → v10, openarm_v2.0 → v20) instead of the entry argument. OpenArmHW rejects an unknown product instead of defaulting to V2; custom plugins are unaffected.
  • The unused robot-level config_root parameter chain is removed; the component-level config_root is untouched.
  • The describe_component / emit_component interfaces and the automatic urdf/component.xacro loading are unchanged.

Assembly name

Each preset declares the URDF robot name under robot.name:

robot:
  name: openarm_v20
  root_frame: world

The common macro exposes that name to the shared entry and both legacy wrappers. Entries no longer hardcode it. V1 presets retain openarm, while V2 presets retain openarm_v20, preserving the existing generated names. robot.name does not change root-frame, link or joint naming.

Packaging and calls

CMakeLists.txt installs presets/ and the shared entry only, so locally generated URDFs under urdf/ are not swept in. .gitignore still ignores generated files in that directory and tracks the entry. The release workflow exports from the shared entry with full preset identifiers, and the archive step now writes generated files into the existing urdf/ directory instead of renaming it.

Verification

  • Model equivalence: 35 old/new wrapper comparisons preserve model and control XML after ignoring comments and whitespace. These cover default settings, mock control and real-driver CAN overrides; Cell real hardware is excluded because no lifter plugin is configured.
  • Entries agree: all 12 presets produce matching shared-entry and wrapper models, including the root robot name. V1 emits openarm; V2, including Cell, emits openarm_v20. A custom preset name is also reflected by both the shared and legacy entry.
  • Tests: all 35 existing ROS 2 Jazzy tests pass. Only the existing fixture is updated with robot.name; no test functions or cases added.
  • Formatting: autopep8 and cmake-format clean.
  • Installed package: built and sourced, then expanded v1/default_bimanual (26 links), v1/default_single (13), v2/default_bimanual (34) and v2/cell_bimanual (36); legacy entries still expand from the install.
  • Preview: ros2 launch … robot_preset:=v2/cell_bimanual opens the Cell with its preset camera and joint4 = 1.5708; arm_type:=v10 robot_preset:=left_arm resolves to v1/left_arm.

Not included

No mesh, mass, inertia, limit or mirror changes; no new component interface or preset dispatch field; no preset inheritance or external loading; the legacy entries and arm_only.rviz are kept; ROS and Isaac repositories are untouched. The three name_mapping.yaml removals and the matching ignore rule belong to #134 and are not part of this branch.

The presets describe whole assemblies, not components, so they no longer live
inside a product directory.  Move the V1 and V2 files unchanged into
presets/v1 and presets/v2, and point the two product entries, the display
launch file and the tests at the new location.

All 60 shipped preset expansions (six V1 and six V2 presets across the default,
grasp-frame, real-hardware and CAN combinations) are byte-identical before and
after the move.
Introduce assets/common/robot.xacro with the openarm_robot macro. It loads a
package-level preset, runs the existing component assembly, applies the CAN
defaults and overrides, emits ros2_control and leaves component_descriptions in
the caller scope for the preview tools.

Add urdf/openarm.urdf.xacro as the shared entry and reduce the two product
entries to thin wrappers: they keep their arguments, defaults and validation,
translate a short preset name into v1/ or v2/, and call the same macro. The
driver version is now taken from the arm component product instead of the entry
argument, OpenArmHW rejects unknown products, and the unused robot-level
config_root chain is gone.

All 60 shipped preset expansions stay byte-identical through the wrappers, and
the wrappers, the shared entry, the release artifacts and the V2 defaults agree
on every preset.
The display launch file now always expands urdf/openarm.urdf.xacro. It accepts
a full preset identifier, completes a short name from arm_type, and keeps the
historical default selection when no preset is given; the resolved identifier is
the only thing used downstream.

Install the preset tree and the shared entry, and export the release URDFs from
the shared entry with full preset identifiers. The archive step now writes the
generated files into the existing urdf directory instead of renaming it.

Verified from an installed package: the shared entry expands every preset, the
legacy entries still expand, ros2 launch opens the Cell preview with its preset
view and 90 degree elbow pose, and ros2 launch with a short V1 name resolves to
v1/left_arm.
@stevenaya
stevenaya force-pushed the refactor/common-robot-entry branch from ae47303 to 50504c4 Compare November 11, 2026 10:41

This branch was successfully deployed

1 active deployment
release — fa739947 Deployed Nov 11, 2026 by stevenaya via Publish #503
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.

1 participant