ArPiRobot-CoreLib C++
C++ library for ArPiRobot robots
|
#include <arpirobot/core/robot/BaseRobot.hpp>
Public Member Functions | |
BaseRobot (const BaseRobot &other)=delete | |
BaseRobot & | operator= (const BaseRobot &other)=delete |
void | feedWatchdog () |
void | start () |
virtual void | robotStarted ()=0 |
virtual void | robotEnabled ()=0 |
virtual void | robotDisabled ()=0 |
virtual void | enabledPeriodic ()=0 |
virtual void | disabledPeriodic ()=0 |
virtual void | periodic ()=0 |
Static Public Member Functions | |
static std::shared_ptr< Task > | scheduleRepeatedFunction (const std::function< void()> &&func, sched_clk::duration rate) |
static void | runOnceSoon (const std::function< void()> &&func) |
static void | removeTaskFromScheduler (std::shared_ptr< Task > task) |
static void | beginWhenReady (BaseDevice *device) |
static void | deviceDestroyed (BaseDevice *device) |
Static Public Attributes | |
static bool | exists |
Base class to facilitate general robot code structure/flow Each robot program should have a single class that inherits from this class and implements the pure virtual functions.
|
static |
Initialize a device to run once the robot is started. If this is called before a robot is started this will not run the device's BaseDevice::begin immediately, but when BaseRobot::start() is called. If the robot is already started, BaseDevice::begin will be called.
device | The device to begin once the robot is instantiated |
|
static |
Run when a device is destructed. Removes device from managed list.
|
pure virtual |
Run periodically while the robot is disabled
|
pure virtual |
Run periodically while the robot is enabled
void arpirobot::BaseRobot::feedWatchdog | ( | ) |
Feed the watchdog so devices don't become disabled
|
pure virtual |
Run periodically regardless of robot state
|
static |
Remove the given task (repeated task) from the scheduler
task | The task to remove |
|
pure virtual |
Run each time the robot is disabled
|
pure virtual |
Run each time the robot is enabled
|
pure virtual |
Run once when the robot is started
|
static |
Run a function on the scheduler as soon as possible (no delay). The given function will only run once This method will return immediately (will not wait for the target function to run)
func | The function to run |
|
static |
Schedule a function to be run at a given rate.
func | The function to run |
rate | The rate to run at |
void arpirobot::BaseRobot::start | ( | ) |
Start the robot. Only one robot instance my run at a time