[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

@@ -224,12 +224,25 @@ RobotBase::RobotBase() {
auto inst = nt::NetworkTableInstance::GetDefault();
inst.SetNetworkIdentity("Robot");
// subscribe to "" to force persistent values to progagate to local
nt::SubscribeMultiple(inst.GetHandle(), {{std::string_view{}}});
#ifdef __FRC_ROBORIO__
inst.StartServer("/home/lvuser/networktables.ini");
inst.StartServer("/home/lvuser/networktables.json");
#else
inst.StartServer();
#endif
// wait for the NT server to actually start
int count = 0;
while ((inst.GetNetworkMode() & NT_NET_MODE_STARTING) != 0) {
using namespace std::chrono_literals;
std::this_thread::sleep_for(10ms);
++count;
if (count > 100) {
fmt::print(stderr, "timed out while waiting for NT server to start\n");
}
}
SmartDashboard::init();
if (IsReal()) {
@@ -247,10 +260,5 @@ RobotBase::RobotBase() {
DriverStation::InDisabled(true);
// First and one-time initialization
inst.GetTable("LiveWindow")
->GetSubTable(".status")
->GetEntry("LW Enabled")
.SetBoolean(false);
LiveWindow::SetEnabled(false);
}