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>
impl<const DEV_ADDR: u16> Gim6010<DEV_ADDR>
Sourcepub fn new() -> Self
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.
Sourcepub fn clear_faults<I>(&mut self, bus: &mut CanBus<I>) -> Result<(), Error>where
Can<I>: Instance,
pub fn clear_faults<I>(&mut self, bus: &mut CanBus<I>) -> Result<(), Error>where
Can<I>: Instance,
Clear any latched faults.
Sourcepub fn disable_output<I>(&mut self, bus: &mut CanBus<I>) -> Result<(), Error>where
Can<I>: Instance,
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).
Sourcepub fn set_speed_rpm<I>(
&mut self,
bus: &mut CanBus<I>,
rpm: f32,
) -> Result<(), Error>where
Can<I>: Instance,
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.
rpmis signed (negative values indicate reverse direction).- Resolution is 0.01 rpm
Sourcepub fn read_speed_rpm<I>(&mut self, bus: &mut CanBus<I>) -> Result<f32, Error>where
Can<I>: Instance,
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.
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>
impl<const DEV_ADDR: u16> Gim6010<DEV_ADDR>
Sourcepub const POS_MAX_0P1_RAD: i16 = 955i16
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.
Sourcepub fn shaft_pos_max_rad() -> f32
pub fn shaft_pos_max_rad() -> f32
Maximum mechanical shaft angle in radians that the raw encoder value represents.
Sourcepub fn raw_angle_to_rad(raw: u16) -> f32
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
Sourcepub fn raw_angle_to_deg(raw: u16) -> f32
pub fn raw_angle_to_deg(raw: u16) -> f32
Convert a raw encoder value [0..65535] to a motor shaft angle in degrees.
Sourcepub fn angle_rad_to_raw(angle_rad: f32) -> u16
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].
Sourcepub fn angle_deg_to_raw(angle_deg: f32) -> u16
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].