Elma
An event loop manager for embedded systems
|
Example: A cruise controller for a Car process. See examples/driving.cc. More...
Public Member Functions | |
CruiseControl (std::string name) | |
void | init () |
Watch for events that change the desired speed. | |
void | start () |
Nothing to do to initialize. | |
void | update () |
void | stop () |
Nothing to do to stop. | |
![]() | |
Process (int n=0) | |
Default constructor. Names process "no name". | |
Process (std::string name, int n=0) | |
Constructor that takes a name for the process. More... | |
string | name () |
void | set_name (std::string str) |
status_type | status () |
high_resolution_clock::duration | period () |
int | num_updates () |
time_point< high_resolution_clock > | start_time () |
high_resolution_clock::duration | last_update () |
high_resolution_clock::duration | previous_update () |
Channel & | channel (string name) |
Access a channel with the given name. More... | |
double | milli_time () |
The time since the last update in millisconds, as a double. More... | |
double | delta () |
The most recent amount of time between updates. More... | |
void | watch (string event_name, std::function< void(Event &)> handler) |
void | emit (const Event &event) |
void | http_get (std::string url, std::function< void(json &)> handler) |
void | halt () |
void | set_manager (Manager *m_ptr) |
Additional Inherited Members | |
![]() | |
enum | status_type { UNINITIALIZED, STOPPED, RUNNING } |
![]() | |
Manager * | _manager_ptr |
Example: A cruise controller for a Car process. See examples/driving.cc.
See the file examples/driving.cc for usage.
Definition at line 59 of file driving.cc.
|
inline |
Wrap the base process class
name | The name of the controller |
Definition at line 65 of file driving.cc.
|
inlinevirtual |
Get the velocity from the Velocity Channel, compute a simple proportional control law, and send the result to the Throttle channel.
Implements elma::Process.
Definition at line 80 of file driving.cc.