Convert aos over to flatbuffers
Everything builds, and all the tests pass. I suspect that some entries
are missing from the config files, but those will be found pretty
quickly on startup.
There is no logging or live introspection of queue messages.
Change-Id: I496ee01ed68f202c7851bed7e8786cee30df29f5
diff --git a/y2016/dashboard/BUILD b/y2016/dashboard/BUILD
index f3998a1..dbc6214 100644
--- a/y2016/dashboard/BUILD
+++ b/y2016/dashboard/BUILD
@@ -1,5 +1,5 @@
load("//aos/seasocks:gen_embedded.bzl", "gen_embedded")
-load("//aos/downloader:downloader.bzl", "aos_downloader_dir")
+load("//frc971/downloader:downloader.bzl", "aos_downloader_dir")
gen_embedded(
name = "gen_embedded",
@@ -28,16 +28,17 @@
deps = [
":gen_embedded",
"//aos:init",
- "//aos/events:event-loop",
- "//aos/events:shm-event-loop",
+ "//aos/events:event_loop",
+ "//aos/events:shm_event_loop",
"//aos/logging",
"//aos/seasocks:seasocks_logger",
"//aos/time",
"//aos/util:phased_loop",
- "//frc971/autonomous:auto_queue",
+ "//frc971/autonomous:auto_fbs",
+ "//frc971/control_loops:control_loops_fbs",
"//third_party/seasocks",
- "//y2016/control_loops/superstructure:superstructure_queue",
- "//y2016/queues:ball_detector",
- "//y2016/vision:vision_queue",
+ "//y2016/control_loops/superstructure:superstructure_status_fbs",
+ "//y2016/queues:ball_detector_fbs",
+ "//y2016/vision:vision_fbs",
],
)
diff --git a/y2016/dashboard/dashboard.cc b/y2016/dashboard/dashboard.cc
index 27036e0..7f13fbe 100644
--- a/y2016/dashboard/dashboard.cc
+++ b/y2016/dashboard/dashboard.cc
@@ -11,17 +11,18 @@
#include "internal/Embedded.h"
#include "seasocks/Server.h"
-#include "aos/events/shm-event-loop.h"
+#include "aos/events/shm_event_loop.h"
#include "aos/init.h"
#include "aos/logging/logging.h"
#include "aos/mutex/mutex.h"
+#include "aos/realtime.h"
#include "aos/seasocks/seasocks_logger.h"
#include "aos/time/time.h"
#include "aos/util/phased_loop.h"
-#include "frc971/autonomous/auto.q.h"
-#include "y2016/control_loops/superstructure/superstructure.q.h"
-#include "y2016/queues/ball_detector.q.h"
-#include "y2016/vision/vision.q.h"
+#include "frc971/autonomous/auto_generated.h"
+#include "y2016/control_loops/superstructure/superstructure_status_generated.h"
+#include "y2016/queues/ball_detector_generated.h"
+#include "y2016/vision/vision_generated.h"
namespace chrono = ::std::chrono;
@@ -52,17 +53,17 @@
: event_loop_(event_loop),
vision_status_fetcher_(
event_loop->MakeFetcher<::y2016::vision::VisionStatus>(
- ".y2016.vision.vision_status")),
+ "/superstructure")),
ball_detector_fetcher_(
event_loop->MakeFetcher<::y2016::sensors::BallDetector>(
- ".y2016.sensors.ball_detector")),
+ "/superstructure")),
autonomous_mode_fetcher_(
event_loop->MakeFetcher<::frc971::autonomous::AutonomousMode>(
- ".frc971.autonomous.auto_mode")),
+ "/aos")),
superstructure_status_fetcher_(
- event_loop->MakeFetcher<
- ::y2016::control_loops::SuperstructureQueue::Status>(
- ".y2016.control_loops.superstructure_queue.status")),
+ event_loop
+ ->MakeFetcher<::y2016::control_loops::superstructure::Status>(
+ "/superstructure")),
cur_raw_data_("no data"),
sample_id_(0),
measure_index_(0),
@@ -121,22 +122,22 @@
// TODO(comran): Grab detected voltage from joystick_reader. Except this
// value may not change, so it may be worth it to keep it as it is right
// now.
- if (ball_detector_fetcher_->voltage > 2.5) {
+ if (ball_detector_fetcher_->voltage() > 2.5) {
big_indicator = big_indicator::kBallIntaked;
}
}
if (superstructure_status_fetcher_.get()) {
- if (!superstructure_status_fetcher_->zeroed) {
+ if (!superstructure_status_fetcher_->zeroed()) {
superstructure_state_indicator = superstructure_indicator::kNotZeroed;
}
- if (superstructure_status_fetcher_->estopped) {
+ if (superstructure_status_fetcher_->estopped()) {
superstructure_state_indicator = superstructure_indicator::kEstopped;
}
}
if (autonomous_mode_fetcher_.get()) {
- auto_mode_indicator = autonomous_mode_fetcher_->mode;
+ auto_mode_indicator = autonomous_mode_fetcher_->mode();
}
AddPoint("big indicator", big_indicator);
@@ -285,7 +286,10 @@
::aos::InitNRT();
- ::aos::ShmEventLoop event_loop;
+ aos::FlatbufferDetachedBuffer<aos::Configuration> config =
+ aos::configuration::ReadConfig("config.json");
+
+ ::aos::ShmEventLoop event_loop(&config.message());
::seasocks::Server server(::std::shared_ptr<seasocks::Logger>(
new ::aos::seasocks::SeasocksLogger(::seasocks::Logger::Level::Info)));
diff --git a/y2016/dashboard/dashboard.h b/y2016/dashboard/dashboard.h
index ed5a579..f019ec7 100644
--- a/y2016/dashboard/dashboard.h
+++ b/y2016/dashboard/dashboard.h
@@ -14,13 +14,13 @@
#include "seasocks/StringUtil.h"
#include "seasocks/WebSocket.h"
-#include "aos/events/event-loop.h"
+#include "aos/events/event_loop.h"
#include "aos/mutex/mutex.h"
#include "aos/time/time.h"
-#include "frc971/autonomous/auto.q.h"
-#include "y2016/control_loops/superstructure/superstructure.q.h"
-#include "y2016/queues/ball_detector.q.h"
-#include "y2016/vision/vision.q.h"
+#include "frc971/autonomous/auto_generated.h"
+#include "y2016/control_loops/superstructure/superstructure_status_generated.h"
+#include "y2016/queues/ball_detector_generated.h"
+#include "y2016/vision/vision_generated.h"
namespace y2016 {
namespace dashboard {
@@ -71,7 +71,7 @@
::aos::Fetcher<::y2016::vision::VisionStatus> vision_status_fetcher_;
::aos::Fetcher<::y2016::sensors::BallDetector> ball_detector_fetcher_;
::aos::Fetcher<::frc971::autonomous::AutonomousMode> autonomous_mode_fetcher_;
- ::aos::Fetcher<::y2016::control_loops::SuperstructureQueue::Status>
+ ::aos::Fetcher<::y2016::control_loops::superstructure::Status>
superstructure_status_fetcher_;
// Storage vector that is written and overwritten with data in a FIFO fashion.