RSeries astromech firmware
AnimationPlayer Class Reference

#include <core/Animation.h>

Detailed Description

Player of animation scripts.

Variables available inside an animation script are: "animation", "step", "num", and "elapsedMillis".

Example Script:

ANIMATION(simpleMultiStepAnimation)
{
// Step One - fires once and waits 300ms before advancing
DO_SEQUENCE(SeqPanelAllOpenLong, DOME_PANELS_MASK)
// Step Two - fires once
DO_COMMAND_AND_WAIT("HPF0026|20", 100)
// Step Three - fires repeatedly for 200ms
DO_DURATION(200, {
DEBUG_PRINTLN(elapsedMillis);
})
// Step Four
DO_ONCE({ frontHolo.play("Leia.bd2"); })
// Step Five
DO_COMMAND("HPF0026|20")
// Step Six - repeat this step until "num" reaches 100 then rewind the animation
if (num == 100)
animation.rewind();
})
}
+ Inheritance diagram for AnimationPlayer:
+ Collaboration diagram for AnimationPlayer:

Public Member Functions

 AnimationPlayer ()
 Default Constructor. More...
 
 AnimationPlayer (ServoSequencer &sequencer)
 Default Constructor. More...
 
virtual void animate () override
 Runs through a single step of any active animation script. More...
 
void animateOnce (AnimationStep animation)
 Play the specified animation script once. More...
 
long getCurrentTimeMillis ()
 
void nextStep ()
 Advance to the next step in the active animation script. More...
 
void previousStep ()
 Rewind to the previous step in the active animation script. More...
 
void rewind ()
 Rewind to the beginning in the active animation script. More...
 
void end ()
 Stop the active animation script. More...
 
void gotoStep (unsigned step)
 Go to to the specified step in the active animation script. More...
 
void reset ()
 Reset the animation player and stop any active animation script. More...
 
- Public Member Functions inherited from AnimatedEvent
 AnimatedEvent ()
 Default Constructor. More...
 
void setLoopDoneCallback (AnimatedLoopDone loopProc)
 

Public Attributes

unsigned fNumSteps
 
unsigned fStep
 
bool fRepeatStep
 
ServoSequencerfServoSequencer
 

Protected Types

enum  { kWaiting = 0, kRunning = 1, kEnded = 0xFF }
 

Protected Attributes

uint8_t fFlags
 
unsigned long fNum
 
unsigned long fStepMillis
 
unsigned long fStartMillis
 
AnimationStep fAnimation
 

Additional Inherited Members

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

Member Enumeration Documentation

◆ anonymous enum

anonymous enum
protected
Enumerator
kWaiting 
kRunning 
kEnded 

Constructor & Destructor Documentation

◆ AnimationPlayer() [1/2]

AnimationPlayer::AnimationPlayer ( )
inline

Default Constructor.

◆ AnimationPlayer() [2/2]

AnimationPlayer::AnimationPlayer ( ServoSequencer sequencer)
inline

Default Constructor.

Member Function Documentation

◆ animate()

virtual void AnimationPlayer::animate ( )
inlineoverridevirtual

Runs through a single step of any active animation script.

Implements AnimatedEvent.

◆ animateOnce()

void AnimationPlayer::animateOnce ( AnimationStep  animation)
inline

Play the specified animation script once.

◆ end()

void AnimationPlayer::end ( )
inline

Stop the active animation script.

◆ getCurrentTimeMillis()

long AnimationPlayer::getCurrentTimeMillis ( )
inline

◆ gotoStep()

void AnimationPlayer::gotoStep ( unsigned  step)
inline

Go to to the specified step in the active animation script.

◆ nextStep()

void AnimationPlayer::nextStep ( )
inline

Advance to the next step in the active animation script.

◆ previousStep()

void AnimationPlayer::previousStep ( )
inline

Rewind to the previous step in the active animation script.

◆ reset()

void AnimationPlayer::reset ( )
inline

Reset the animation player and stop any active animation script.

◆ rewind()

void AnimationPlayer::rewind ( )
inline

Rewind to the beginning in the active animation script.

Member Data Documentation

◆ fAnimation

AnimationStep AnimationPlayer::fAnimation
protected

◆ fFlags

uint8_t AnimationPlayer::fFlags
protected

◆ fNum

unsigned long AnimationPlayer::fNum
protected

◆ fNumSteps

unsigned AnimationPlayer::fNumSteps

◆ fRepeatStep

bool AnimationPlayer::fRepeatStep

◆ fServoSequencer

ServoSequencer* AnimationPlayer::fServoSequencer

◆ fStartMillis

unsigned long AnimationPlayer::fStartMillis
protected

◆ fStep

unsigned AnimationPlayer::fStep

◆ fStepMillis

unsigned long AnimationPlayer::fStepMillis
protected

The documentation for this class was generated from the following file:
DO_START
#define DO_START()
Definition: Animation.h:15
DO_SEQUENCE
#define DO_SEQUENCE(seq, mask)
Definition: Animation.h:28
DEBUG_PRINTLN
#define DEBUG_PRINTLN(s)
Definition: ReelTwo.h:188
DO_ONCE
#define DO_ONCE(p)
Definition: Animation.h:19
ANIMATION
#define ANIMATION(name)
Definition: Animation.h:14
DO_COMMAND_AND_WAIT
#define DO_COMMAND_AND_WAIT(cmd, ms)
Definition: Animation.h:35
DO_DURATION
#define DO_DURATION(ms, p)
Definition: Animation.h:22
DO_END
#define DO_END()
Definition: Animation.h:39
DO_FOREVER
#define DO_FOREVER(p)
Definition: Animation.h:21
DO_COMMAND
#define DO_COMMAND(cmd)
Definition: Animation.h:34