Expand description
MIT 模式高层控制器
简化 MIT 模式的使用,提供:
- 阻塞式位置控制
- 自动状态管理
- 循环锚点机制(消除累积漂移,保证精确 200Hz)
- 容错性增强(允许偶发丢帧)
§设计理念
- Option 模式:使用
Option<Piper<Active<MitMode>>>允许安全提取 - 状态流转:
park()返还Piper<Standby>,支持继续使用 - 循环锚点:使用绝对时间锚点,消除累积漂移
- 容错性:允许最多连续 5 帧丢帧(25ms @ 200Hz)
§使用示例
use piper_client::control::MitController;
use piper_client::control::MitControllerConfig;
use piper_client::state::*;
use piper_client::types::*;
use std::time::Duration;
// 创建控制器配置
let config = MitControllerConfig {
kp_gains: [5.0; 6], // Nm/rad
kd_gains: [0.8; 6], // Nm/(rad/s)
rest_position: None,
control_rate: 200.0,
};
// 运动到目标位置(使用锚点机制,保证精确 200Hz)
let target = [
Rad(0.5), Rad(0.7), Rad(-0.4),
Rad(0.2), Rad(0.3), Rad(0.5),
];
// 显式停车(返还 Piper<Standby>)Structs§
- MitController
- MIT 模式高层控制器
- MitController
Config - MIT 控制器配置
Enums§
- Control
Error - 控制错误