[ntcore] NetworkTables 4 (#3217)

This commit is contained in:
Peter Johnson
2022-10-08 10:01:31 -07:00
committed by GitHub
parent 90cfa00115
commit 77301b126c
380 changed files with 34573 additions and 22095 deletions

View File

@@ -20,16 +20,16 @@ void MechanismRoot2d::SetPosition(double x, double y) {
}
void MechanismRoot2d::UpdateEntries(std::shared_ptr<nt::NetworkTable> table) {
m_xEntry = table->GetEntry("x");
m_yEntry = table->GetEntry("y");
m_xPub = table->GetDoubleTopic("x").Publish();
m_yPub = table->GetDoubleTopic("y").Publish();
Flush();
}
inline void MechanismRoot2d::Flush() {
if (m_xEntry) {
m_xEntry.SetDouble(m_x);
if (m_xPub) {
m_xPub.Set(m_x);
}
if (m_yEntry) {
m_yEntry.SetDouble(m_y);
if (m_yPub) {
m_yPub.Set(m_y);
}
}