Get 2016 robot running with flatbuffers
Change-Id: Ib3b49fd5f3eae7d0151cfa1ada7cb3746d5f296f
diff --git a/frc971/control_loops/drivetrain/BUILD b/frc971/control_loops/drivetrain/BUILD
index a723d96..f263d14 100644
--- a/frc971/control_loops/drivetrain/BUILD
+++ b/frc971/control_loops/drivetrain/BUILD
@@ -106,7 +106,8 @@
":drivetrain_status_fbs",
":drivetrain_position_fbs",
":localizer_fbs",
- "//frc971/queues:gyro",
+ "//frc971/queues:gyro_fbs",
+ "//frc971/queues:gyro_uid_fbs",
"//frc971/wpilib:imu_fbs",
],
visibility = ["//visibility:public"],
@@ -382,7 +383,7 @@
"//aos/controls:control_loop",
"//aos/util:log_interval",
"//frc971/control_loops:runge_kutta",
- "//frc971/queues:gyro",
+ "//frc971/queues:gyro_fbs",
"//frc971/wpilib:imu_fbs",
],
)
@@ -403,7 +404,7 @@
"//aos/testing:googletest",
"//frc971/control_loops:control_loops_fbs",
"//frc971/control_loops:state_feedback_loop",
- "//frc971/queues:gyro",
+ "//frc971/queues:gyro_fbs",
"//y2016:constants",
"//y2016/control_loops/drivetrain:polydrivetrain_plants",
],
@@ -434,7 +435,7 @@
":drivetrain_test_lib",
"//aos/controls:control_loop_test",
"//aos/testing:googletest",
- "//frc971/queues:gyro",
+ "//frc971/queues:gyro_fbs",
] + cpu_select({
"amd64": [
"//third_party/matplotlib-cpp",
diff --git a/frc971/control_loops/drivetrain/drivetrain_config.json b/frc971/control_loops/drivetrain/drivetrain_config.json
index dc828bb..df64659 100644
--- a/frc971/control_loops/drivetrain/drivetrain_config.json
+++ b/frc971/control_loops/drivetrain/drivetrain_config.json
@@ -13,6 +13,11 @@
},
{
"name": "/drivetrain",
+ "type": "frc971.sensors.Uid",
+ "frequency": 200
+ },
+ {
+ "name": "/drivetrain",
"type": "frc971.control_loops.drivetrain.Goal",
"frequency": 200
},
diff --git a/frc971/queues/BUILD b/frc971/queues/BUILD
index e440638..4005092 100644
--- a/frc971/queues/BUILD
+++ b/frc971/queues/BUILD
@@ -3,9 +3,17 @@
load("@com_github_google_flatbuffers//:build_defs.bzl", "flatbuffer_cc_library")
flatbuffer_cc_library(
- name = "gyro",
+ name = "gyro_fbs",
srcs = [
"gyro.fbs",
],
gen_reflections = 1,
)
+
+flatbuffer_cc_library(
+ name = "gyro_uid_fbs",
+ srcs = [
+ "gyro_uid.fbs",
+ ],
+ gen_reflections = 1,
+)
diff --git a/frc971/queues/gyro.fbs b/frc971/queues/gyro.fbs
index 8a76678..a6dce45 100644
--- a/frc971/queues/gyro.fbs
+++ b/frc971/queues/gyro.fbs
@@ -10,9 +10,4 @@
velocity:double;
}
-// Published on "/drivetrain"
-table Uid {
- uid:uint;
-}
-
root_type GyroReading;
diff --git a/frc971/queues/gyro_uid.fbs b/frc971/queues/gyro_uid.fbs
new file mode 100644
index 0000000..05934bf
--- /dev/null
+++ b/frc971/queues/gyro_uid.fbs
@@ -0,0 +1,8 @@
+namespace frc971.sensors;
+
+// Published on "/drivetrain"
+table Uid {
+ uid:uint;
+}
+
+root_type Uid;
diff --git a/frc971/wpilib/BUILD b/frc971/wpilib/BUILD
index 48fda81..b1bf587 100644
--- a/frc971/wpilib/BUILD
+++ b/frc971/wpilib/BUILD
@@ -115,7 +115,8 @@
"//aos/robot_state:robot_state_fbs",
"//aos/time",
"//aos/util:phased_loop",
- "//frc971/queues:gyro",
+ "//frc971/queues:gyro_fbs",
+ "//frc971/queues:gyro_uid_fbs",
"//frc971/zeroing:averager",
],
)
diff --git a/frc971/wpilib/gyro_sender.cc b/frc971/wpilib/gyro_sender.cc
index 4f88f9e..e7273ee 100644
--- a/frc971/wpilib/gyro_sender.cc
+++ b/frc971/wpilib/gyro_sender.cc
@@ -14,6 +14,7 @@
#include "aos/time/time.h"
#include "frc971/queues/gyro_generated.h"
+#include "frc971/queues/gyro_uid_generated.h"
#include "frc971/zeroing/averager.h"
namespace frc971 {
diff --git a/frc971/wpilib/gyro_sender.h b/frc971/wpilib/gyro_sender.h
index 8125598..a0048fb 100644
--- a/frc971/wpilib/gyro_sender.h
+++ b/frc971/wpilib/gyro_sender.h
@@ -9,6 +9,7 @@
#include "aos/events/shm_event_loop.h"
#include "aos/robot_state/robot_state_generated.h"
#include "frc971/queues/gyro_generated.h"
+#include "frc971/queues/gyro_uid_generated.h"
#include "frc971/wpilib/gyro_interface.h"
#include "frc971/zeroing/averager.h"