RSeries astromech firmware
DomeDrivePWM Class Reference

#include <drive/DomeDrivePWM.h>

Detailed Description

Base template of automatic forwarder from i2c to CommandEvent.

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

Public Member Functions

 DomeDrivePWM (ServoDispatch &dispatch, uint8_t pwmNum, 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...
 
virtual void stop () override
 
- Public Member Functions inherited from DomeDrive
 DomeDrive (JoystickController &domeStick)
 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 ()
 
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 Member Functions

virtual void motor (float m) override
 
- Protected Member Functions inherited from DomeDrive
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 float map (float x, float in_min, float in_max, float out_min, float out_max)
 
- Static Protected Member Functions inherited from DomeDrive
static bool withinArc (double p1, double p2, double p3)
 

Protected Attributes

ServoDispatchfDispatch
 
uint8_t fPWM
 
- Protected Attributes inherited from DomeDrive
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...
 
- Protected Types inherited from DomeDrive
enum  DomeMode { kOff, kHome, kRandom }
 

Constructor & Destructor Documentation

◆ DomeDrivePWM()

DomeDrivePWM::DomeDrivePWM ( ServoDispatch dispatch,
uint8_t  pwmNum,
JoystickController domeStick 
)
inline

Constructor.

Will drive PWM pin

Member Function Documentation

◆ map()

static float DomeDrivePWM::map ( float  x,
float  in_min,
float  in_max,
float  out_min,
float  out_max 
)
inlinestaticprotected

◆ motor()

virtual void DomeDrivePWM::motor ( float  m)
inlineoverrideprotectedvirtual

Implements DomeDrive.

◆ setup()

virtual void DomeDrivePWM::setup ( )
inlineoverridevirtual

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

Reimplemented from DomeDrive.

◆ stop()

virtual void DomeDrivePWM::stop ( )
inlineoverridevirtual

Reimplemented from DomeDrive.

Member Data Documentation

◆ fDispatch

ServoDispatch& DomeDrivePWM::fDispatch
protected

◆ fPWM

uint8_t DomeDrivePWM::fPWM
protected

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