ArPiRobot-CoreLib C++
C++ library for ArPiRobot robots
|
#include <arpirobot/core/action/Action.hpp>
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 |
Generic action class. User actions should inherit this class and implement the four pure virtual methods
arpirobot::Action::Action | ( | int32_t | processRateMs = -1 | ) |
Construct an Action
processRateMs | Period between calls of the process function. Leave as -1 to use the value from the active robot profile |
|
protectedpure virtual |
Run when the action is started.
Implemented in arpirobot::ActionSeries.
|
protectedpure virtual |
Run when the action is stopped.
wasInterrupted | Will be true if the action did not stop on its own (see Action::shouldContinue) |
Implemented in arpirobot::ActionSeries.
int32_t arpirobot::Action::getProcessPeriodMs | ( | ) |
Get the rate process function is configured to be called at
bool arpirobot::Action::isRunning | ( | ) |
|
protectedpure virtual |
Run periodically after the action is started, but before it finishes.
Implemented in arpirobot::ActionSeries.
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.
processPeriodMs | New process period in milliseconds |
|
protectedpure virtual |
Called each time after Action::process. When this returns false the action will stop.
Implemented in arpirobot::ActionSeries.