RSeries astromech firmware
TankDriveSerial Class Reference

#include <drive/TankDriveSerial.h>

Detailed Description

Base template of automatic forwarder from i2c to CommandEvent.

TankDrivePWM tankDrive;
+ Inheritance diagram for TankDriveSerial:
+ Collaboration diagram for TankDriveSerial:

Public Member Functions

 TankDriveSerial (Stream &stream, 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...
 
virtual void stop () override
 
- Public Member Functions inherited from TankDrive
 TankDrive (JoystickController &driveStick)
 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 ()
 
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) override
 
void printNumZeroPad (unsigned num)
 
- Protected Member Functions inherited from TankDrive
virtual float getThrottle ()
 
virtual bool hasThrottle ()
 
virtual float throttleSpeed (float speedModifier)
 
void driveStick (JoystickController *stick, float speedModifier)
 

Protected Attributes

Stream * fSerial
 
bool fStopped
 
- Protected Attributes inherited from TankDrive
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

◆ TankDriveSerial()

TankDriveSerial::TankDriveSerial ( Stream &  stream,
JoystickController driveStick 
)
inline

Constructor.

Will drive PWM pins

Member Function Documentation

◆ motor()

virtual void TankDriveSerial::motor ( float  left,
float  right,
float  throttle 
)
inlineoverrideprotectedvirtual

Implements TankDrive.

◆ printNumZeroPad()

void TankDriveSerial::printNumZeroPad ( unsigned  num)
inlineprotected

◆ setup()

virtual void TankDriveSerial::setup ( )
inlineoverridevirtual

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

Reimplemented from TankDrive.

◆ stop()

virtual void TankDriveSerial::stop ( )
inlineoverridevirtual

Reimplemented from TankDrive.

Member Data Documentation

◆ fSerial

Stream* TankDriveSerial::fSerial
protected

◆ fStopped

bool TankDriveSerial::fStopped
protected

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