Skip to main content

StayWithinCommand

Struct StayWithinCommand 

Source
#[non_exhaustive]
pub struct StayWithinCommand { pub lower_bound: Option<f32>, pub upper_bound: Option<f32>, pub feedforward_torque: Option<f32>, pub kp_scale: Option<f32>, pub kd_scale: Option<f32>, pub maximum_torque: Option<f32>, pub watchdog_timeout: Option<f32>, pub ilimit_scale: Option<f32>, pub ignore_position_bounds: Option<f32>, }
Expand description

Stay-within mode command.

Unlike PositionCommand which drives to a target, this mode keeps the servo within position bounds while applying minimal control effort.

§Examples

use moteus_protocol::CanFdFrame;
use moteus_protocol::command::{StayWithinCommand, StayWithinFormat};

let mut frame = CanFdFrame::new();
let cmd = StayWithinCommand::new()
    .lower_bound(-0.5)
    .upper_bound(0.5);
cmd.serialize(&mut frame, &StayWithinFormat::default());

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.
§lower_bound: Option<f32>

Lower position bound in revolutions

§upper_bound: Option<f32>

Upper position bound in revolutions

§feedforward_torque: Option<f32>

Feedforward torque in Nm

§kp_scale: Option<f32>

Kp scale factor

§kd_scale: Option<f32>

Kd scale factor

§maximum_torque: Option<f32>

Maximum torque in Nm

§watchdog_timeout: Option<f32>

Watchdog timeout in seconds

§ilimit_scale: Option<f32>

Current limit scale

§ignore_position_bounds: Option<f32>

Ignore position bounds flag

Implementations§

Source§

impl StayWithinCommand

Source

pub fn lower_bound(self, value: f32) -> Self

Source

pub fn upper_bound(self, value: f32) -> Self

Source

pub fn feedforward_torque(self, value: f32) -> Self

Source

pub fn kp_scale(self, value: f32) -> Self

Source

pub fn kd_scale(self, value: f32) -> Self

Source

pub fn maximum_torque(self, value: f32) -> Self

Source

pub fn watchdog_timeout(self, value: f32) -> Self

Source

pub fn ilimit_scale(self, value: f32) -> Self

Source

pub fn ignore_position_bounds(self, value: f32) -> Self

Source§

impl StayWithinCommand

Source

pub fn new() -> Self

Creates a new stay-within command with all fields set to None.

Source

pub fn serialize(&self, frame: &mut CanFdFrame, format: &StayWithinFormat)

Serializes this command to a CAN frame.

Trait Implementations§

Source§

impl Clone for StayWithinCommand

Source§

fn clone(&self) -> StayWithinCommand

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StayWithinCommand

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StayWithinCommand

Source§

fn default() -> StayWithinCommand

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.