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"
diff --git a/y2014/BUILD b/y2014/BUILD
index b2617da..6ff529a 100644
--- a/y2014/BUILD
+++ b/y2014/BUILD
@@ -36,7 +36,7 @@
"//aos/util:log_interval",
"//frc971/autonomous:auto_fbs",
"//frc971/control_loops/drivetrain:drivetrain_status_fbs",
- "//frc971/queues:gyro",
+ "//frc971/queues:gyro_fbs",
"//y2014/actors:shoot_action_lib",
"//y2014/control_loops/claw:claw_goal_fbs",
"//y2014/control_loops/claw:claw_status_fbs",
diff --git a/y2016/BUILD b/y2016/BUILD
index 520dd4b..a96ea5a 100644
--- a/y2016/BUILD
+++ b/y2016/BUILD
@@ -38,7 +38,7 @@
"//frc971/autonomous:auto_fbs",
"//frc971/control_loops/drivetrain:drivetrain_goal_fbs",
"//frc971/control_loops/drivetrain:drivetrain_status_fbs",
- "//frc971/queues:gyro",
+ "//frc971/queues:gyro_fbs",
"//y2016/actors:autonomous_action_lib",
"//y2016/actors:superstructure_action_lib",
"//y2016/actors:vision_align_action_lib",
@@ -51,6 +51,9 @@
)
robot_downloader(
+ data = [
+ ":config.json",
+ ],
dirs = [
"//y2016/dashboard:www_files",
],
@@ -81,12 +84,17 @@
"//y2016/control_loops/superstructure:superstructure_position_fbs",
"//y2016/control_loops/superstructure:superstructure_status_fbs",
"//y2016/queues:ball_detector_fbs",
- "//y2017/vision:vision_fbs",
+ "//y2016/vision:vision_fbs",
+ "//y2019/control_loops/drivetrain:target_selector_fbs",
+ "//y2016/actors:vision_align_action_fbs",
+ "//y2016/actors:superstructure_action_fbs",
],
visibility = ["//visibility:public"],
deps = [
"//aos/robot_state:config",
+ "//frc971/autonomous:config",
"//frc971/control_loops/drivetrain:config",
+ "//frc971/wpilib:config",
],
)
diff --git a/y2016/actors/autonomous_actor.cc b/y2016/actors/autonomous_actor.cc
index a665c28..0b11bdd 100644
--- a/y2016/actors/autonomous_actor.cc
+++ b/y2016/actors/autonomous_actor.cc
@@ -64,7 +64,7 @@
actors::VisionAlignActor::MakeFactory(event_loop)),
vision_status_fetcher_(
event_loop->MakeFetcher<::y2016::vision::VisionStatus>(
- "/superstructure")),
+ "/vision")),
ball_detector_fetcher_(
event_loop->MakeFetcher<::y2016::sensors::BallDetector>(
"/superstructure")),
diff --git a/y2016/actors/vision_align_actor.cc b/y2016/actors/vision_align_actor.cc
index ae05c70..1761a72 100644
--- a/y2016/actors/vision_align_actor.cc
+++ b/y2016/actors/vision_align_actor.cc
@@ -24,7 +24,7 @@
event_loop, "/vision_align_action"),
vision_status_fetcher_(
event_loop->MakeFetcher<::y2016::vision::VisionStatus>(
- "/superstructure")),
+ "/vision")),
drivetrain_goal_sender_(
event_loop->MakeSender<::frc971::control_loops::drivetrain::Goal>(
"/drivetrain")) {}
diff --git a/y2016/dashboard/dashboard.cc b/y2016/dashboard/dashboard.cc
index 8aec0de..3361e96 100644
--- a/y2016/dashboard/dashboard.cc
+++ b/y2016/dashboard/dashboard.cc
@@ -53,13 +53,13 @@
: event_loop_(event_loop),
vision_status_fetcher_(
event_loop->MakeFetcher<::y2016::vision::VisionStatus>(
- "/superstructure")),
+ "/vision")),
ball_detector_fetcher_(
event_loop->MakeFetcher<::y2016::sensors::BallDetector>(
"/superstructure")),
autonomous_mode_fetcher_(
event_loop->MakeFetcher<::frc971::autonomous::AutonomousMode>(
- "/aos")),
+ "/autonomous")),
superstructure_status_fetcher_(
event_loop
->MakeFetcher<::y2016::control_loops::superstructure::Status>(
diff --git a/y2016/vision/target_receiver.cc b/y2016/vision/target_receiver.cc
index e9a2e1d..93ec131 100644
--- a/y2016/vision/target_receiver.cc
+++ b/y2016/vision/target_receiver.cc
@@ -305,7 +305,7 @@
::aos::ShmEventLoop event_loop(&config.message());
::aos::Sender<::y2016::vision::VisionStatus> vision_status_sender =
- event_loop.MakeSender<::y2016::vision::VisionStatus>("/superstructure");
+ event_loop.MakeSender<::y2016::vision::VisionStatus>("/vision");
StereoGeometry stereo(constants::GetValues().vision_name);
AOS_LOG(INFO, "calibration: %s\n",
diff --git a/y2016/wpilib_interface.cc b/y2016/wpilib_interface.cc
index dc828f3..5c2fcd6 100644
--- a/y2016/wpilib_interface.cc
+++ b/y2016/wpilib_interface.cc
@@ -153,7 +153,7 @@
"/superstructure")),
auto_mode_sender_(
event_loop->MakeSender<::frc971::autonomous::AutonomousMode>(
- "/aos")),
+ "/autonomous")),
shooter_position_sender_(
event_loop->MakeSender<shooter::Position>("/shooter")),
superstructure_position_sender_(
diff --git a/y2016/y2016.json b/y2016/y2016.json
index eb8ecd5..9ad4f20 100644
--- a/y2016/y2016.json
+++ b/y2016/y2016.json
@@ -45,10 +45,45 @@
"name": "/superstructure",
"type": "y2016.sensors.BallDetector",
"frequency": 200
+ },
+ {
+ "name": "/vision",
+ "type": "y2016.vision.VisionStatus",
+ "frequency": 200
+ },
+ {
+ "name": "/superstructure_action",
+ "type": "aos.common.actions.Status"
+ },
+ {
+ "name": "/vision_align_action",
+ "type": "aos.common.actions.Status"
+ },
+ {
+ "name": "/autonomous",
+ "type": "aos.common.actions.Status"
+ },
+ {
+ "name": "/autonomous",
+ "type": "frc971.autonomous.Goal"
+ },
+ {
+ "name": "/drivetrain",
+ "type": "y2019.control_loops.drivetrain.TargetSelectorHint"
+ },
+ {
+ "name": "/vision_align_action",
+ "type": "y2016.actors.vision_align_action.Goal"
+ },
+ {
+ "name": "/superstructure_action",
+ "type": "y2016.actors.superstructure_action.Goal"
}
],
"imports": [
"../aos/robot_state/robot_state_config.json",
- "../frc971/control_loops/drivetrain/drivetrain_config.json"
+ "../frc971/control_loops/drivetrain/drivetrain_config.json",
+ "../frc971/autonomous/autonomous_config.json",
+ "../frc971/wpilib/wpilib_config.json"
]
}