Subscribes to Network Tables entry updates and calls a specified callback to use the new value.
More...
#include <nt_subscriber.h>
|
| | NTSubscriber (const std::string &tableName) |
| | Construct a new NTSubscriber object. More...
|
| |
| void | AddMonitor (const std::string &keyName, std::function< void(double)> onUpdateCallback, const double defaultValue=0.0, const bool forceUpdate=true) |
| | Register a new listener for the specified key and send values to callback on update. More...
|
| |
Subscribes to Network Tables entry updates and calls a specified callback to use the new value.
◆ NTSubscriber()
| NTSubscriber::NTSubscriber |
( |
const std::string & |
tableName | ) |
|
|
explicit |
Construct a new NTSubscriber object.
- Parameters
-
| tableName | Name of the table containing keys to watch |
◆ AddMonitor()
| void NTSubscriber::AddMonitor |
( |
const std::string & |
keyName, |
|
|
std::function< void(double)> |
onUpdateCallback, |
|
|
const double |
defaultValue = 0.0, |
|
|
const bool |
forceUpdate = true |
|
) |
| |
Register a new listener for the specified key and send values to callback on update.
- Parameters
-
| keyName | Key to listen for updates. Will be at tableName/keyName (keyName can have more slashes) |
| onUpdateCallback | Callback to run when keyName changes |
| defaultValue | Default value to initialize key if it doesn't exist yet |
| forceUpdate | When true, update network tables value to default even if another value is already set |
◆ m_pntTable
| std::shared_ptr<nt::NetworkTable> argos_lib::NTSubscriber::m_pntTable |
|
private |
Table with monitored keys.
The documentation for this class was generated from the following files: