#[non_exhaustive]pub struct PositionCommand {Show 14 fields
pub position: Option<f32>,
pub velocity: Option<f32>,
pub feedforward_torque: Option<f32>,
pub kp_scale: Option<f32>,
pub kd_scale: Option<f32>,
pub maximum_torque: Option<f32>,
pub stop_position: Option<f32>,
pub watchdog_timeout: Option<f32>,
pub velocity_limit: Option<f32>,
pub accel_limit: Option<f32>,
pub fixed_voltage_override: Option<f32>,
pub ilimit_scale: Option<f32>,
pub fixed_current_override: Option<f32>,
pub ignore_position_bounds: Option<f32>,
}Expand description
Position mode command.
This is the primary control mode for moteus. All fields are optional;
fields set to None will not be transmitted (using Ignore resolution).
§Examples
use moteus_protocol::CanFdFrame;
use moteus_protocol::command::{PositionCommand, PositionFormat};
let mut frame = CanFdFrame::new();
frame.arbitration_id = 0x8001;
// Build with the builder pattern -- fields are optional
let cmd = PositionCommand::new()
.position(0.5)
.velocity(1.0)
.maximum_torque(2.0);
cmd.serialize(&mut frame, &PositionFormat::default());
assert!(frame.size > 0);Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.position: Option<f32>Target position in revolutions
velocity: Option<f32>Target velocity in revolutions/second
feedforward_torque: Option<f32>Feedforward torque in Nm
kp_scale: Option<f32>Kp scale factor (0-1)
kd_scale: Option<f32>Kd scale factor (0-1)
maximum_torque: Option<f32>Maximum torque in Nm
stop_position: Option<f32>Stop position for trajectory mode
watchdog_timeout: Option<f32>Watchdog timeout in seconds
velocity_limit: Option<f32>Velocity limit in revolutions/second
accel_limit: Option<f32>Acceleration limit in revolutions/second^2
fixed_voltage_override: Option<f32>Fixed voltage override
ilimit_scale: Option<f32>Current limit scale factor
fixed_current_override: Option<f32>Fixed current override in A
ignore_position_bounds: Option<f32>Ignore position bounds flag
Implementations§
Source§impl PositionCommand
impl PositionCommand
pub fn position(self, value: f32) -> Self
pub fn velocity(self, value: f32) -> Self
pub fn feedforward_torque(self, value: f32) -> Self
pub fn kp_scale(self, value: f32) -> Self
pub fn kd_scale(self, value: f32) -> Self
pub fn maximum_torque(self, value: f32) -> Self
pub fn stop_position(self, value: f32) -> Self
pub fn watchdog_timeout(self, value: f32) -> Self
pub fn velocity_limit(self, value: f32) -> Self
pub fn accel_limit(self, value: f32) -> Self
pub fn fixed_voltage_override(self, value: f32) -> Self
pub fn ilimit_scale(self, value: f32) -> Self
pub fn fixed_current_override(self, value: f32) -> Self
pub fn ignore_position_bounds(self, value: f32) -> Self
Source§impl PositionCommand
impl PositionCommand
Sourcepub fn serialize(&self, frame: &mut CanFdFrame, format: &PositionFormat)
pub fn serialize(&self, frame: &mut CanFdFrame, format: &PositionFormat)
Serializes this command to a CAN frame.
Trait Implementations§
Source§impl Clone for PositionCommand
impl Clone for PositionCommand
Source§fn clone(&self) -> PositionCommand
fn clone(&self) -> PositionCommand
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 PositionCommand
impl Debug for PositionCommand
Source§impl Default for PositionCommand
impl Default for PositionCommand
Source§fn default() -> PositionCommand
fn default() -> PositionCommand
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for PositionCommand
impl RefUnwindSafe for PositionCommand
impl Send for PositionCommand
impl Sync for PositionCommand
impl Unpin for PositionCommand
impl UnsafeUnpin for PositionCommand
impl UnwindSafe for PositionCommand
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