ADBLib  0.5
A simple library for rapid robot code development
 All Classes Namespaces Files Functions Variables Enumerations Enumerator Friends Macros Pages
ADBLib::Drivebase Class Referenceabstract

#include <Drivebase.h>

Inheritance diagram for ADBLib::Drivebase:
Collaboration diagram for ADBLib::Drivebase:

Public Types

enum  MotorPos { frontLeft, frontRight, backRight, backLeft }
 

Public Member Functions

 Drivebase (SpeedController *mFrontLeft, SpeedController *mFrontRight, SpeedController *mBackRight, SpeedController *mBackLeft)
 Constructor; sets all motors. More...
 
virtual ~Drivebase ()
 Deletes all motors. More...
 
virtual void drive (float x=0.0, float y=0.0, float r=0.0)=0
 Pure virtual function; override this for drivebase-specific behavior. More...
 
virtual void stop ()
 Disables the drivebase and sets the command to zero the motor. More...
 
bool getEnabled ()
 Gets the status of the drivebase. More...
 

Public Attributes

const string MotorNames [4] = {"Front-left", "Front-Right", "Back-Right", "Back-Left"}
 Motor names that correspond to the MotorPos array; can be used for debug purposes. More...
 

Protected Member Functions

void normSpeeds ()
 Internal function; normalizes wheel speeds to be between -1 and 1. More...
 

Protected Attributes

SpeedController * motors [4]
 
bool enabled
 
float speeds [4]
 

Member Enumeration Documentation

Enumerator
frontLeft 
frontRight 
backRight 
backLeft 

Constructor & Destructor Documentation

ADBLib::Drivebase::Drivebase ( SpeedController *  mFrontLeft,
SpeedController *  mFrontRight,
SpeedController *  mBackRight,
SpeedController *  mBackLeft 
)

Constructor; sets all motors.

Parameters
mFrontLeftThe front left motor.
mFrontRightThe front right motor.
mBackRightThe back right motor.
mBackLeftThe back left motor.
Note
Accepts anything that inherits a SpeedController, so go wild.
ADBLib::Drivebase::~Drivebase ( )
virtual

Deletes all motors.

Member Function Documentation

virtual void ADBLib::Drivebase::drive ( float  x = 0.0,
float  y = 0.0,
float  r = 0.0 
)
pure virtual

Pure virtual function; override this for drivebase-specific behavior.

Implemented in ADBLib::OctocanumDrive, ADBLib::OmniDrive, ADBLib::MecanumDrive, and ADBLib::TractionDrive.

bool ADBLib::Drivebase::getEnabled ( )

Gets the status of the drivebase.

Returns
True if enabled, false if disabled.
void ADBLib::Drivebase::normSpeeds ( )
protected

Internal function; normalizes wheel speeds to be between -1 and 1.

Here is the caller graph for this function:

void ADBLib::Drivebase::stop ( )
virtual

Disables the drivebase and sets the command to zero the motor.

Reimplemented in ADBLib::OmniDrive.

Member Data Documentation

bool ADBLib::Drivebase::enabled
protected
const string ADBLib::Drivebase::MotorNames[4] = {"Front-left", "Front-Right", "Back-Right", "Back-Left"}

Motor names that correspond to the MotorPos array; can be used for debug purposes.

SpeedController* ADBLib::Drivebase::motors[4]
protected
float ADBLib::Drivebase::speeds[4]
protected

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