RSeries astromech firmware
DomeDrive Class Referenceabstract

#include <drive/DomeDrive.h>

Detailed Description

Base template of automatic forwarder from i2c to CommandEvent.

DomeDrive domeDrive;
+ Inheritance diagram for DomeDrive:
+ Collaboration diagram for DomeDrive:

Public Member Functions

 DomeDrive (JoystickController &domeStick)
 Constructor. More...
 
virtual void setup () override
 Subclasses must implement this function to perform any necessary setup that cannot happen in the constructor. More...
 
void setDomePosition (DomePosition *domePosition)
 
bool checkError ()
 
bool getEnable () const
 
void setEnable (bool enable)
 
uint32_t getSerialLatency () const
 
void setSerialLatency (uint32_t ms)
 
bool getInverted () const
 
void setInverted (bool invert)
 
bool getScaling () const
 
void setScaling (bool scaling)
 
float getMaxSpeed () const
 
void setMaxSpeed (float modifier)
 
unsigned getThrottleAccelerationScale () const
 
void setThrottleAccelerationScale (unsigned scale)
 
unsigned getThrottleDecelerationScale () const
 
void setThrottleDecelerationScale (unsigned scale)
 
void setDomeStick (JoystickController &domeStick)
 
bool useThrottle ()
 
bool useHardStop ()
 
bool useLeftStick ()
 
bool useRightStick ()
 
void setUseThrottle (bool use)
 
void setUseHardStop (bool use)
 
void setUseLeftStick ()
 
void setUseRightStick ()
 
virtual void stop ()
 
bool isMoving ()
 
JoystickControllergetActiveStick ()
 
virtual void animate () override
 Subclasses must implement this function to run through a single frame of animation/activity. More...
 
virtual void driveDome (float m)
 
virtual void autonomousDriveDome (float m)
 
virtual bool idle ()
 
- 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 Types

enum  DomeMode { kOff, kHome, kRandom }
 

Protected Member Functions

virtual void motor (float m)=0
 
virtual float getThrottle ()
 
virtual float throttleSpeed (float speedModifier)
 
int normalize (int degrees)
 
int shortestDistance (int origin, int target)
 
float getSpeed (float percentage)
 
bool moveDomeToTarget (int pos, int target, int fudge, float speed, float &m)
 
void domeStick (JoystickController *stick, float speedModifier)
 

Static Protected Member Functions

static bool withinArc (double p1, double p2, double p3)
 

Protected Attributes

JoystickControllerfDomeStick
 
bool fError = false
 
bool fEnabled = false
 
bool fWasConnected = false
 
bool fMotorStopped = false
 
bool fIdle = true
 
bool fScaling = false
 
bool fUseLeftStick = false
 
bool fUseThrottle = true
 
bool fUseHardStop = false
 
bool fInverted = false
 
bool fMoving = false
 
float fSpeedModifier
 
float fDrive = 0
 
float fAutoDrive = 0
 
int fLastDomePosition = -1
 
uint32_t fSerialLatency = 0
 
uint32_t fLastCommand = 0
 
uint32_t fLastDomeMovement = 0
 
bool fDomeMovementStarted = false
 
unsigned fThrottleAccelerationScale = 0
 
unsigned fThrottleDecelerationScale = 0
 
float fDomeThrottle = 0
 
int fLastDomeMode = -1
 
int fAutoDomeTargetPos = 0
 
bool fAutoDomeGoHome = false
 
bool fAutoDomeLeft = random(1)
 
uint32_t fNextAutoDomeMovement = 0
 
DomePositionfDomePosition = nullptr
 
uint32_t fMovementStartTime = 0
 
uint32_t fMovementFinishTime = 0
 
void(* fComplete )() = nullptr
 

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...
 

Member Enumeration Documentation

◆ DomeMode

enum DomeDrive::DomeMode
protected
Enumerator
kOff 
kHome 
kRandom 

Constructor & Destructor Documentation

◆ DomeDrive()

DomeDrive::DomeDrive ( JoystickController domeStick)
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 DomeDrive::animate ( )
inlineoverridevirtual

Subclasses must implement this function to run through a single frame of animation/activity.

Subclasses should not call delay() or otherwise block.

Implements AnimatedEvent.

◆ autonomousDriveDome()

virtual void DomeDrive::autonomousDriveDome ( float  m)
inlinevirtual

◆ checkError()

bool DomeDrive::checkError ( )
inline

◆ domeStick()

void DomeDrive::domeStick ( JoystickController stick,
float  speedModifier 
)
inlineprotected

◆ driveDome()

virtual void DomeDrive::driveDome ( float  m)
inlinevirtual

◆ getActiveStick()

JoystickController* DomeDrive::getActiveStick ( )
inline

◆ getEnable()

bool DomeDrive::getEnable ( ) const
inline

◆ getInverted()

bool DomeDrive::getInverted ( ) const
inline

◆ getMaxSpeed()

float DomeDrive::getMaxSpeed ( ) const
inline

◆ getScaling()

bool DomeDrive::getScaling ( ) const
inline

◆ getSerialLatency()

uint32_t DomeDrive::getSerialLatency ( ) const
inline

◆ getSpeed()

float DomeDrive::getSpeed ( float  percentage)
inlineprotected

◆ getThrottle()

virtual float DomeDrive::getThrottle ( )
inlineprotectedvirtual

◆ getThrottleAccelerationScale()

unsigned DomeDrive::getThrottleAccelerationScale ( ) const
inline

◆ getThrottleDecelerationScale()

unsigned DomeDrive::getThrottleDecelerationScale ( ) const
inline

◆ idle()

