wpi-32u4-library
Public Member Functions | Protected Member Functions
RightMotor Class Reference

#include <Romi32U4Motors.h>

Inherits Romi32U4Motor.

Public Member Functions

void setMotorEffort (int16_t effort)
 
- Public Member Functions inherited from Romi32U4Motor
 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)
 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...
 
- Protected Member Functions inherited from Romi32U4Motor
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 Public Member Functions inherited from Romi32U4Motor
static void init ()
 
- Protected Types inherited from Romi32U4Motor
enum  CTRL_MODE : uint8_t { CTRL_DIRECT , CTRL_SPEED , CTRL_POS }
 
- Static Protected Member Functions inherited from Romi32U4Motor
static void initMotors ()
 
static void initEncoders ()
 
- Protected Attributes inherited from Romi32U4Motor
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
 

Detailed Description

A derived class for the right motor.

Definition at line 149 of file Romi32U4Motors.h.

Member Function Documentation

◆ setEffort()

void RightMotor::setEffort ( int16_t  effort)
protectedvirtual

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.

Parameters
effortA number from -300 to 300 representing the effort and direction of the left motor. Values of -300 or less result in full effort reverse, and values of 300 or more result in full effort forward.

Implements Romi32U4Motor.

Definition at line 80 of file Romi32U4Motors.cpp.

References Romi32U4Motor::maxEffort, and FastGPIO::Pin< pin >::setOutput().

Referenced by setMotorEffort().

◆ setMotorEffort()

void RightMotor::setMotorEffort ( int16_t  effort)
inline

Used to set the motor effort directly. It will properly control the mode.

Definition at line 156 of file Romi32U4Motors.h.

References Romi32U4Motor::CTRL_DIRECT, Romi32U4Motor::ctrlMode, and setEffort().

Referenced by Chassis::setMotorEfforts().


The documentation for this class was generated from the following files: