Gim6010

Struct Gim6010 

Source
pub struct Gim6010<const DEV_ADDR: u16>;
Expand description

High-level CAN motor for a single driver instance, parameterized by logical device address.

DEV_ADDR is the protocol device address (Dev_addr), in the range 1 to 254 inclusive. The default DEV_ADDR is 0x01.

The driver will:

  • transmit commands with StdID = 0x100 | DEV_ADDR
  • expect responses from StdID = DEV_ADDR

Implementations§

Source§

impl<const DEV_ADDR: u16> Gim6010<DEV_ADDR>

Source

pub fn new() -> Self

Create a new handle for this motor address.

This is a zero-sized type; all state lives on the driver itself.

Source

pub fn clear_faults<I>(&mut self, bus: &mut CanBus<I>) -> Result<(), Error>
where Can<I>: Instance,

Clear any latched faults.

Source

pub fn disable_output<I>(&mut self, bus: &mut CanBus<I>) -> Result<(), Error>
where Can<I>: Instance,

Turn off motor output. The motor enters a free state and becomes uncontrollable (this is the state the motor enters after power-on).

Source

pub fn set_speed_rpm<I>( &mut self, bus: &mut CanBus<I>, rpm: f32, ) -> Result<(), Error>
where Can<I>: Instance,

Command the motor in speed control mode with a setpoint in rpm.

  • rpm is signed (negative values indicate reverse direction).
  • Resolution is 0.01 rpm
Source

pub fn read_speed_rpm<I>(&mut self, bus: &mut CanBus<I>) -> Result<f32, Error>
where Can<I>: Instance,

Read back the real-time motor speed in rpm.

Source

pub fn read_status_frame<I>( &mut self, bus: &mut CanBus<I>, ) -> Result<[u8; 8], Error>
where Can<I>: Instance,

Source§

impl<const DEV_ADDR: u16> Gim6010<DEV_ADDR>

Source

pub const POS_MAX_0P1_RAD: i16 = 955i16

Default Pos_Max from the driver documentation, in units of 0.1 rad.

The encoder range [0..65535] is mapped to [-Pos_Max, +Pos_Max], with: Pos_Max = 955 → ±95.5 rad at the motor shaft.

Source

pub fn shaft_pos_max_rad() -> f32

Maximum mechanical shaft angle in radians that the raw encoder value represents.

Source

pub fn raw_angle_to_rad(raw: u16) -> f32

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

Mapping assumed: raw = 0 -> -Pos_Max raw = 32767.5 -> 0 raw = 65535 -> +Pos_Max

Source

pub fn raw_angle_to_deg(raw: u16) -> f32

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

Source

pub fn angle_rad_to_raw(angle_rad: f32) -> u16

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

Input is automatically clamped to [-Pos_Max, +Pos_Max].

Source

pub fn angle_deg_to_raw(angle_deg: f32) -> u16

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

Auto Trait Implementations§

§

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

§

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

§

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

§

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

§

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

§

impl<const DEV_ADDR: u16> UnwindSafe for Gim6010<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.