RSeries astromech firmware
TankDrive Class Referenceabstract

#include <drive/TankDrive.h>

Detailed Description

Base template of automatic forwarder from i2c to CommandEvent.

TankDrive tankDrive;
+ Inheritance diagram for TankDrive:
+ Collaboration diagram for TankDrive:

Public Member Functions

 TankDrive (JoystickController &driveStick)
 Constructor. More...
 
virtual void setup () override
 Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor. More...
 
bool getEnable ()
 
void setEnable (bool enable)
 
uint32_t getSerialLatency ()
 
void setSerialLatency (uint32_t ms)
 
bool getChannelMixing ()
 
void setChannelMixing (bool mixing)
 
bool getThrottleInverted ()
 
void setThrottleInverted (bool invert)
 
bool getTurnInverted ()
 
void setTurnInverted (bool invert)
 
bool getScaling ()
 
void setScaling (bool scaling)
 
float getMaxSpeed ()
 
void setMaxSpeed (float modifier)
 
unsigned getThrottleAccelerationScale ()
 
void setThrottleAccelerationScale (unsigned scale)
 
unsigned getThrottleDecelerationScale ()
 
void setThrottleDecelerationScale (unsigned scale)
 
unsigned getTurnAccelerationScale ()
 
void setTurnAccelerationScale (unsigned scale)
 
unsigned getTurnDecelerationScale ()
 
void setTurnDecelerationScale (unsigned scale)
 
void setAccelerationScale (unsigned scale)
 
void setDecelerationScale (unsigned scale)
 
void setDriveStick (JoystickController &driveStick)
 
void setGuestStick (JoystickController &guestStick)
 
float getGuestSpeedModifier ()
 
void setGuestSpeedModifier (float maxGuestSpeed)
 
void setTargetSteering (TargetSteering *target)
 
bool useThrottle ()
 
bool useHardStop ()
 
bool useLeftStick ()
 
bool useRightStick ()
 
void setUseThrottle (bool use)
 
void setUseHardStop (bool use)
 
void setUseLeftStick ()
 
void setUseRightStick ()
 
virtual void stop ()
 
JoystickControllergetActiveStick ()
 
virtual void animate () override
 Dispatch any received i2c event to CommandEvent. More...
 
- Public Member Functions inherited from SetupEvent
 SetupEvent ()
 Default Constructor. More...
 
- Public Member Functions inherited from AnimatedEvent
 AnimatedEvent ()
 Default Constructor. More...
 
void setLoopDoneCallback (AnimatedLoopDone loopProc)
 

Protected Member Functions

virtual void motor (float left, float right, float throttle)=0
 
virtual float getThrottle ()
 
virtual bool hasThrottle ()
 
virtual float throttleSpeed (float speedModifier)
 
void driveStick (JoystickController *stick, float speedModifier)
 

Protected Attributes

JoystickControllerfDriveStick
 
JoystickControllerfGuestStick
 
TargetSteeringfTargetSteering
 
bool fEnabled = false
 
bool fWasConnected = false
 
bool fMotorsStopped = false
 
bool fChannelMixing = false
 
bool fScaling = false
 
bool fUseLeftStick = true
 
bool fUseThrottle = true
 
bool fUseHardStop = true
 
bool fThrottleInverted = false
 
bool fTurnInverted = false
 
float fSpeedModifier = 0
 
float fGuestSpeedModifier = 0
 
uint32_t fSerialLatency = 0
 
uint32_t fLastCommand = 0
 
unsigned fThrottleAccelerationScale = 0
 
unsigned fThrottleDecelerationScale = 0
 
unsigned fTurnAccelerationScale = 0
 
unsigned fTurnDecelerationScale = 0
 
float fDriveThrottle = 0
 
float fDriveTurning = 0
 

Additional Inherited Members

- Static Public Member Functions inherited from SetupEvent
static void ready ()
 Calls setup() for each created AnimatedEvent subclass. More...
 
- Static Public Member Functions inherited from AnimatedEvent
static void process ()
 Calls animate() for each created AnimatedEvent subclass. More...
 

Constructor & Destructor Documentation

◆ TankDrive()

TankDrive::TankDrive ( JoystickController driveStick)
inline

Constructor.

Only a single instance of WifiSerialBridge should be created per sketch.

Parameters
portthe port number of this service

Member Function Documentation

◆ animate()

virtual void TankDrive::animate ( )
inlineoverridevirtual

Dispatch any received i2c event to CommandEvent.

Implements AnimatedEvent.

◆ driveStick()

void TankDrive::driveStick ( JoystickController stick,
float  speedModifier 
)
inlineprotected

◆ getActiveStick()

JoystickController* TankDrive::getActiveStick ( )
inline

◆ getChannelMixing()

bool TankDrive::getChannelMixing ( )
inline

◆ getEnable()

bool TankDrive::getEnable ( )
inline

◆ getGuestSpeedModifier()

float TankDrive::getGuestSpeedModifier ( )
inline

◆ getMaxSpeed()

float TankDrive::getMaxSpeed ( )
inline

◆ getScaling()

bool TankDrive::getScaling ( )
inline

◆ getSerialLatency()

uint32_t TankDrive::getSerialLatency ( )
inline

◆ getThrottle()

virtual float TankDrive::getThrottle ( )
inlineprotectedvirtual

◆ getThrottleAccelerationScale()

unsigned TankDrive::getThrottleAccelerationScale ( )
inline

◆ getThrottleDecelerationScale()

unsigned TankDrive::getThrottleDecelerationScale ( )
inline

◆ getThrottleInverted()

bool TankDrive::getThrottleInverted ( )
inline

◆ getTurnAccelerationScale()

