pub struct JointDriverHighSpeedFeedback {
pub joint_index: u8,
pub speed_rad_s: i16,
pub current_a: i16,
pub position_rad: i32,
}Expand description
关节驱动器高速反馈 (0x251~0x256)
包含关节速度、电流和位置反馈。
- 速度单位:0.001rad/s(原始值)
- 电流单位:0.001A(原始值)
- 位置单位:rad(原始值)
注意:关节索引从 CAN ID 推导(0x251 -> 1, 0x252 -> 2, …, 0x256 -> 6)
Fields§
§joint_index: u8§speed_rad_s: i16§current_a: i16§position_rad: i32Implementations§
Source§impl JointDriverHighSpeedFeedback
impl JointDriverHighSpeedFeedback
Sourcepub const COEFFICIENT_1_3: f64 = 1.18125
pub const COEFFICIENT_1_3: f64 = 1.18125
关节 1-3 的力矩系数(CAN ID: 0x251~0x253)
根据官方参考实现,关节 1、2、3 使用此系数计算力矩。 公式:torque = current * COEFFICIENT_1_3
Sourcepub const COEFFICIENT_4_6: f64 = 0.95844
pub const COEFFICIENT_4_6: f64 = 0.95844
关节 4-6 的力矩系数(CAN ID: 0x254~0x256)
根据官方参考实现,关节 4、5、6 使用此系数计算力矩。 公式:torque = current * COEFFICIENT_4_6
Sourcepub fn current_raw(&self) -> i16
pub fn current_raw(&self) -> i16
获取电流原始值(0.001A 单位)
Sourcepub fn position_raw(&self) -> i32
pub fn position_raw(&self) -> i32
获取位置原始值(rad 单位)
Sourcepub fn position(&self) -> f64
👎Deprecated since 0.1.0: Field unit unverified (rad vs mrad). Prefer Observer::get_joint_position() for verified position data, or use position_raw() for raw access.
pub fn position(&self) -> f64
Observer::get_joint_position() for verified position data, or use position_raw() for raw access.获取位置(rad)
§⚠️ 弃用警告 (Deprecated)
此方法的返回值单位未确认,可能导致不正确的位置值。
已知问题:
- 字段标注为
rad,但测试数据存在矛盾(3141592 对应 π?) - 可能的单位:rad、mrad(0.001rad)、0.01°、编码器 ticks
- 当前没有生产代码使用此方法
替代方案:
- 高层 API:
piper.observer().get_joint_position(joint)- 推荐,单位已确认为弧度 - 协议层:
JointFeedback12::j1_rad(),j2_rad()等 - 单位明确 (从 0.001° 转换) - 原始值:
self.position_raw()- 获取未转换的 i32 原始值
背景: 详见 docs/v0/position_unit_analysis_report.md
Sourcepub fn torque(&self, current_opt: Option<f64>) -> f64
pub fn torque(&self, current_opt: Option<f64>) -> f64
计算力矩(N·m)
根据关节索引和电流值计算力矩。
- 关节 1-3 (CAN ID: 0x251~0x253) 使用系数
COEFFICIENT_1_3 = 1.18125 - 关节 4-6 (CAN ID: 0x254~0x256) 使用系数
COEFFICIENT_4_6 = 0.95844
公式:torque = current * coefficient
§参数
current_opt: 可选的电流值(A)。如果为None,则使用当前反馈的电流值。
§返回值
计算得到的力矩值(N·m)
§示例
// 使用反馈中的电流值计算力矩
let torque = feedback.torque(None);
// 使用指定的电流值计算力矩
let torque = feedback.torque(Some(2.5)); // 2.5ASourcepub fn torque_raw(&self) -> i32
pub fn torque_raw(&self) -> i32
Trait Implementations§
Source§impl Clone for JointDriverHighSpeedFeedback
impl Clone for JointDriverHighSpeedFeedback
Source§fn clone(&self) -> JointDriverHighSpeedFeedback
fn clone(&self) -> JointDriverHighSpeedFeedback
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for JointDriverHighSpeedFeedback
impl Debug for JointDriverHighSpeedFeedback
Source§impl Default for JointDriverHighSpeedFeedback
impl Default for JointDriverHighSpeedFeedback
Source§fn default() -> JointDriverHighSpeedFeedback
fn default() -> JointDriverHighSpeedFeedback
Returns the “default value” for a type. Read more
Source§impl TryFrom<PiperFrame> for JointDriverHighSpeedFeedback
impl TryFrom<PiperFrame> for JointDriverHighSpeedFeedback
Source§type Error = ProtocolError
type Error = ProtocolError
The type returned in the event of a conversion error.
impl Copy for JointDriverHighSpeedFeedback
Auto Trait Implementations§
impl Freeze for JointDriverHighSpeedFeedback
impl RefUnwindSafe for JointDriverHighSpeedFeedback
impl Send for JointDriverHighSpeedFeedback
impl Sync for JointDriverHighSpeedFeedback
impl Unpin for JointDriverHighSpeedFeedback
impl UnwindSafe for JointDriverHighSpeedFeedback
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more