Use the new solver to compute time

Now that all the infrastructure exists, hook it up.  Track which nodes
are connected, if there are any orphaned nodes, and everything else the
old code used to do.

This doesn't yet handle single directions going and coming.

Change-Id: I658347797384f7608870d231a3ebbb2c05dad1dc
diff --git a/y2020/control_loops/drivetrain/localizer_test.cc b/y2020/control_loops/drivetrain/localizer_test.cc
index da3ef17..3798c34 100644
--- a/y2020/control_loops/drivetrain/localizer_test.cc
+++ b/y2020/control_loops/drivetrain/localizer_test.cc
@@ -6,6 +6,7 @@
 #include "aos/events/logging/logger.h"
 #include "aos/network/message_bridge_server_generated.h"
 #include "aos/network/team_number.h"
+#include "aos/network/testing_time_converter.h"
 #include "frc971/control_loops/drivetrain/drivetrain.h"
 #include "frc971/control_loops/drivetrain/drivetrain_test_lib.h"
 #include "frc971/control_loops/team_number_test_environment.h"
@@ -103,6 +104,7 @@
             aos::configuration::ReadConfig(
                 "y2020/control_loops/drivetrain/simulation_config.json"),
             GetTest2020DrivetrainConfig().dt),
+        time_converter_(aos::configuration::NodesCount(configuration())),
         roborio_(aos::configuration::GetNode(configuration(), "roborio")),
         pi1_(aos::configuration::GetNode(configuration(), "pi1")),
         test_event_loop_(MakeEventLoop("test", roborio_)),
@@ -128,9 +130,15 @@
         drivetrain_plant_event_loop_(MakeEventLoop("plant", roborio_)),
         drivetrain_plant_(drivetrain_plant_event_loop_.get(), dt_config_),
         last_frame_(monotonic_now()) {
-    event_loop_factory()->GetNodeEventLoopFactory(pi1_)->SetDistributedOffset(
-        kPiTimeOffset, 1.0);
-
+    event_loop_factory()->SetTimeConverter(&time_converter_);
+    CHECK_EQ(aos::configuration::GetNodeIndex(configuration(), roborio_), 5);
+    CHECK_EQ(aos::configuration::GetNodeIndex(configuration(), pi1_), 1);
+    time_converter_.AddMonotonic({monotonic_clock::epoch() + kPiTimeOffset,
+                                  monotonic_clock::epoch() + kPiTimeOffset,
+                                  monotonic_clock::epoch() + kPiTimeOffset,
+                                  monotonic_clock::epoch() + kPiTimeOffset,
+                                  monotonic_clock::epoch() + kPiTimeOffset,
+                                  monotonic_clock::epoch()});
     set_team_id(frc971::control_loops::testing::kTeamNumber);
     set_battery_voltage(12.0);
 
@@ -326,6 +334,8 @@
     }
   }
 
+  aos::message_bridge::TestingTimeConverter time_converter_;
+
   const aos::Node *const roborio_;
   const aos::Node *const pi1_;