Optimize message sizes

Allows for more memory to be allocated for running splines.

Change-Id: Ic7e3e03b1c9f0b2cc3711007653b90ec6340bb6c
diff --git a/aos/events/logging/log_stats.cc b/aos/events/logging/log_stats.cc
index d4f04c3..f408e27 100644
--- a/aos/events/logging/log_stats.cc
+++ b/aos/events/logging/log_stats.cc
@@ -14,6 +14,10 @@
 
 DEFINE_string(node, "", "Node to print stats out for.");
 
+DEFINE_bool(excessive_size_only, false,
+            "Only print channels that have a set max message size that is more "
+            "than double of the max message size.");
+
 // define struct to hold all information
 struct ChannelStats {
   // pointer to the channel for which stats are collected
@@ -147,6 +151,7 @@
 
   log_reader_factory.Run();
 
+  std::cout << std::endl;
   // Print out the stats per channel and for the logfile
   for (size_t i = 0; i != channel_stats.size(); i++) {
     if (channel_stats[i].total_num_messages > 0) {
@@ -158,24 +163,37 @@
       logfile_stats.total_log_messages += channel_stats[i].total_num_messages;
       logfile_stats.logfile_end_time = std::max(
           logfile_stats.logfile_end_time, channel_stats[i].channel_end_time);
-      std::cout << "Channel name: "
-                << channel_stats[i].channel->name()->string_view()
-                << "\tMsg type: "
-                << channel_stats[i].channel->type()->string_view() << "\n"
-                << "Number of msg: " << channel_stats[i].total_num_messages
-                << std::setprecision(3) << std::fixed
-                << "\tAvg msg per sec: " << channel_stats[i].avg_messages_sec
-                << "\tSet max msg frequency: "
-                << channel_stats[i].channel->frequency() << "\n"
-                << "Avg msg size: "
-                << (channel_stats[i].total_message_size /
-                    channel_stats[i].total_num_messages)
-                << "\tMax msg size: " << channel_stats[i].max_message_size
-                << "\tSet max msg size: "
-                << channel_stats[i].channel->max_size() << "\n"
-                << "First msg time: " << channel_stats[i].first_message_time
-                << "\tLast msg time: " << channel_stats[i].current_message_time
-                << "\tSeconds active: " << sec_active << "sec\n";
+
+      if (!FLAGS_excessive_size_only ||
+          (channel_stats[i].max_message_size * 2) <
+              static_cast<unsigned long>(
+                  channel_stats[i].channel->max_size())) {
+        std::cout << "Channel name: "
+                  << channel_stats[i].channel->name()->string_view()
+                  << "\tMsg type: "
+                  << channel_stats[i].channel->type()->string_view() << "\n";
+        if (!FLAGS_excessive_size_only) {
+          std::cout << "Number of msg: " << channel_stats[i].total_num_messages
+                    << std::setprecision(3) << std::fixed
+                    << "\tAvg msg per sec: "
+                    << channel_stats[i].avg_messages_sec
+                    << "\tSet max msg frequency: "
+                    << channel_stats[i].channel->frequency() << "\n";
+        }
+        std::cout << "Avg msg size: "
+                  << (channel_stats[i].total_message_size /
+                      channel_stats[i].total_num_messages)
+                  << "\tMax msg size: " << channel_stats[i].max_message_size
+                  << "\tSet max msg size: "
+                  << channel_stats[i].channel->max_size() << "\n";
+        if (!FLAGS_excessive_size_only) {
+          std::cout << "First msg time: " << channel_stats[i].first_message_time
+                    << "\tLast msg time: "
+                    << channel_stats[i].current_message_time
+                    << "\tSeconds active: " << sec_active << "sec\n";
+        }
+        std::cout << std::endl;
+      }
     } else {
       std::cout << "Channel name: "
                 << channel_stats[i].channel->name()->string_view() << "\t"
diff --git a/y2020/y2020_roborio.json b/y2020/y2020_roborio.json
index 17666de..06d96ee 100644
--- a/y2020/y2020_roborio.json
+++ b/y2020/y2020_roborio.json
@@ -26,6 +26,7 @@
       "type": "aos.logging.LogMessageFbs",
       "source_node": "roborio",
       "frequency": 400,
+      "max_size": 344,
       "num_senders": 20
     },
     {
@@ -40,6 +41,7 @@
       "type": "aos.starter.StarterRpc",
       "source_node": "roborio",
       "frequency": 10,
+      "max_size": 72,
       "num_senders": 2
     },
     {
@@ -54,6 +56,7 @@
       "type": "aos.message_bridge.ClientStatistics",
       "source_node": "roborio",
       "frequency": 10,
+      "max_size": 736,
       "num_senders": 2
     },
     {
@@ -66,37 +69,40 @@
     {
       "name": "/roborio/aos/remote_timestamps/pi1/roborio/aos/aos-message_bridge-Timestamp",
       "type": "aos.message_bridge.RemoteMessage",
-      "frequency": 200,
+      "frequency": 20,
       "logger": "NOT_LOGGED",
-      "source_node": "roborio"
+      "source_node": "roborio",
+      "max_size": 208
     },
     {
       "name": "/roborio/aos/remote_timestamps/pi2/roborio/aos/aos-message_bridge-Timestamp",
       "type": "aos.message_bridge.RemoteMessage",
-      "frequency": 200,
+      "frequency": 20,
       "logger": "NOT_LOGGED",
-      "source_node": "roborio"
+      "source_node": "roborio",
+      "max_size": 208
     },
     {
       "name": "/roborio/aos/remote_timestamps/pi3/roborio/aos/aos-message_bridge-Timestamp",
       "type": "aos.message_bridge.RemoteMessage",
-      "frequency": 200,
+      "frequency": 20,
       "logger": "NOT_LOGGED",
       "source_node": "roborio"
     },
     {
       "name": "/roborio/aos/remote_timestamps/pi4/roborio/aos/aos-message_bridge-Timestamp",
       "type": "aos.message_bridge.RemoteMessage",
-      "frequency": 200,
+      "frequency": 20,
       "logger": "NOT_LOGGED",
       "source_node": "roborio"
     },
     {
       "name": "/roborio/aos/remote_timestamps/pi5/roborio/aos/aos-message_bridge-Timestamp",
       "type": "aos.message_bridge.RemoteMessage",
-      "frequency": 200,
+      "frequency": 20,
       "logger": "NOT_LOGGED",
-      "source_node": "roborio"
+      "source_node": "roborio",
+      "max_size": 208
     },
     {
       "name": "/roborio/aos",
@@ -104,7 +110,7 @@
       "source_node": "roborio",
       "frequency": 10,
       "num_senders": 2,
-      "max_size": 400,
+      "max_size": 304,
       "destination_nodes": [
         {
           "name": "pi1",
@@ -147,7 +153,8 @@
       "name": "/superstructure",
       "type": "y2020.control_loops.superstructure.Goal",
       "source_node": "roborio",
-      "frequency": 200
+      "frequency": 200,
+      "max_size": 512
     },
     {
       "name": "/superstructure",
@@ -161,14 +168,16 @@
       "type": "y2020.control_loops.superstructure.Output",
       "source_node": "roborio",
       "frequency": 200,
-      "num_senders": 2
+      "num_senders": 2,
+      "max_size": 224
     },
     {
       "name": "/superstructure",
       "type": "y2020.control_loops.superstructure.Position",
       "source_node": "roborio",
       "frequency": 200,
-      "num_senders": 2
+      "num_senders": 2,
+      "max_size": 448
     },
     {
       "name": "/superstructure",
@@ -217,6 +226,7 @@
       "name": "/drivetrain",
       "type": "frc971.control_loops.drivetrain.Goal",
       "source_node": "roborio",
+      "max_size": 224,
       "frequency": 200
     },
     {
@@ -224,6 +234,7 @@
       "type": "frc971.control_loops.drivetrain.Position",
       "source_node": "roborio",
       "frequency": 200,
+      "max_size": 112,
       "num_senders": 2
     },
     {
@@ -231,6 +242,7 @@
       "type": "frc971.control_loops.drivetrain.Output",
       "source_node": "roborio",
       "frequency": 200,
+      "max_size": 80,
       "num_senders": 2
     },
     {
@@ -238,14 +250,15 @@
       "type": "frc971.control_loops.drivetrain.Status",
       "source_node": "roborio",
       "frequency": 200,
-      "max_size": 2000,
+      "max_size": 1616,
       "num_senders": 2
     },
     {
       "name": "/drivetrain",
       "type": "frc971.control_loops.drivetrain.LocalizerControl",
       "source_node": "roborio",
-      "frequency": 200
+      "frequency": 200,
+      "max_size": 96
     },
     {
       "name": "/drivetrain",
@@ -272,7 +285,8 @@
       "name": "/roborio/aos",
       "type": "frc971.PDPValues",
       "source_node": "roborio",
-      "frequency": 50
+      "frequency": 50,
+      "max_size": 368
     },
     {
       "name": "/roborio/aos",