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_deg(&self) -> f64
pub fn position_deg(&self) -> f64
获取位置(度)
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more