unsigned TankDrive::getTurnAccelerationScale ( )
inline

◆ getTurnDecelerationScale()

unsigned TankDrive::getTurnDecelerationScale ( )
inline

◆ getTurnInverted()

bool TankDrive::getTurnInverted ( )
inline

◆ hasThrottle()

virtual bool TankDrive::hasThrottle ( )
inlineprotectedvirtual

Reimplemented in TankDriveRoboteq, and TankDrivePWM.

◆ motor()

virtual void TankDrive::motor ( float  left,
float  right,
float  throttle 
)
protectedpure virtual

◆ setAccelerationScale()

void TankDrive::setAccelerationScale ( unsigned  scale)
inline

◆ setChannelMixing()

void TankDrive::setChannelMixing ( bool  mixing)
inline

◆ setDecelerationScale()

void TankDrive::setDecelerationScale ( unsigned  scale)
inline

◆ setDriveStick()

void TankDrive::setDriveStick ( JoystickController driveStick)
inline

◆ setEnable()

void TankDrive::setEnable ( bool  enable)
inline

◆ setGuestSpeedModifier()

void TankDrive::setGuestSpeedModifier ( float  maxGuestSpeed)
inline

◆ setGuestStick()

void TankDrive::setGuestStick ( JoystickController guestStick)
inline

◆ setMaxSpeed()

void TankDrive::setMaxSpeed ( float  modifier)
inline

◆ setScaling()

void TankDrive::setScaling ( bool  scaling)
inline

◆ setSerialLatency()

void TankDrive::setSerialLatency ( uint32_t  ms)
inline

◆ setTargetSteering()

void TankDrive::setTargetSteering ( TargetSteering target)
inline

◆ setThrottleAccelerationScale()

void TankDrive::setThrottleAccelerationScale ( unsigned  scale)
inline

◆ setThrottleDecelerationScale()

void TankDrive::setThrottleDecelerationScale ( unsigned  scale)
inline

◆ setThrottleInverted()

void TankDrive::setThrottleInverted ( bool  invert)
inline

◆ setTurnAccelerationScale()

void TankDrive::setTurnAccelerationScale ( unsigned  scale)
inline

◆ setTurnDecelerationScale()

void TankDrive::setTurnDecelerationScale ( unsigned  scale)
inline

◆ setTurnInverted()

void TankDrive::setTurnInverted ( bool  invert)
inline

◆ setup()

virtual void TankDrive::setup ( )
inlineoverridevirtual

Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor.

Implements SetupEvent.

Reimplemented in TankDriveRoboteq, TankDrivePWM, TankDriveSabertooth, and TankDriveSerial.

◆ setUseHardStop()

void TankDrive::setUseHardStop ( bool  use)
inline

◆ setUseLeftStick()

void TankDrive::setUseLeftStick ( )
inline

◆ setUseRightStick()

void TankDrive::setUseRightStick ( )
inline

◆ setUseThrottle()

void TankDrive::setUseThrottle ( bool  use)
inline

◆ stop()

virtual void TankDrive::stop ( )
inlinevirtual

◆ throttleSpeed()

virtual float TankDrive::throttleSpeed ( float  speedModifier)
inlineprotectedvirtual

◆ useHardStop()

bool TankDrive::useHardStop ( )
inline

◆ useLeftStick()

bool TankDrive::useLeftStick ( )
inline

◆ useRightStick()

bool TankDrive::useRightStick ( )
inline

◆ useThrottle()

bool TankDrive::useThrottle ( )
inline

Member Data Documentation

◆ fChannelMixing

bool TankDrive::fChannelMixing = false
protected

◆ fDriveStick

JoystickController& TankDrive::fDriveStick
protected

◆ fDriveThrottle

float TankDrive::fDriveThrottle = 0
protected

◆ fDriveTurning

float TankDrive::fDriveTurning = 0
protected

◆ fEnabled

bool TankDrive::fEnabled = false
protected

◆ fGuestSpeedModifier

float TankDrive::fGuestSpeedModifier = 0
protected

◆ fGuestStick

JoystickController* TankDrive::fGuestStick
protected

◆ fLastCommand

uint32_t TankDrive::fLastCommand = 0
protected

◆ fMotorsStopped

bool TankDrive::fMotorsStopped = false
protected

◆ fScaling

bool TankDrive::fScaling = false
protected

◆ fSerialLatency

uint32_t TankDrive::fSerialLatency = 0
protected

◆ fSpeedModifier

float TankDrive::fSpeedModifier = 0
protected

◆ fTargetSteering

TargetSteering* TankDrive::fTargetSteering
protected

◆ fThrottleAccelerationScale

unsigned TankDrive::fThrottleAccelerationScale = 0
protected

◆ fThrottleDecelerationScale

unsigned TankDrive::fThrottleDecelerationScale = 0
protected

◆ fThrottleInverted

bool TankDrive::fThrottleInverted = false
protected

◆ fTurnAccelerationScale

unsigned TankDrive::fTurnAccelerationScale = 0
protected

◆ fTurnDecelerationScale

unsigned TankDrive::fTurnDecelerationScale = 0
protected

◆ fTurnInverted

bool TankDrive::fTurnInverted = false
protected

◆ fUseHardStop

bool TankDrive::fUseHardStop = true
protected

◆ fUseLeftStick

bool TankDrive::fUseLeftStick = true
protected

◆ fUseThrottle

bool TankDrive::fUseThrottle = true
protected

◆ fWasConnected

bool TankDrive::fWasConnected = false
protected

The documentation for this class was generated from the following file:
TankDrive
Base template of automatic forwarder from i2c to CommandEvent.
Definition: TankDrive.h:37
TankDrive.h