Adding a New Robot#
This guide provides a practical checklist and reference for adding a new robot to EmbodiChain.
Official concrete presets live in embodichain_robots; generic robot runtime
and dual-arm composition remain in the core. Use Robot Catalog for
catalog registration, display metadata, and canonical import paths.
The protocol#
Every robot config subclasses RobotCfg and
overrides two hooks:
_build_defaults(self, init_dict=None)— populateurdf_cfg,control_parts,solver_cfg,joint_drive_propsandattrsfrom variant fields read out ofinit_dict.build_pk_serial_chain(self, device=...)— return a{control_part: pk.SerialChain}mapping, reading the PK URDF from a single_pk_urdf_pathsource (so it cannot drift from the sim URDF).
The from_dict is a 3-line template (do not reimplement it):
cfg = cls()
cfg._build_defaults(init_dict)
return merge_robot_cfg(cfg, init_dict)
Serialization (to_dict / to_string / save_to_file) is inherited from
RobotCfg and round-trips: RobotCfg.from_dict(cfg.to_dict()) reproduces the cfg.
Checklist#
Prepare the URDF — publish versioned URDF/mesh resources and declare their asset class in the owning vendor/model package. Register the class through the lightweight robot asset catalog; reuse the core download/cache implementation.
Override
_build_defaults(self, init_dict=None)— set variant fields frominit_dict, then populateurdf_cfg/control_parts/solver_cfg/joint_drive_props/attrs.Define control parts — use
arm/eeffor official single-arm defaults andleft_arm/right_arm/left_eef/right_eeffor dual-arm defaults. Custom names remain valid.Configure the IK solver —
OPWSolverCfg(6-DOF),SRSSolverCfg(7-DOF), or a genericSolverCfg.Set drive properties — stiffness/damping/max_effort per joint group.
Implement
build_pk_serial_chainreading from_pk_urdf_path.Keep
from_dictas the 3-line template — do not reimplement.Register the official preset’s lazy export in
embodichain_robots/__init__.pyand its ID, class import path, defaults, and control metadata inembodichain_robots/_catalog.py. External packages advertise a catalog through anembodichain.robotsentry point.Add documentation —
docs/source/resources/robot/<name>.md+ updateresources/robot/index.rst.Test — a
__main__smoke test + the DOF drift guard +preview-assetCLI.
Refresh the editable install after changing package entry-point metadata, then
run embodichain list-robot and verify variants, independent DOFs, default
control groups, and mimic followers against the selected URDF/configuration.
Keep catalog modules and package initializers lightweight so discovery does not
load robot implementations or download assets.
Approaches#
Single-file:
<vendor>/<model>.pywhen archives are shared at vendor level.Package:
<vendor>/<model>/for model-owned assets, revisions or calibrations. Keepcfg.py,assets.py, optional specification/type helpers, and a lazy__init__.pytogether. Asset imports must not load configuration modules.
Asset classes register through embodichain_robots/_asset_catalog.py and the
embodichain.assets entry point. Each asset ID declares a class_path and
category. Keep source versions, checksums and cache prefixes with the asset;
the core owns reusable download, locking and extraction machinery.
Key parameters#
Parameter |
Type |
Description |
|---|---|---|
|
str |
Unique robot identifier |
|
URDFCfg |
URDF file and components |
|
Dict[str, List[str]] |
Joint groups for control |
|
Dict[str, SolverCfg] |
IK solver configurations |
|
JointDrivePropertiesCfg |
Joint drive, limits, friction |
|
RigidBodyPhysicsCfg |
Grouped rigid-body physics |
variant fields |
enum / str / bool |
Optional subclass fields, such as |
|
property or method → str |
URDF for the FK/IK serial chain |
Common mistakes#
Mistake |
Fix |
|---|---|
|
Use |
|
Set it once in |
PK URDF drifts from sim URDF |
Route PK through |
Reimplementing |
Keep the 3-line template; put logic in |
|
It must be a |
Calling a nonexistent |
Don’t call methods that don’t exist. |
See Also#
Simulating a Robot — Using robots in simulation
Solvers — IK solver reference
Supported Robots — Existing robot documentation