RSeries astromech firmware
Stance Class Reference

#include <body/Stance.h>

Detailed Description

Manages transition from 2 to 3 legged stance using 4 limit switches.

+ Inheritance diagram for Stance:
+ Collaboration diagram for Stance:

Public Member Functions

 Stance (HardwareSerial &saberSerialPort, byte tiltUpPin=6, byte tiltDownPin=7, byte legUpPin=8, byte legDownPin=9, byte legPotPin=A0, byte saberAddress=128)
 Constructor. More...
 
 Stance (byte tiltUpPin=6, byte tiltDownPin=7, byte legUpPin=8, byte legDownPin=9, byte legPotPin=A0, byte saberAddress=128)
 
void setOrientationSensors (Orientation &bodyIMU, Orientation &tiltIMU)
 
virtual void handleCommand (const char *cmd) override
 Subclasses should implement this function to process commands specific to their device. More...
 
bool isTwoLegged ()
 Returns true if the current stance is two legged. More...
 
bool isThreeLegged ()
 Returns true if the current stance is three legged. More...
 
bool isValid ()
 Returns true if the current stance is either two legged or three legged. More...
 
void changeToTwoLegged ()
 Initiate a transition to two legged mode. More...
 
void changeToThreeLegged ()
 Initiate a transition to three legged mode. More...
 
virtual void setup () override
 Perform any initialzation not possible in the constructor. More...
 
virtual void animate () override
 Check status of Sabertooth and limit switches and manage transition if one has been initiated. More...
 
- Public Member Functions inherited from AnimatedEvent
 AnimatedEvent ()
 Default Constructor. More...
 
void setLoopDoneCallback (AnimatedLoopDone loopProc)
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ Stance() [1/2]

Stance::Stance ( HardwareSerial &  saberSerialPort,
byte  tiltUpPin = 6,
byte  tiltDownPin = 7,
byte  legUpPin = 8,
byte  legDownPin = 9,
byte  legPotPin = A0,
byte  saberAddress = 128 
)
inline

Constructor.

◆ Stance() [2/2]

Stance::Stance ( byte  tiltUpPin = 6,
byte  tiltDownPin = 7,
byte  legUpPin = 8,
byte  legDownPin = 9,
byte  legPotPin = A0,
byte  saberAddress = 128 
)
inline

Member Function Documentation

◆ animate()

virtual void Stance::animate ( )
inlineoverridevirtual

Check status of Sabertooth and limit switches and manage transition if one has been initiated.

Implements AnimatedEvent.

◆ changeToThreeLegged()

void Stance::changeToThreeLegged ( )
inline

Initiate a transition to three legged mode.

Does nothing if stance is invalid or already three legged.

◆ changeToTwoLegged()

void Stance::changeToTwoLegged ( )
inline

Initiate a transition to two legged mode.

Does nothing if stance is invalid or already two legged.

◆ handleCommand()

virtual void Stance::handleCommand ( const char *  cmd)
inlineoverridevirtual

Subclasses should implement this function to process commands specific to their device.

By convention the first two characters are the device type identifier. 'H' 'P' for holoprojector, etc.

Implements CommandEvent.

◆ isThreeLegged()

bool Stance::isThreeLegged ( )
inline

Returns true if the current stance is three legged.

◆ isTwoLegged()

bool Stance::isTwoLegged ( )
inline

Returns true if the current stance is two legged.

◆ isValid()

bool Stance::isValid ( )
inline

Returns true if the current stance is either two legged or three legged.

◆ setOrientationSensors()

void Stance::setOrientationSensors ( Orientation bodyIMU,
Orientation tiltIMU 
)
inline

◆ setup()

virtual void Stance::setup ( )
inlineoverridevirtual

Perform any initialzation not possible in the constructor.

Implements SetupEvent.


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