TiltMotor

Struct TiltMotor 

Source
pub struct TiltMotor<const DEV_ADDR: u16> { /* private fields */ }
Expand description

High-level tilt motor wrapped around a CanMotor.

Geometry parameters:

  • gear_ratio — number of motor revolutions per tile revolution.

Implementations§

Source§

impl<const DEV_ADDR: u16> TiltMotor<DEV_ADDR>

Source

pub fn new(motor: Gim6010<DEV_ADDR>, gear_ratio: f32) -> Self

Create a new TiltMotor from an underlying CanMotor and a gear ratio.

Source

pub fn inner_motor(&mut self) -> &mut Gim6010<DEV_ADDR>

Access the underlying CanMotor.

Source

pub fn shaft_angle_rad_from_raw(&self, raw: u16) -> f32

Convert a raw encoder value [0..65535] into motor shaft angle in radians.

Source

pub fn shaft_angle_deg_from_raw(&self, raw: u16) -> f32

Convert a raw encoder value [0..65535] into motor shaft angle in degrees.

Source

pub fn raw_for_shaft_angle_rad(&self, angle_rad: f32) -> u16

Convert a desired motor shaft angle (radians) into a raw encoder value.

Source

pub fn raw_for_shaft_angle_deg(&self, angle_deg: f32) -> u16

Convert a desired motor shaft angle (degrees) into a raw encoder value.

Source

pub fn tile_angle_rad_from_raw(&self, raw: u16) -> f32

Convert a raw encoder value into tile tilt angle in radians.

Source

pub fn tile_angle_deg_from_raw(&self, raw: u16) -> f32

Convert a raw encoder value into tile tilt angle in degrees.

Source

pub fn raw_for_tile_angle_rad(&self, tile_angle_rad: f32) -> u16

Convert a desired tile tilt angle in radians into a raw encoder value.

Source

pub fn raw_for_tile_angle_deg(&self, tile_angle_deg: f32) -> u16

Convert a desired tile tilt angle in degrees into a raw encoder value.

Auto Trait Implementations§

§

impl<const DEV_ADDR: u16> Freeze for TiltMotor<DEV_ADDR>

§

impl<const DEV_ADDR: u16> RefUnwindSafe for TiltMotor<DEV_ADDR>

§

impl<const DEV_ADDR: u16> Send for TiltMotor<DEV_ADDR>

§

impl<const DEV_ADDR: u16> Sync for TiltMotor<DEV_ADDR>

§

impl<const DEV_ADDR: u16> Unpin for TiltMotor<DEV_ADDR>

§

impl<const DEV_ADDR: u16> UnwindSafe for TiltMotor<DEV_ADDR>

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.