hylo.codeagents.motion_characters¶
Package: hylo-code-agents · Core contracts
motion_characters ¶
Target characters of the motion studio: humanoid robots (MJCF) and rigged human characters (Blender), each
described by a short mapping file in motion_characters/
A mapping names, for every role of the studio's skeleton (pelvis, chest, head and, per side, hip, knee, ankle, toe, shoulder, elbow, wrist), where that point is on the character:
- kind "mjcf" (a robot or a simulated humanoid):
bodiesmaps a role to a body, or to [body, [x, y, z]] (an offset in the body frame, e.g. the toe in front of the ankle);feetare the two foot bodies (contact, sole flat);clearancekeeps hands and elbows that far from the body's midline (metres); the asset is a MuJoCo Menagerie folder at a pinned commit (menagerie: a manifest beside this module with a digest per file) or a builtin model. - kind "rig" (a skinned character, driven in Blender):
jointsmaps a role to a bone end ("Bone.head" or "Bone.tail");drivesays which bones move:pelvis(placed and turned with the hips),spine(bones that share the turn from the hips to the chest),neck, and per side upper_arm, forearm, thigh, shin, foot (turned so the segment between their joints points like the source's);attachpins a bone's head to another bone's end (an IK foot of the original rig);coloursoverrides material base colours (sRGB, by material name).height_mscales the character to that height. The asset is an archive fetched from its original page (archive: url, sha256, members to extract).
Every mapping records licence and credit. Robots are fetched from MuJoCo Menagerie and characters from their
authors' uploads, verified by digest, into the asset cache; nothing is vendored.
SIDE_ROLES
module-attribute
¶
ROLES
module-attribute
¶
ROLE_KP
module-attribute
¶
ROLE_KP = {'pelvis': 'Hips', 'chest': 'Chest', 'head': 'Head', **{f'{s}_{r}': f'{S}{k}' for s, S in (('left', 'Left'), ('right', 'Right')) for r, k in (('hip', 'Leg'), ('knee', 'Shin'), ('ankle', 'Foot'), ('toe', 'ToeBase'), ('shoulder', 'Arm'), ('elbow', 'ForeArm'), ('wrist', 'Hand'))}}
WEIGHTS
module-attribute
¶
WEIGHTS = {'pelvis': 3.0, 'chest': 1.5, 'head': 1.0, 'hip': 1.0, 'knee': 1.5, 'ankle': 2.0, 'toe': 1.0, 'shoulder': 1.0, 'elbow': 1.5, 'wrist': 2.0}
DRIVE_SIDE
module-attribute
¶
DRIVE_SIDE = {'upper_arm': ('shoulder', 'elbow'), 'forearm': ('elbow', 'wrist'), 'thigh': ('hip', 'knee'), 'shin': ('knee', 'ankle'), 'foot': ('ankle', 'toe')}
names ¶
The characters with a mapping file (optionally only one kind: "mjcf" or "rig").
load ¶
A character's mapping (validated; raises ValueError listing the problems).
validate ¶
Problems with a mapping's structure (an empty list when it is fine). Whether the bodies or bones exist in
the model is checked when the model is loaded (motion_sim validate, the Blender script).
menagerie_dir ¶
Where a Menagerie folder of manifest lives in the asset cache.
menagerie_assets ¶
A MuJoCo Menagerie model folder (its LICENSE kept) at the commit pinned in manifest (repo, commit, folder,
sha256 per file), fetched on first use from the original repository into the asset cache and verified file by
file; never vendored. Offline: copy that folder (the files listed in the manifest) to menagerie_dir() by hand.
archive_assets ¶
Fetch a character archive from its original page (verified by sha256), extract the listed members into the asset cache and return that folder.
mjcf_spec ¶
The robot description motion_sim needs (see its docstring) for an MJCF character.
rig_spec ¶
What the Blender script needs to drive a rigged character.
credits ¶
Source and licence of each character (for sources.json).