Files
UniversalTrain-ai/assets/go1_example/controls.yaml
T
chenlin c32df70326
Checks / Layout, translation and Colab checks (push) Has been cancelled
Checks / Ruff (push) Has been cancelled
Checks / Framework tests (native backend, CPU) (push) Has been cancelled
Checks / Portable Rust controller (push) Has been cancelled
release: v0.1 generic robot training and application platform
2026-11-05 11:05:01 +08:00

98 lines
4.3 KiB
YAML

# go1_example operator controls -- how a person's input becomes the command the
# policy observes.
#
# Generated by `.claude/skills/controls/scripts/write_controls.py`, which takes
# every control name from `controller/vocabulary.json`. Run
# `python -m controller --vocabulary` to see the list; it is the same one the
# deployed controller refuses a binding against.
#
# The pad and the keyboard are two paths, each bound straight to the command
# axes -- a stick with a sign, a key with the direction it pushes -- and
# neither names a control of the other. Either device drives alone; the one
# touched last drives.
#
# Two rules this file inherits from the specification it replaced:
# * Every value carries its source. A number without one cannot be told
# apart from a guess.
# * A consumer fails on a missing or malformed value rather than
# substituting a default. A sign that defaults to +1 is a robot that walks
# backwards while the screen looks perfectly normal.
schema_version: 2
command:
- term: twist
# The observation term these numbers are written into.
feeds: velocity_commands
# The robot's own frame: +X forward, +Y left, +Z up (ROS REP-103).
frame: body
# Order is the order the command term writes them, and therefore the order
# they appear in the observation.
axes:
- name: lin_vel_x
unit: m/s
positive: forward
- name: lin_vel_y
unit: m/s
positive: left
- name: ang_vel_z
unit: rad/s
positive: counter-clockwise
scaling:
# Full deflection is the edge of the range the policy was **trained** on,
# not an absolute speed -- so a stick means "as fast as this policy was
# ever asked to go" and cannot ask for something off-distribution.
rule: full_deflection_is_range_edge
formula: axis * (range_max if axis >= 0 else -range_min)
# A range like (-0.5, 1.0) gives forward twice what it gives back, which is
# what the policy trained on; taking the larger end for both quietly
# commands something it never saw.
ends_scaled_separately: true
devices:
gamepad:
# The stick position *is* the command.
scheme: absolute
layout: xbox
axes:
lin_vel_x: { source: Ly, sign: -1 }
lin_vel_y: { source: Lx, sign: -1 }
ang_vel_z: { source: Rx, sign: -1 }
# MEASURED: the signs are not measured against the robot's pad service.
# `controller/xbox.py` states the same evdev convention -- ABS_Y positive
# is **down**, ABS_X positive is **right** -- and the service passes both
# through unchanged, negating `dpad_y` and not `Ly`. Pushing the stick on
# the robot is what would settle it.
#
# The service applies a 0.15 deadband and **rescales**, so full deflection
# still reaches ±1. A consumer that applies its own on top narrows the
# range a person can ask for and cannot tell that it has.
deadzone: device_reported_rescaled
# Hands the command back to the random sampler in `play --task`; on a robot, which
# has no sampler, it lets go of everything.
release_button: B
keyboard:
# Keystrokes bound to what they do: each pushes one direction of one axis,
# "+" being the axis's own positive direction as `positive:` above words
# it, so the keyboard has no signs of its own -- there is no stick for a
# sign to be relative to. A virtual pad read through the pad's mapping
# until 2026-09-29.
scheme: keys
# Seconds a key is held for full deflection: the axis climbs linearly
# until then and is back at rest the moment the key comes up, as a stick
# let go of. Asked for on 2026-09-26; measured against nothing.
full_after_s: 2.0
axes:
# W S and the arrows walk, A D and the arrows step sideways, J L turn:
# the layout as the user
# decided it on 2026-09-29. Every letter is also a MuJoCo viewer
# shortcut -- W flips the scene to wireframe -- which was accepted for a
# keyboard laid out for the hands; left and right also step a paused
# scene.
lin_vel_x: { "+": [key_w, key_up], "-": [key_s, key_down] }
lin_vel_y: { "+": [key_a, key_left], "-": [key_d, key_right] }
ang_vel_z: { "+": [key_j], "-": [key_l] }
# Lets go of everything, as the pad's release button does.
release: [key_escape]