2022-Robot
Robot code for 2022 FRC Season by Argos, FRC team #1756
Loading...
Searching...
No Matches
nt_subscriber.h
Go to the documentation of this file.
1
4
5#pragma once
6
7#include <networktables/NetworkTableInstance.h>
8
9#include <memory>
10#include <string>
11
12namespace argos_lib {
17 public:
23 explicit NTSubscriber(const std::string& tableName);
24
33 void AddMonitor(const std::string& keyName,
34 std::function<void(double)> onUpdateCallback,
35 const double defaultValue = 0.0,
36 const bool forceUpdate = true);
37
38 private:
39 std::shared_ptr<nt::NetworkTable> m_pntTable;
40 };
41
42} // namespace argos_lib
Subscribes to Network Tables entry updates and calls a specified callback to use the new value.
Definition: nt_subscriber.h:16
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.
Definition: nt_subscriber.cpp:14
std::shared_ptr< nt::NetworkTable > m_pntTable
Table with monitored keys.
Definition: nt_subscriber.h:39
Definition: swap_controllers_command.h:12