Skip to main content

MotorGroup

Struct MotorGroup 

Source
pub struct MotorGroup { /* private fields */ }
Expand description

Collection of motors that share a CAN bus and a vendor codec.

Implementations§

Source§

impl MotorGroup

Source

pub fn name(&self) -> &str

Group name.

Source

pub fn bus_name(&self) -> &str

Name of the bus this group is attached to.

Source

pub fn len(&self) -> usize

Number of motors in the group.

Source

pub fn is_empty(&self) -> bool

True if there are no motors (shouldn’t happen via the builder).

Source

pub fn motor(&self, name: &str) -> Option<&Motor>

Get a motor by name.

Source

pub fn motor_mut(&mut self, name: &str) -> Option<&mut Motor>

Get a motor mutably by name.

Source

pub fn motor_at(&self, idx: usize) -> Option<&Motor>

Get a motor by insertion index.

Source

pub fn motors(&self) -> &[Motor]

All motors in insertion order.

Source

pub fn enable_all(&mut self) -> Result<(), Error>

Send the codec’s enable frame to every motor in insertion order.

Source

pub fn disable_all(&mut self) -> Result<(), Error>

Send the codec’s disable frame to every motor in insertion order. (Robot::disable reverses group order; individual groups disable motors in declaration order.)

Source

pub fn set_zero_all(&mut self) -> Result<(), Error>

Send the codec’s set-zero frame to every motor in insertion order.

Source

pub fn refresh_all(&mut self) -> Result<(), Error>

Send the codec’s state-refresh query to every motor that supports one, in insertion order. Motors whose codec returns None (no refresh) are skipped. Send-only: this never drains inbound frames — call tick to receive the replies. Commands no motion.

Source

pub fn set_mode(&mut self, mode: CommandKind) -> Result<(), Error>

Set the persistent control mode (MIT / PosVel / Vel / PosForce) on every motor whose codec supports it, in insertion order. Commands no motion; send-only. Call once at startup, before the matching control commands.

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> 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.