![]() |
QPIDfirmware
v0.1
Object oriented firmware for autonomous motor drivers with encoder based PID controller and flexible interface
|
Mostly abstract class that defines access methods and features for generic motors, to be used in a QPID unit. More...
#include <QPID_MotorDriver.h>
Public Types | |
enum | decayModeType : uint8_t { decayModeFast = 0, decayModeSlow = 1 } |
Symbolic names for decay modes that should be used during inactive part of PWM phase, if the driver supports that functionality. | |
Public Member Functions | |
virtual void | setPower (int16_t pow) |
(abstract) Set power to the motor, i.e. make the motor run, sign indicates direction (-maxPower to maxPower). Non PWM driven motors need to map their power range accordingly. | |
virtual void | coast () |
(abstract) cut power and let motor coast to a slow stop (fast decay stop), implies setSpeed(0) More... | |
virtual void | brake () |
(abstract) bring motor to abrupt stop (slow decay stop), implies setSpeed(0) More... | |
virtual void | setDecay (decayModeType mode) |
(abstract) Set mode for PWM inactive phases, if available for driver used | |
virtual void | setFrequency (uint8_t onoff) |
(abstract) Set PWM frequency | |
virtual void | enable () |
(abstract) enable by hardware (EN oder SLEEP Pin) More... | |
virtual void | disable () |
(abstract) sleep by hardware (EN oder SLEEP Pin) More... | |
virtual int8_t | hasFault () |
Reports on motor driver errors. Has a dummy implementation in the base class which always returns false/0 (no fault). Override in derived classes if the motor driver supports fault signaling. More... | |
![]() | |
virtual void | update () |
(abstract) Can be overridden by QPID subsystems which need to do their own polling. Will be called by QPID_Unit::update() for subsystems, and by firmware/client for QPID_Unit itself. | |
void | throwError (const char *invokedBy, const char *errorMessage) |
Writes error message and error invoking class to Serial. More... | |
void | log (const char *logEntry) |
Puts timestamped string into the system log (atm: writes it out to Serial). More... | |
Protected Attributes | |
decayModeType | decayMode = decayModeSlow |
int16_t | currentPWM = 0 |
int16_t | maxPower |
int16_t | alwaysOnPWM |
Additional Inherited Members | |
![]() | |
QPID_Object () | |
Constructor. Begins Serial with 115200 baud for logging and error reporting, if not done previously. | |
virtual bool | processMessage (uint8_t *message) |
(abstract) Interprets message handed down from QPID_Unit locally. Must be overridden in derived classes | |
Mostly abstract class that defines access methods and features for generic motors, to be used in a QPID unit.
Initially developed with only DC motors in mind (PWM, frequency, decay etc.). I'd be better to have an even more generic class and derive QPID_DC_MotorDriver and QPID_Stepper_MotorDriver classes
(done) document abstract methods as implementation guide for derived classes. For now, look at sample DRV8833 class
(done) add fault signaling
|
inlinevirtual |
(abstract) cut power and let motor coast to a slow stop (fast decay stop), implies setSpeed(0)
Reimplemented in QPID_MotorDriver_AdafruitMotorShieldV2, and QPID_MotorDriver_DRV8833.
|
inlinevirtual |
(abstract) bring motor to abrupt stop (slow decay stop), implies setSpeed(0)
Reimplemented in QPID_MotorDriver_AdafruitMotorShieldV2, and QPID_MotorDriver_DRV8833.
|
inlinevirtual |
(abstract) enable by hardware (EN oder SLEEP Pin)
Reimplemented in QPID_MotorDriver_AdafruitMotorShieldV2, and QPID_MotorDriver_DRV8833.
|
inlinevirtual |
(abstract) sleep by hardware (EN oder SLEEP Pin)
Reimplemented in QPID_MotorDriver_AdafruitMotorShieldV2, and QPID_MotorDriver_DRV8833.
|
inlinevirtual |
Reports on motor driver errors. Has a dummy implementation in the base class which always returns false/0 (no fault). Override in derived classes if the motor driver supports fault signaling.
Reimplemented in QPID_MotorDriver_DRV8833, and QPID_MotorDriver_AdafruitMotorShieldV2.