仿真配置
simulation 块声明仿真后端及其运行参数。stereotype 字段决定使用哪个仿真引擎,UniSimFactory 根据该值实例化对应的 UniSim 子类。
源码:fastsim/configs/simulation_cfg.py(SimulationConfig)
通用字段(所有后端)
| 字段 | 类型 | 说明 |
|---|---|---|
stereotype | str | 仿真后端标识(如 isaaclab),必须已在 UniSim 注册表中存在 |
dt | float | 物理时间步长(秒),必须大于 0;典型值 0.0166667(60Hz) |
intiailize_steps | int | reset 后执行的初始化步数,用于让物理世界进入稳定状态,须 >= 0 |
查看已注册的可用后端:
bash
fastsim show-registry
IsaacLab 后端字段
当 stereotype: isaaclab 时,配置类为 IsaacLabConfig(源码:fastsim/simulators/isaaclab/isaaclab_config.py),在通用字段基础上扩展以下参数:
| 字段 | 类型 | 说明 |
|---|---|---|
device | str | 计算设备,cpu 或 cuda:<index>(如 cuda:0) |
render_interval | int | 每隔多少个物理步渲染一帧,须 >= 1 |
gravity | list[3] | 重力向量 (x, y, z),默认 [0.0, 0.0, -9.81] |
create_stage_in_memory | bool | 是否在内存中创建 USD Stage |
launch_config | LaunchConfig | Isaac Sim AppLauncher 启动参数(含 headless 等) |
physics_config | PhysicsConfig | PhysX 物理引擎参数 |
render_config | RenderConfig | 渲染相关参数 |
配置示例
yaml
simulation:
stereotype: isaaclab
dt: 0.0166667
intiailize_steps: 30
device: cuda:0
render_interval: 1
gravity: [0.0, 0.0, -9.81]
create_stage_in_memory: true
launch_config:
headless: false
physics_config: {}
render_config: {}
常见错误
| 错误提示 | 原因 | 处理方式 |
|---|---|---|
Simulation config is required | 配置文件缺少 simulation 块或未提供 stereotype | 添加完整的 simulation 配置块 |
Invalid simulator stereotype | stereotype 值未在注册表中找到 | 运行 fastsim show-registry 确认可用值;若为自定义接入仿真器,检查 scan_project 是否启用 |