virtual bool DomeDrive::idle ( )
inlinevirtual

◆ isMoving()

bool DomeDrive::isMoving ( )
inline

◆ motor()

virtual void DomeDrive::motor ( float  m)
protectedpure virtual

◆ moveDomeToTarget()

bool DomeDrive::moveDomeToTarget ( int  pos,
int  target,
int  fudge,
float  speed,
float &  m 
)
inlineprotected

◆ normalize()

int DomeDrive::normalize ( int  degrees)
inlineprotected

◆ setDomePosition()

void DomeDrive::setDomePosition ( DomePosition domePosition)
inline

◆ setDomeStick()

void DomeDrive::setDomeStick ( JoystickController domeStick)
inline

◆ setEnable()

void DomeDrive::setEnable ( bool  enable)
inline

◆ setInverted()

void DomeDrive::setInverted ( bool  invert)
inline

◆ setMaxSpeed()

void DomeDrive::setMaxSpeed ( float  modifier)
inline

◆ setScaling()

void DomeDrive::setScaling ( bool  scaling)
inline

◆ setSerialLatency()

void DomeDrive::setSerialLatency ( uint32_t  ms)
inline

◆ setThrottleAccelerationScale()

void DomeDrive::setThrottleAccelerationScale ( unsigned  scale)
inline

◆ setThrottleDecelerationScale()

void DomeDrive::setThrottleDecelerationScale ( unsigned  scale)
inline

◆ setup()

virtual void DomeDrive::setup ( )
inlineoverridevirtual

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

Implements SetupEvent.

Reimplemented in DomeDriveSabertooth, DomeDrivePWM, and DomeDriveSerial.

◆ setUseHardStop()

void DomeDrive::setUseHardStop ( bool  use)
inline

◆ setUseLeftStick()

void DomeDrive::setUseLeftStick ( )
inline

◆ setUseRightStick()

void DomeDrive::setUseRightStick ( )
inline

◆ setUseThrottle()

void DomeDrive::setUseThrottle ( bool  use)
inline

◆ shortestDistance()

int DomeDrive::shortestDistance ( int  origin,
int  target 
)
inlineprotected

◆ stop()

virtual void DomeDrive::stop ( )
inlinevirtual

◆ throttleSpeed()

virtual float DomeDrive::throttleSpeed ( float  speedModifier)
inlineprotectedvirtual

◆ useHardStop()

bool DomeDrive::useHardStop ( )
inline

◆ useLeftStick()

bool DomeDrive::useLeftStick ( )
inline

◆ useRightStick()

bool DomeDrive::useRightStick ( )
inline

◆ useThrottle()

bool DomeDrive::useThrottle ( )
inline

◆ withinArc()

static bool DomeDrive::withinArc ( double  p1,
double  p2,
double  p3 
)
inlinestaticprotected

Member Data Documentation

◆ fAutoDomeGoHome

bool DomeDrive::fAutoDomeGoHome = false
protected

◆ fAutoDomeLeft

bool DomeDrive::fAutoDomeLeft = random(1)
protected

◆ fAutoDomeTargetPos

int DomeDrive::fAutoDomeTargetPos = 0
protected

◆ fAutoDrive

float DomeDrive::fAutoDrive = 0
protected

◆ fComplete

void(* DomeDrive::fComplete) () = nullptr
protected

◆ fDomeMovementStarted

bool DomeDrive::fDomeMovementStarted = false
protected

◆ fDomePosition

DomePosition* DomeDrive::fDomePosition = nullptr
protected

◆ fDomeStick

JoystickController& DomeDrive::fDomeStick
protected

◆ fDomeThrottle

float DomeDrive::fDomeThrottle = 0
protected

◆ fDrive

float DomeDrive::fDrive = 0
protected

◆ fEnabled

bool DomeDrive::fEnabled = false
protected

◆ fError

bool DomeDrive::fError = false
protected

◆ fIdle

bool DomeDrive::fIdle = true
protected

◆ fInverted

bool DomeDrive::fInverted = false
protected

◆ fLastCommand

uint32_t DomeDrive::fLastCommand = 0
protected

◆ fLastDomeMode

int DomeDrive::fLastDomeMode = -1
protected

◆ fLastDomeMovement

uint32_t DomeDrive::fLastDomeMovement = 0
protected

◆ fLastDomePosition

int DomeDrive::fLastDomePosition = -1
protected

◆ fMotorStopped

bool DomeDrive::fMotorStopped = false
protected

◆ fMovementFinishTime

uint32_t DomeDrive::fMovementFinishTime = 0
protected

◆ fMovementStartTime

uint32_t DomeDrive::fMovementStartTime = 0
protected

◆ fMoving

bool DomeDrive::fMoving = false
protected

◆ fNextAutoDomeMovement

uint32_t DomeDrive::fNextAutoDomeMovement = 0
protected

◆ fScaling

bool DomeDrive::fScaling = false
protected

◆ fSerialLatency

uint32_t DomeDrive::fSerialLatency = 0
protected

◆ fSpeedModifier

float DomeDrive::fSpeedModifier
protected

◆ fThrottleAccelerationScale

unsigned DomeDrive::fThrottleAccelerationScale = 0
protected

◆ fThrottleDecelerationScale

unsigned DomeDrive::fThrottleDecelerationScale = 0
protected

◆ fUseHardStop

bool DomeDrive::fUseHardStop = false
protected

◆ fUseLeftStick

bool DomeDrive::fUseLeftStick = false
protected

◆ fUseThrottle

bool DomeDrive::fUseThrottle = true
protected

◆ fWasConnected

bool DomeDrive::fWasConnected = false
protected

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