wpi-32u4-library
|
#include <Romi32U4Motors.h>
Inherits Romi32U4Motor.
Public Member Functions | |
void | setMotorEffort (int16_t effort) |
![]() | |
Romi32U4Motor (void) | |
void | setPIDCoeffients (float kp, float ki) |
void | allowTurbo (bool turbo) |
Turns turbo mode on or off. More... | |
void | handleISR (bool newA, bool newB) |
Protected Member Functions | |
void | setEffort (int16_t effort) |
![]() | |
virtual void | setEffort (int16_t effort)=0 |
Sets the effort for the motor directly. Overloaded for the left and right motors. Use Chassis::setEfforts() from the user code to control motor efforts directly. More... | |
int16_t | getCount (void) |
int16_t | getAndResetCount (void) |
void | setTargetSpeed (float targetSpeed) |
void | moveFor (int16_t amount) |
bool | checkComplete (void) |
void | update (void) |
void | calcEncoderDelta (void) |
Additional Inherited Members | |
![]() | |
static void | init () |
![]() | |
enum | CTRL_MODE : uint8_t { CTRL_DIRECT , CTRL_SPEED , CTRL_POS } |
![]() | |
static void | initMotors () |
static void | initEncoders () |
![]() | |
volatile CTRL_MODE | ctrlMode = CTRL_DIRECT |
volatile int16_t | speed = 0 |
float | targetSpeed = 0 |
int16_t | targetPos = 0 |
int16_t | maxEffort = 300 |
volatile int16_t | prevCount = 0 |
volatile int16_t | count = 0 |
volatile int16_t | lastA = 0 |
volatile int16_t | lastB = 0 |
PIDController | pidCtrl |
A derived class for the left motor.
Definition at line 130 of file Romi32U4Motors.h.
|
protectedvirtual |
Because the Pololu library is based on the FastGPIO library, we don't/can't use analogWrite. Instead, we set the duty cycle directly at the register level.
We also have to have separate classes for the left and right motors to avoid the complex mapping of speeds to registers.
Implements Romi32U4Motor.
Definition at line 62 of file Romi32U4Motors.cpp.
References Romi32U4Motor::maxEffort, and FastGPIO::Pin< pin >::setOutput().
Referenced by setMotorEffort().
|
inline |
Used to set the motor effort directly. It will properly control the mode.
Definition at line 137 of file Romi32U4Motors.h.
References Romi32U4Motor::CTRL_DIRECT, Romi32U4Motor::ctrlMode, and setEffort().
Referenced by Chassis::setMotorEfforts().