-
Notifications
You must be signed in to change notification settings - Fork 12
YAML Reference
项目存在三类 YAML:遥控器映射、状态机系统配置和 Mod 清单。
主文件:
src/remote_controller/config/xbox_default.yaml
顶层结构:
inputs:
selection: {}
sources: {}
curves: {}
controls: {}
outputs: {}
system: {}
system_mutexes: {}
system_reset_motion_after: []| 字段 | 含义 |
|---|---|
scan_interval_ms |
扫描候选设备的周期 |
promote_stable_ms |
高优先级设备持续可用多久后允许抢占 |
每个 source group 声明一个候选设备:
sources:
gamepad:
type: joystick
device: /dev/input/jsBattleDragon
priority: 50
ready_timeout_ms: 1000
loss_timeout_ms: 300
cooldown_ms: 1000
signals:
gamepad.left_y: {from: js.axis.3}内置 type 包含 joystick、keyboard 和 crsf。自定义类型需注册输入驱动工厂。
通用字段:type、priority、ready_timeout_ms、loss_timeout_ms、cooldown_ms、signals。设备专有字段由对应 driver 解析。
curves:
stick:
type: expo
deadzone: 0.03
expo: 0.0
limit: [-1.0, 1.0]
calibration:
input: [-1.0, 0.0, 1.0]
output: [-1.0, 0.0, 1.0]支持 analog、bool 和 enum。control 把多个设备输入统一成业务控制量,输入规则可带 source、direction、curve、when、value 等字段。条件支持 pressed、released、equals、范围以及 all/any 组合。
完整语法和实例见 遥控器 YAML 配置。
outputs:
conflict_policy: first_wins
publish_on_change: true
analog:
vx: move.vx
edge:
- output: btn_10=8
when:
any:
- [keyboard.wave_event]
- [gamepad.a_event]conflict_policy 可为 first_wins、last_wins 或 error。publish_on_change 控制是否仅在消息变化时发布。analog 连续写值,level 保持条件结果,edge 只在进入条件时产生脉冲;最终字段写入 MotionCommands。
主文件:
src/bxi_example_py_elf3/config/elf3_state_machine.yaml
| 字段 | 必需 | 含义 |
|---|---|---|
initial_state |
是 | 完整初始状态名 |
mod_paths |
否 | 额外 Mod 搜索根列表 |
graph.validate |
否 | 是否验证状态图 |
graph.export.dot |
否 | DOT 导出路径 |
graph.export.mermaid |
否 | Mermaid 导出路径 |
default_transition |
否 | 未指定边的默认过渡 |
transition_profiles |
否 | 系统共享过渡 profile |
states、remote_events 和 speed_profiles 由 Mod 合成,不应写入此文件。
instantholdentry_gain_ramprunning_blendsequence
| 字段 | 必需 | 含义 |
|---|---|---|
schema |
是 | 当前固定为 1
|
id |
是 | 全局唯一、带命名空间的 Mod id |
version |
是 | 数字点版本,如 1.0.0
|
api |
是 | 当前固定为 1
|
entrypoint |
是 | module:function |
visibility |
否 |
public(默认)或发布工具识别的 protected
|
requires |
否 | Mod 依赖及版本约束 |
python_exports |
否 | 暂时导出的顶层 Python 包 |
events |
否 | 遥控槽位到事件的映射 |
speed_profiles |
否 | Mod 私有速度 profile |
transition_profiles |
否 | Mod 私有过渡 profile |
states |
否 | 本地状态声明;资源 Mod 可省略或使用 {}
|
routes |
否 | 状态图边和 action |
requires:
- com.example.shared
- id: com.bxi.basic_actions
version: ">=1,<2"python_exports:
- customer_commonMod 根目录必须存在 customer_common/__init__.py。导出名必须是合法且全局唯一的 Python 包名。
events:
activate: {slot: btn_10, value: 8}
any_change: {slot: btn_9}slot 必须是合法标识符,value 若存在必须是整数。事件必须至少被一条 route 使用。
states:
wave:
id: 12345
manifest:
label: 示例
index: 20
group: Customer
icon: waves
confirm: true
confirm_message: 请确认安全
speed_profile: walk
params:
amplitude: 0.4状态 id 是可选 int32;manifest.index 是非负 UI 序号。重复 index 会自动重分配并告警。params 的类型和允许字段由插件工厂决定。
routes:
- from: com.bxi.basic_actions/normal
event: activate
to: wave
transition: soft_switch
- from: wave
event: toggle_pause
action: toggle_pause
- from: wave
event: stop
to: com.bxi.basic_actions/zero_torque
transition: {profile: safe_exit, duration: 0.5}
delay: 0.2字段:from、event、to、action、transition、delay。to/action 至少存在一个。
speed_profiles:
walk:
vx_scale: 1.0
vx_min: -1.0
vx_max: 1.0
vy_scale: 0.5
yaw_scale: 1.5与系统 profile 结构相同,但运行时自动命名为 mod-id/local-name。
- 不含
/的 state、event、speed profile 和 Mod transition profile 名称属于当前 Mod。 - 包含
/的值视为完整名称。 - 资源键始终必须显式写完整命名空间。
- 跨 Mod 引用应同时出现在
requires中。
完整加载和校验行为见 Mod 系统。