Skip to content

Adopt the two-boolean backend convention; simplify the generator - #16

Merged
T-K-233 merged 1 commit into
mainfrom
feat/backend-arg-convention
Aug 22, 2026
Merged

Adopt the two-boolean backend convention; simplify the generator#16
T-K-233 merged 1 commit into
mainfrom
feat/backend-arg-convention

Conversation

@T-K-233

@T-K-233 T-K-233 commented Aug 20, 2026

Copy link
Copy Markdown
Member

Backend args

Backend selection followed no upstream convention: a use_sim / use_fake_hardware pair plus, on the ros2_control variants, a mode string naming a subset of joint groups.

  • Renamed the pair to sim_mujoco / use_mock_hardware — the spelling the Universal Robots description uses: one boolean per non-real backend, real hardware as the fallback.
  • Dropped mode entirely. No variant still has an optional group, and the stub-bus machinery it needed died with the arms_neck configuration.

sim_mujoco is deliberately not use_sim: it selects a hardware plugin and says nothing about the clock. use_sim_time remains a node parameter.

Backend-agnostic joint macros

With mode gone the joint macros no longer need to know which backend they are expanded for. They previously wrapped every hardware <param> in xacro:unless(use_sim or use_fake_hardware); now they always emit them, since mock_components and MujocoSystem both ignore params they do not recognise. That removes two params from every macro and two arguments from each of the ~250 instantiations.

Joints with a four-bar linkage move to their own <robot>_linkage_joint macro instead of carrying six defaulted params that only two joints in the repo ever set.

Also in this pass (no behaviour change)

  • lite_biped / lite_biped_debug point at humanoid_devices_witmotion/WitImuSensor, following the driver's rename out of humanoid_devices_imu_hardware.
  • The MJCF writer pretty-prints the trailing <sensor> / <actuator> sections and drops the stray blank lines, so models are reviewable as diffs instead of one 8 kB line.
  • urdf_to_xacro grew line-wrapping helpers (_pack, _macro_open) so generated macro signatures wrap at a column rather than being hand-spaced — this is what makes the artifact diffs as large as they are.
  • Docstring / README / package.xml prose brought in line, including a hardware-backend table.

Stacked on #15 (cad-extra) — merge that first, and this PR's base retargets to main automatically.

Verification

  • uv run --extra cad pytest — 1582 passed, 6 skipped
  • robot-assets-generate <variant> --only urdf,mjcf,xacro for all six variants reproduces the committed artifacts byte-for-byte

Downstream

Consumers passing use_sim:= / use_fake_hardware:= (and any mode:=) to a Lite xacro must move to sim_mujoco:= / use_mock_hardware:=.

🤖 Generated with Claude Code

https://claude.ai/code/session_014oX3bCSr6vo5CwPdrRfZGX

Base automatically changed from cad-extra to main August 22, 2026 00:04
@T-K-233
T-K-233 force-pushed the feat/backend-arg-convention branch from c611c3c to 581dc2b Compare August 22, 2026 00:06
Backend selection followed no upstream convention: a `use_sim` /
`use_fake_hardware` pair plus, on the ros2_control variants, a `mode` string
naming a subset of joint groups. Rename the pair to `sim_mujoco` /
`use_mock_hardware`, the spelling the Universal Robots description uses (one
boolean per non-real backend, real hardware as the fallback), and drop `mode`
entirely -- no variant still has an optional group, and the stub-bus machinery
it needed died with the arms_neck configuration.

`sim_mujoco` is deliberately not called `use_sim`: it selects a hardware
plugin, and nothing about the clock. `use_sim_time` remains a node parameter.

With that gone, the joint macros no longer need to know which backend they are
being expanded for. They previously wrapped every hardware <param> in
`xacro:unless(use_sim or use_fake_hardware)`; now they always emit them, since
mock_components and MujocoSystem both ignore params they do not recognise. That
removes two params from every macro and two arguments from every one of the
~250 instantiations. Joints with a four-bar linkage move to their own
`<robot>_linkage_joint` macro rather than carrying six defaulted params that
only two joints in the repo ever set.

Also in this pass, no behaviour change:

- lite_biped/lite_biped_debug point at humanoid_devices_witmotion/WitImuSensor,
  following the driver's rename out of humanoid_devices_imu_hardware.
- The MJCF writer pretty-prints the trailing <sensor>/<actuator> sections and
  drops the stray blank lines, so the models are reviewable as diffs instead of
  one 8 kB line.
- urdf_to_xacro grew line-wrapping helpers (_pack, _macro_open) so generated
  macro signatures wrap at a column instead of being hand-spaced, which is what
  makes the artifact diffs here as large as they are.
- Docstrings and the README/package.xml prose brought in line, including a
  hardware-backend table.

Verified: `pytest` green (1582 passed, 6 skipped), and regenerating every
variant with `--only urdf,mjcf,xacro` reproduces the committed artifacts
byte-for-byte.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014oX3bCSr6vo5CwPdrRfZGX
@T-K-233
T-K-233 force-pushed the feat/backend-arg-convention branch from 581dc2b to df73afd Compare August 22, 2026 00:57
@T-K-233
T-K-233 merged commit 2d75232 into main Aug 22, 2026
2 checks passed
@T-K-233
T-K-233 deleted the feat/backend-arg-convention branch August 22, 2026 01:01
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