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>
impl<const DEV_ADDR: u16> TiltMotor<DEV_ADDR>
Sourcepub fn new(motor: Gim6010<DEV_ADDR>, gear_ratio: f32) -> Self
pub fn new(motor: Gim6010<DEV_ADDR>, gear_ratio: f32) -> Self
Create a new TiltMotor from an underlying CanMotor and a gear ratio.
Sourcepub fn inner_motor(&mut self) -> &mut Gim6010<DEV_ADDR>
pub fn inner_motor(&mut self) -> &mut Gim6010<DEV_ADDR>
Access the underlying CanMotor.
Sourcepub fn shaft_angle_rad_from_raw(&self, raw: u16) -> f32
pub fn shaft_angle_rad_from_raw(&self, raw: u16) -> f32
Convert a raw encoder value [0..65535] into motor shaft angle in radians.
Sourcepub fn shaft_angle_deg_from_raw(&self, raw: u16) -> f32
pub fn shaft_angle_deg_from_raw(&self, raw: u16) -> f32
Convert a raw encoder value [0..65535] into motor shaft angle in degrees.
Sourcepub fn raw_for_shaft_angle_rad(&self, angle_rad: f32) -> u16
pub fn raw_for_shaft_angle_rad(&self, angle_rad: f32) -> u16
Convert a desired motor shaft angle (radians) into a raw encoder value.
Sourcepub fn raw_for_shaft_angle_deg(&self, angle_deg: f32) -> u16
pub fn raw_for_shaft_angle_deg(&self, angle_deg: f32) -> u16
Convert a desired motor shaft angle (degrees) into a raw encoder value.
Sourcepub fn tile_angle_rad_from_raw(&self, raw: u16) -> f32
pub fn tile_angle_rad_from_raw(&self, raw: u16) -> f32
Convert a raw encoder value into tile tilt angle in radians.
Sourcepub fn tile_angle_deg_from_raw(&self, raw: u16) -> f32
pub fn tile_angle_deg_from_raw(&self, raw: u16) -> f32
Convert a raw encoder value into tile tilt angle in degrees.
Sourcepub fn raw_for_tile_angle_rad(&self, tile_angle_rad: f32) -> u16
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.
Sourcepub fn raw_for_tile_angle_deg(&self, tile_angle_deg: f32) -> u16
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> 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