ArPiRobot-CoreLib C++
C++ library for ArPiRobot robots
Public Member Functions | Protected Member Functions | Friends | List of all members
arpirobot::Action Class Referenceabstract

#include <arpirobot/core/action/Action.hpp>

Inheritance diagram for arpirobot::Action:
arpirobot::ActionSeries

Public Member Functions

 Action (int32_t processRateMs=-1)
 
bool isRunning ()
 
int32_t getProcessPeriodMs ()
 
void setProcessPeriodMs (int32_t processPeriodMs)
 

Protected Member Functions

virtual LockedDeviceList lockedDevices ()
 
virtual void begin ()=0
 
virtual void process ()=0
 
virtual void finish (bool wasInterrupted)=0
 
virtual bool shouldContinue ()=0
 

Friends

class ActionManager
 
class ActionSeries
 

Detailed Description

Generic action class. User actions should inherit this class and implement the four pure virtual methods

Constructor & Destructor Documentation

◆ Action()

arpirobot::Action::Action ( int32_t  processRateMs = -1)

Construct an Action

Parameters
processRateMsPeriod between calls of the process function. Leave as -1 to use the value from the active robot profile

Member Function Documentation

◆ begin()

virtual void arpirobot::Action::begin ( )
protectedpure virtual

Run when the action is started.

Implemented in arpirobot::ActionSeries.

◆ finish()

virtual void arpirobot::Action::finish ( bool  wasInterrupted)
protectedpure virtual

Run when the action is stopped.

Parameters
wasInterruptedWill be true if the action did not stop on its own (see Action::shouldContinue)

Implemented in arpirobot::ActionSeries.

◆ getProcessPeriodMs()

int32_t arpirobot::Action::getProcessPeriodMs ( )

Get the rate process function is configured to be called at

Returns
period between process function calls in milliseconds

◆ isRunning()

bool arpirobot::Action::isRunning ( )
Returns
true if the action has been started, but has not finished or been stopped.

◆ process()

virtual void arpirobot::Action::process ( )
protectedpure virtual

Run periodically after the action is started, but before it finishes.

Implemented in arpirobot::ActionSeries.

◆ setProcessPeriodMs()

void arpirobot::Action::setProcessPeriodMs ( int32_t  processPeriodMs)

Set the rate the process function should run at. Must be configured before an action is started to take effect.

Parameters
processPeriodMsNew process period in milliseconds

◆ shouldContinue()

virtual bool arpirobot::Action::shouldContinue ( )
protectedpure virtual

Called each time after Action::process. When this returns false the action will stop.

Returns
false if the action should stop. Else true.

Implemented in arpirobot::ActionSeries.


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