Skip to content

Add URRobotCfg: UR family (ur3/3e/5/5e/10/10e)#331

Open
yuecideng wants to merge 2 commits into
feat/robot-unified-protocolfrom
feat/ur-robot
Open

Add URRobotCfg: UR family (ur3/3e/5/5e/10/10e)#331
yuecideng wants to merge 2 commits into
feat/robot-unified-protocolfrom
feat/ur-robot

Conversation

@yuecideng

Copy link
Copy Markdown
Contributor

Description

Adds URRobotCfg — a single RobotCfg subclass covering the Universal Robots UR family (UR3, UR3e, UR5, UR5e, UR10, UR10e), selected via robot_type. Built with the /add-robot skill on top of the unified robot protocol from #330.

from embodichain.lab.sim.robots import URRobotCfg
cfg = URRobotCfg.from_dict({"robot_type": "ur5"})
robot = sim.add_robot(cfg=cfg)

Design

  • One class, six variantsrobot_type picks the URDF, joint-name casing, and per-variant drive defaults. The kinematic (DH) parameters are owned by URSolverCfg (its __post_init__ already sets them per ur_type); the robot config owns the URDF, control parts, drive properties, and rigid-body attributes.
  • Scale-aware defaultsdrive_pros.max_effort is sized per variant (UR3/UR3e ≈ 56 N·m, UR5/UR5e ≈ 150 N·m, UR10/UR10e ≈ 330 N·m; sim defaults, not factory specs).
  • UR5 joint-name quirk — the UR5 URDF uses lowercase joint1joint6 while every other variant uses Joint1Joint6; _build_defaults selects the correct casing per robot_type.
  • Follows the protocol — 3-line from_dict, variant-aware _build_defaults, build_pk_serial_chain routed through _pk_urdf_path, inherited to_dict/save_to_file (round-trips).

Prerequisite fix

URSolverCfg did not set class_type (it inherited "BaseSolver" from SolverCfg), so from_dict round-tripping looked up a nonexistent BaseSolverCfg and failed. Added class_type: str = "URSolver" (matches the OPWSolverCfg/SRSSolverCfg pattern). This was a latent bug — URSolverCfg could not be deserialized from a dict before. The existing UR solver IK tests still pass.

Docs

  • New docs/source/resources/robot/ur_robot.md + registered in resources/robot/index.rst.
  • __main__ smoke test in ur_robot.py (add to sim + round-trip check).

Dependencies

Dependencies: none beyond #330.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Enhancement (non-breaking change which improves an existing functionality)
  • Breaking change (existing functionality will not work without user modification)
  • Documentation update

Screenshots

N/A.

Checklist

  • I have run the black . command to format the code base.
  • I have made corresponding changes to the documentation (new ur_robot.md + index entry).
  • I have added tests that prove my feature works (tests/sim/objects/test_robot_cfg.py: 6× from_dict per variant, 6× round-trip, 6× DOF drift guard, default-type, max-effort-scales-with-size, unknown-type-raises — 21 UR tests; 28 cfg tests total green). Sim smoke: UR3/UR5/UR10 load into SimulationManager with 6-DOF arm. Existing UR solver IK tests unaffected.
  • Dependencies have been updated, if applicable.

yuecideng and others added 2 commits June 26, 2026 10:18
One RobotCfg subclass switchable via robot_type; DH params owned by
URSolverCfg, the robot config owns URDF/control parts/drive props/attrs.
Per-variant max_effort scaled by robot size; UR5's lowercase joint names
handled explicitly. Routes build_pk_serial_chain through _pk_urdf_path.

Also fixes URSolverCfg.class_type (inherited "BaseSolver" -> "URSolver")
so the solver can be deserialized from a dict (enables cfg round-trip).

Co-Authored-By: Claude <noreply@anthropic.com>
Adds docs/source/resources/robot/ur_robot.md and registers it in
resources/robot/index.rst. Adds a __main__ block to ur_robot.py that
adds the robot to a sim and checks the to_dict round-trip.

Co-Authored-By: Claude <noreply@anthropic.com>
@yuecideng yuecideng added enhancement New feature or request robot Module related to robot labels Jun 26, 2026
@yuecideng yuecideng requested a review from matafela June 26, 2026 03:47
)

self.attrs = RigidBodyAttributesCfg(
mass=1.0,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1.0 kg can be too heavy for links near robot flange. Should we use 0.1 kg or just use mass from urdf link inertia tag?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually the mass will be ignored for asset loading (we set replace_inertia=False as default). I will remove it (and the other params that can be removed as well) directly from the config,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request robot Module related to robot

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants