RSeries astromech firmware
TankDriveSabertooth Class Reference

#include <drive/TankDriveSabertooth.h>

+ Inheritance diagram for TankDriveSabertooth:
+ Collaboration diagram for TankDriveSabertooth:

Public Member Functions

 TankDriveSabertooth (int id, HardwareSerial &serial, 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)
 
- Public Member Functions inherited from SabertoothDriver
 SabertoothDriver (byte address, Stream &port)
 
byte address () const
 
void setAddress (byte addr)
 
void autobaud (boolean dontWait=false) const
 
void command (byte command, byte value) const
 
void motor (int power) const
 
void motor (byte motor, int power) const
 
void drive (int power) const
 
void turn (int power) const
 
void stop () const
 
void setMinVoltage (byte value) const
 
void setMaxVoltage (byte value) const
 
void setBaudRate (long baudRate) const
 
void setDeadband (byte value) const
 
void setRamping (byte value) const
 
void setTimeout (int milliseconds) const
 

Protected Member Functions

virtual void motor (float left, float right, float throttle) override
 
- Protected Member Functions inherited from TankDrive
virtual float getThrottle ()
 
virtual bool hasThrottle ()
 
virtual float throttleSpeed (float speedModifier)
 
void driveStick (JoystickController *stick, float speedModifier)
 

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...
 
- Static Public Member Functions inherited from SabertoothDriver
static void autobaud (Stream &port, boolean dontWait=false)
 
- 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
 

Constructor & Destructor Documentation

◆ TankDriveSabertooth()

TankDriveSabertooth::TankDriveSabertooth ( int  id,
HardwareSerial &  serial,
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

◆ motor()

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

Implements TankDrive.

◆ setup()

virtual void TankDriveSabertooth::setup ( )
inlineoverridevirtual

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

Reimplemented from TankDrive.

◆ stop()

virtual void TankDriveSabertooth::stop ( )
inlineoverridevirtual

Reimplemented from TankDrive.


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