Switch all robots over to use EventLoop
Stop using the old QueueGroup constructor for ControlLoop
Change-Id: I027febf86e75399a97cdb4dc50dbc475705e0393
diff --git a/frc971/codelab/BUILD b/frc971/codelab/BUILD
index 252e01d..0fe9205 100644
--- a/frc971/codelab/BUILD
+++ b/frc971/codelab/BUILD
@@ -1,39 +1,40 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
-load('//aos/build:queues.bzl', 'queue_library')
+load("//aos/build:queues.bzl", "queue_library")
cc_binary(
- name = 'basic_test',
- srcs = ['basic_test.cc'],
- deps = [
- ':basic_queue',
- ':basic',
- '//aos/testing:googletest',
- '//aos:queues',
- '//aos/controls:control_loop_test',
- '//frc971/control_loops:state_feedback_loop',
- '//frc971/control_loops:team_number_test_environment',
- ],
- testonly = 1,
+ name = "basic_test",
+ testonly = 1,
+ srcs = ["basic_test.cc"],
+ deps = [
+ ":basic",
+ ":basic_queue",
+ "//aos:queues",
+ "//aos/controls:control_loop_test",
+ "//aos/events:shm-event-loop",
+ "//aos/testing:googletest",
+ "//frc971/control_loops:state_feedback_loop",
+ "//frc971/control_loops:team_number_test_environment",
+ ],
)
cc_library(
- name = 'basic',
- srcs = ['basic.cc'],
- hdrs = ['basic.h'],
- deps = [
- ':basic_queue',
- '//aos/controls:control_loop',
- ],
+ name = "basic",
+ srcs = ["basic.cc"],
+ hdrs = ["basic.h"],
+ deps = [
+ ":basic_queue",
+ "//aos/controls:control_loop",
+ ],
)
queue_library(
- name = 'basic_queue',
- srcs = [
- 'basic.q',
- ],
- deps = [
- '//aos/controls:control_loop_queues',
- '//frc971/control_loops:queues',
- ],
+ name = "basic_queue",
+ srcs = [
+ "basic.q",
+ ],
+ deps = [
+ "//aos/controls:control_loop_queues",
+ "//frc971/control_loops:queues",
+ ],
)
diff --git a/frc971/codelab/basic.cc b/frc971/codelab/basic.cc
index 536384c..d06e285 100644
--- a/frc971/codelab/basic.cc
+++ b/frc971/codelab/basic.cc
@@ -3,8 +3,8 @@
namespace frc971 {
namespace codelab {
-Basic::Basic(BasicQueue *my_basic_queue)
- : aos::controls::ControlLoop<BasicQueue>(my_basic_queue) {}
+Basic::Basic(::aos::EventLoop *event_loop, const ::std::string &name)
+ : aos::controls::ControlLoop<BasicQueue>(event_loop, name) {}
void Basic::RunIteration(const BasicQueue::Goal *goal,
const BasicQueue::Position *position,
diff --git a/frc971/codelab/basic.h b/frc971/codelab/basic.h
index 0332168..6f33718 100644
--- a/frc971/codelab/basic.h
+++ b/frc971/codelab/basic.h
@@ -43,7 +43,8 @@
// - Read basic.q, and familiarize yourself on the inputs and types involved.
class Basic : public ::aos::controls::ControlLoop<BasicQueue> {
public:
- explicit Basic(BasicQueue *my_basic_queue = &basic_queue);
+ explicit Basic(::aos::EventLoop *event_loop,
+ const ::std::string &name = ".frc971.codelab.basic_queue");
protected:
void RunIteration(const BasicQueue::Goal *goal,
diff --git a/frc971/codelab/basic_test.cc b/frc971/codelab/basic_test.cc
index 5132407..2dc8dea 100644
--- a/frc971/codelab/basic_test.cc
+++ b/frc971/codelab/basic_test.cc
@@ -6,6 +6,7 @@
#include <memory>
#include "aos/controls/control_loop_test.h"
+#include "aos/events/shm-event-loop.h"
#include "aos/queue.h"
#include "frc971/codelab/basic.q.h"
#include "frc971/control_loops/team_number_test_environment.h"
@@ -65,7 +66,7 @@
".frc971.codelab.basic_queue.position",
".frc971.codelab.basic_queue.output",
".frc971.codelab.basic_queue.status"),
- basic_loop_(&basic_queue_) {
+ basic_loop_(&event_loop_, ".frc971.codelab.basic_queue") {
set_team_id(control_loops::testing::kTeamNumber);
}
@@ -81,6 +82,7 @@
}
BasicQueue basic_queue_;
+ ::aos::ShmEventLoop event_loop_;
Basic basic_loop_;
BasicSimulation basic_simulation_;
};
diff --git a/frc971/control_loops/drivetrain/drivetrain.cc b/frc971/control_loops/drivetrain/drivetrain.cc
index 27a0a76..a06bc3b 100644
--- a/frc971/control_loops/drivetrain/drivetrain.cc
+++ b/frc971/control_loops/drivetrain/drivetrain.cc
@@ -29,11 +29,11 @@
namespace control_loops {
namespace drivetrain {
-DrivetrainLoop::DrivetrainLoop(
- const DrivetrainConfig<double> &dt_config,
- ::frc971::control_loops::DrivetrainQueue *my_drivetrain)
+DrivetrainLoop::DrivetrainLoop(const DrivetrainConfig<double> &dt_config,
+ ::aos::EventLoop *event_loop,
+ const ::std::string &name)
: aos::controls::ControlLoop<::frc971::control_loops::DrivetrainQueue>(
- my_drivetrain),
+ event_loop, name),
dt_config_(dt_config),
kf_(dt_config_.make_kf_drivetrain_loop()),
dt_openloop_(dt_config_, &kf_),
diff --git a/frc971/control_loops/drivetrain/drivetrain.h b/frc971/control_loops/drivetrain/drivetrain.h
index 9396aed..a357eab 100644
--- a/frc971/control_loops/drivetrain/drivetrain.h
+++ b/frc971/control_loops/drivetrain/drivetrain.h
@@ -22,9 +22,8 @@
// Constructs a control loop which can take a Drivetrain or defaults to the
// drivetrain at frc971::control_loops::drivetrain
explicit DrivetrainLoop(
- const DrivetrainConfig<double> &dt_config,
- ::frc971::control_loops::DrivetrainQueue *my_drivetrain =
- &::frc971::control_loops::drivetrain_queue);
+ const DrivetrainConfig<double> &dt_config, ::aos::EventLoop *event_loop,
+ const ::std::string &name = ".frc971.control_loops.drivetrain_queue");
int ControllerIndexFromGears();
diff --git a/frc971/control_loops/drivetrain/drivetrain_lib_test.cc b/frc971/control_loops/drivetrain/drivetrain_lib_test.cc
index bb5d5d9..5c1a8b4 100644
--- a/frc971/control_loops/drivetrain/drivetrain_lib_test.cc
+++ b/frc971/control_loops/drivetrain/drivetrain_lib_test.cc
@@ -103,11 +103,11 @@
// TODO(aschuh) Do we want to test the clutch one too?
DrivetrainSimulation()
: drivetrain_plant_(new DrivetrainPlant(MakeDrivetrainPlant())),
- my_drivetrain_queue_(".frc971.control_loops.drivetrain",
- ".frc971.control_loops.drivetrain.goal",
- ".frc971.control_loops.drivetrain.position",
- ".frc971.control_loops.drivetrain.output",
- ".frc971.control_loops.drivetrain.status"),
+ my_drivetrain_queue_(".frc971.control_loops.drivetrain_queue",
+ ".frc971.control_loops.drivetrain_queue.goal",
+ ".frc971.control_loops.drivetrain_queue.position",
+ ".frc971.control_loops.drivetrain_queue.output",
+ ".frc971.control_loops.drivetrain_queue.status"),
gyro_reading_(::frc971::sensors::gyro_reading.name()) {
Reinitialize();
last_U_.setZero();
@@ -219,17 +219,18 @@
// is no longer valid.
::frc971::control_loops::DrivetrainQueue my_drivetrain_queue_;
+ ::aos::ShmEventLoop event_loop_;
// Create a loop and simulation plant.
DrivetrainLoop drivetrain_motor_;
DrivetrainSimulation drivetrain_motor_plant_;
DrivetrainTest()
- : my_drivetrain_queue_(".frc971.control_loops.drivetrain",
- ".frc971.control_loops.drivetrain.goal",
- ".frc971.control_loops.drivetrain.position",
- ".frc971.control_loops.drivetrain.output",
- ".frc971.control_loops.drivetrain.status"),
- drivetrain_motor_(GetDrivetrainConfig(), &my_drivetrain_queue_),
+ : my_drivetrain_queue_(".frc971.control_loops.drivetrain_queue",
+ ".frc971.control_loops.drivetrain_queue.goal",
+ ".frc971.control_loops.drivetrain_queue.position",
+ ".frc971.control_loops.drivetrain_queue.output",
+ ".frc971.control_loops.drivetrain_queue.status"),
+ drivetrain_motor_(GetDrivetrainConfig(), &event_loop_),
drivetrain_motor_plant_() {
::frc971::sensors::gyro_reading.Clear();
set_battery_voltage(12.0);
diff --git a/y2012/control_loops/accessories/accessories.cc b/y2012/control_loops/accessories/accessories.cc
index 0f9fc93..d320468 100644
--- a/y2012/control_loops/accessories/accessories.cc
+++ b/y2012/control_loops/accessories/accessories.cc
@@ -11,10 +11,10 @@
::y2012::control_loops::AccessoriesQueue> {
public:
explicit AccessoriesLoop(
- ::y2012::control_loops::AccessoriesQueue *my_accessories =
- &::y2012::control_loops::accessories_queue)
+ ::aos::EventLoop *event_loop,
+ const ::std::string &name = ".y2012.control_loops.accessories_queue")
: ::aos::controls::ControlLoop<::y2012::control_loops::AccessoriesQueue>(
- my_accessories) {}
+ event_loop, name) {}
void RunIteration(
const ::y2012::control_loops::AccessoriesQueue::Message *goal,
@@ -33,7 +33,8 @@
int main() {
::aos::Init();
- ::y2012::control_loops::accessories::AccessoriesLoop accessories;
+ ::aos::ShmEventLoop event_loop;
+ ::y2012::control_loops::accessories::AccessoriesLoop accessories(&event_loop);
accessories.Run();
::aos::Cleanup();
}
diff --git a/y2012/control_loops/drivetrain/BUILD b/y2012/control_loops/drivetrain/BUILD
index a0aa4cc..3be1e9a 100644
--- a/y2012/control_loops/drivetrain/BUILD
+++ b/y2012/control_loops/drivetrain/BUILD
@@ -78,6 +78,7 @@
deps = [
":drivetrain_base",
"//aos:init",
+ "//aos/events:shm-event-loop",
"//frc971/control_loops/drivetrain:drivetrain_lib",
],
)
diff --git a/y2012/control_loops/drivetrain/drivetrain_main.cc b/y2012/control_loops/drivetrain/drivetrain_main.cc
index 6b7eca3..ef348a4 100644
--- a/y2012/control_loops/drivetrain/drivetrain_main.cc
+++ b/y2012/control_loops/drivetrain/drivetrain_main.cc
@@ -1,5 +1,6 @@
#include "aos/init.h"
+#include "aos/events/shm-event-loop.h"
#include "frc971/control_loops/drivetrain/drivetrain.h"
#include "y2012/control_loops/drivetrain/drivetrain_base.h"
@@ -7,8 +8,9 @@
int main() {
::aos::Init();
+ ::aos::ShmEventLoop event_loop;
DrivetrainLoop drivetrain(
- ::y2012::control_loops::drivetrain::GetDrivetrainConfig());
+ ::y2012::control_loops::drivetrain::GetDrivetrainConfig(), &event_loop);
drivetrain.Run();
::aos::Cleanup();
return 0;
diff --git a/y2014/control_loops/claw/BUILD b/y2014/control_loops/claw/BUILD
index f267251..0764895 100644
--- a/y2014/control_loops/claw/BUILD
+++ b/y2014/control_loops/claw/BUILD
@@ -1,105 +1,106 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
-load('//aos/build:queues.bzl', 'queue_library')
+load("//aos/build:queues.bzl", "queue_library")
cc_binary(
- name = 'replay_claw',
- srcs = [
- 'replay_claw.cc',
- ],
- deps = [
- ':claw_queue',
- '//aos/controls:replay_control_loop',
- '//aos:init',
- ],
+ name = "replay_claw",
+ srcs = [
+ "replay_claw.cc",
+ ],
+ deps = [
+ ":claw_queue",
+ "//aos:init",
+ "//aos/controls:replay_control_loop",
+ ],
)
queue_library(
- name = 'claw_queue',
- srcs = [
- 'claw.q',
- ],
- deps = [
- '//aos/controls:control_loop_queues',
- '//frc971/control_loops:queues',
- ],
+ name = "claw_queue",
+ srcs = [
+ "claw.q",
+ ],
+ deps = [
+ "//aos/controls:control_loop_queues",
+ "//frc971/control_loops:queues",
+ ],
)
genrule(
- name = 'genrule_claw',
- visibility = ['//visibility:private'],
- cmd = '$(location //y2014/control_loops/python:claw) $(OUTS)',
- tools = [
- '//y2014/control_loops/python:claw',
- ],
- outs = [
- 'claw_motor_plant.h',
- 'claw_motor_plant.cc',
- ],
+ name = "genrule_claw",
+ outs = [
+ "claw_motor_plant.h",
+ "claw_motor_plant.cc",
+ ],
+ cmd = "$(location //y2014/control_loops/python:claw) $(OUTS)",
+ tools = [
+ "//y2014/control_loops/python:claw",
+ ],
+ visibility = ["//visibility:private"],
)
cc_library(
- name = 'claw_lib',
- srcs = [
- 'claw.cc',
- 'claw_motor_plant.cc',
- ],
- hdrs = [
- 'claw.h',
- 'claw_motor_plant.h',
- ],
- deps = [
- ':claw_queue',
- '//aos/controls:control_loop',
- '//aos/controls:polytope',
- '//aos/logging:queue_logging',
- '//aos/logging:matrix_logging',
- '//aos:math',
- '//frc971/control_loops:state_feedback_loop',
- '//frc971/control_loops:coerce_goal',
- '//frc971/control_loops:hall_effect_tracker',
- '//y2014:constants',
- ],
- linkopts = [
- '-lm',
- ],
+ name = "claw_lib",
+ srcs = [
+ "claw.cc",
+ "claw_motor_plant.cc",
+ ],
+ hdrs = [
+ "claw.h",
+ "claw_motor_plant.h",
+ ],
+ linkopts = [
+ "-lm",
+ ],
+ deps = [
+ ":claw_queue",
+ "//aos:math",
+ "//aos/controls:control_loop",
+ "//aos/controls:polytope",
+ "//aos/logging:matrix_logging",
+ "//aos/logging:queue_logging",
+ "//frc971/control_loops:coerce_goal",
+ "//frc971/control_loops:hall_effect_tracker",
+ "//frc971/control_loops:state_feedback_loop",
+ "//y2014:constants",
+ ],
)
cc_test(
- name = 'claw_lib_test',
- srcs = [
- 'claw_lib_test.cc',
- ],
- deps = [
- ':claw_lib',
- ':claw_queue',
- '//aos/controls:control_loop_test',
- '//aos/testing:googletest',
- '//frc971/control_loops:state_feedback_loop',
- '//frc971/control_loops:team_number_test_environment',
- ],
+ name = "claw_lib_test",
+ srcs = [
+ "claw_lib_test.cc",
+ ],
+ deps = [
+ ":claw_lib",
+ ":claw_queue",
+ "//aos/controls:control_loop_test",
+ "//aos/testing:googletest",
+ "//frc971/control_loops:state_feedback_loop",
+ "//frc971/control_loops:team_number_test_environment",
+ ],
)
cc_binary(
- name = 'claw_calibration',
- srcs = [
- 'claw_calibration.cc',
- ],
- deps = [
- '//aos:init',
- ':claw_queue',
- '//aos/controls:control_loop',
- '//y2014:constants',
- ],
+ name = "claw_calibration",
+ srcs = [
+ "claw_calibration.cc",
+ ],
+ deps = [
+ ":claw_queue",
+ "//aos:init",
+ "//aos/controls:control_loop",
+ "//y2014:constants",
+ ],
)
cc_binary(
- name = 'claw',
- srcs = [
- 'claw_main.cc',
- ],
- deps = [
- '//aos:init',
- ':claw_lib',
- ],
+ name = "claw",
+ srcs = [
+ "claw_main.cc",
+ ],
+ deps = [
+ ":claw_lib",
+ "//aos:init",
+ "//aos/events:shm-event-loop",
+ ],
)
diff --git a/y2014/control_loops/claw/claw.cc b/y2014/control_loops/claw/claw.cc
index 82ca3a5..7a28a23 100644
--- a/y2014/control_loops/claw/claw.cc
+++ b/y2014/control_loops/claw/claw.cc
@@ -373,8 +373,9 @@
return false;
}
-ClawMotor::ClawMotor(::y2014::control_loops::ClawQueue *my_claw)
- : aos::controls::ControlLoop<::y2014::control_loops::ClawQueue>(my_claw),
+ClawMotor::ClawMotor(::aos::EventLoop *event_loop, const ::std::string &name)
+ : aos::controls::ControlLoop<::y2014::control_loops::ClawQueue>(event_loop,
+ name),
has_top_claw_goal_(false),
top_claw_goal_(0.0),
top_claw_(this),
diff --git a/y2014/control_loops/claw/claw.h b/y2014/control_loops/claw/claw.h
index 7995512..082ddce 100644
--- a/y2014/control_loops/claw/claw.h
+++ b/y2014/control_loops/claw/claw.h
@@ -185,8 +185,9 @@
class ClawMotor
: public aos::controls::ControlLoop<::y2014::control_loops::ClawQueue> {
public:
- explicit ClawMotor(::y2014::control_loops::ClawQueue *my_claw =
- &::y2014::control_loops::claw_queue);
+ explicit ClawMotor(
+ ::aos::EventLoop *event_loop,
+ const ::std::string &name = ".y2014.control_loops.claw_queue");
// True if the state machine is ready.
bool capped_goal() const { return capped_goal_; }
diff --git a/y2014/control_loops/claw/claw_lib_test.cc b/y2014/control_loops/claw/claw_lib_test.cc
index f10e61e..6545dcb 100644
--- a/y2014/control_loops/claw/claw_lib_test.cc
+++ b/y2014/control_loops/claw/claw_lib_test.cc
@@ -245,6 +245,7 @@
// is no longer valid.
::y2014::control_loops::ClawQueue claw_queue;
+ ::aos::ShmEventLoop event_loop_;
// Create a loop and simulation plant.
ClawMotor claw_motor_;
ClawMotorSimulation claw_motor_plant_;
@@ -259,7 +260,7 @@
".y2014.control_loops.claw_queue.position",
".y2014.control_loops.claw_queue.output",
".y2014.control_loops.claw_queue.status"),
- claw_motor_(&claw_queue),
+ claw_motor_(&event_loop_),
claw_motor_plant_(0.4, 0.2),
min_separation_(constants::GetValues().claw.claw_min_separation) {}
diff --git a/y2014/control_loops/claw/claw_main.cc b/y2014/control_loops/claw/claw_main.cc
index 5bb61ba..85497d9 100644
--- a/y2014/control_loops/claw/claw_main.cc
+++ b/y2014/control_loops/claw/claw_main.cc
@@ -1,10 +1,12 @@
#include "y2014/control_loops/claw/claw.h"
+#include "aos/events/shm-event-loop.h"
#include "aos/init.h"
int main() {
::aos::Init();
- ::y2014::control_loops::ClawMotor claw;
+ ::aos::ShmEventLoop event_loop;
+ ::y2014::control_loops::ClawMotor claw(&event_loop);
claw.Run();
::aos::Cleanup();
return 0;
diff --git a/y2014/control_loops/drivetrain/BUILD b/y2014/control_loops/drivetrain/BUILD
index bed5cd9..858f7e0 100644
--- a/y2014/control_loops/drivetrain/BUILD
+++ b/y2014/control_loops/drivetrain/BUILD
@@ -77,6 +77,7 @@
deps = [
":drivetrain_base",
"//aos:init",
+ "//aos/events:shm-event-loop",
"//frc971/control_loops/drivetrain:drivetrain_lib",
],
)
diff --git a/y2014/control_loops/drivetrain/drivetrain_main.cc b/y2014/control_loops/drivetrain/drivetrain_main.cc
index ae20bc8..19c2659 100644
--- a/y2014/control_loops/drivetrain/drivetrain_main.cc
+++ b/y2014/control_loops/drivetrain/drivetrain_main.cc
@@ -1,13 +1,16 @@
#include "aos/init.h"
-#include "y2014/control_loops/drivetrain/drivetrain_base.h"
+#include "aos/events/shm-event-loop.h"
#include "frc971/control_loops/drivetrain/drivetrain.h"
+#include "y2014/control_loops/drivetrain/drivetrain_base.h"
using ::frc971::control_loops::drivetrain::DrivetrainLoop;
int main() {
::aos::Init();
- DrivetrainLoop drivetrain(::y2014::control_loops::GetDrivetrainConfig());
+ ::aos::ShmEventLoop event_loop;
+ DrivetrainLoop drivetrain(::y2014::control_loops::GetDrivetrainConfig(),
+ &event_loop);
drivetrain.Run();
::aos::Cleanup();
return 0;
diff --git a/y2014/control_loops/shooter/BUILD b/y2014/control_loops/shooter/BUILD
index 810d239..b58ff98 100644
--- a/y2014/control_loops/shooter/BUILD
+++ b/y2014/control_loops/shooter/BUILD
@@ -1,91 +1,92 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
-load('//aos/build:queues.bzl', 'queue_library')
+load("//aos/build:queues.bzl", "queue_library")
cc_binary(
- name = 'replay_shooter',
- srcs = [
- 'replay_shooter.cc',
- ],
- deps = [
- ':shooter_queue',
- '//aos/controls:replay_control_loop',
- '//aos:init',
- ],
+ name = "replay_shooter",
+ srcs = [
+ "replay_shooter.cc",
+ ],
+ deps = [
+ ":shooter_queue",
+ "//aos:init",
+ "//aos/controls:replay_control_loop",
+ ],
)
queue_library(
- name = 'shooter_queue',
- srcs = [
- 'shooter.q',
- ],
- deps = [
- '//aos/controls:control_loop_queues',
- '//frc971/control_loops:queues',
- ],
+ name = "shooter_queue",
+ srcs = [
+ "shooter.q",
+ ],
+ deps = [
+ "//aos/controls:control_loop_queues",
+ "//frc971/control_loops:queues",
+ ],
)
genrule(
- name = 'genrule_shooter',
- visibility = ['//visibility:private'],
- cmd = '$(location //y2014/control_loops/python:shooter) $(OUTS)',
- tools = [
- '//y2014/control_loops/python:shooter',
- ],
- outs = [
- 'shooter_motor_plant.cc',
- 'shooter_motor_plant.h',
- 'unaugmented_shooter_motor_plant.cc',
- 'unaugmented_shooter_motor_plant.h',
- ],
+ name = "genrule_shooter",
+ outs = [
+ "shooter_motor_plant.cc",
+ "shooter_motor_plant.h",
+ "unaugmented_shooter_motor_plant.cc",
+ "unaugmented_shooter_motor_plant.h",
+ ],
+ cmd = "$(location //y2014/control_loops/python:shooter) $(OUTS)",
+ tools = [
+ "//y2014/control_loops/python:shooter",
+ ],
+ visibility = ["//visibility:private"],
)
cc_library(
- name = 'shooter_lib',
- srcs = [
- 'shooter.cc',
- 'shooter_motor_plant.cc',
- 'unaugmented_shooter_motor_plant.cc',
- ],
- hdrs = [
- 'shooter.h',
- 'shooter_motor_plant.h',
- 'unaugmented_shooter_motor_plant.h',
- ],
- deps = [
- ':shooter_queue',
- '//aos/controls:control_loop',
- '//y2014:constants',
- '//frc971/control_loops:state_feedback_loop',
- '//aos/logging:queue_logging',
- ],
- linkopts = [
- '-lm',
- ],
+ name = "shooter_lib",
+ srcs = [
+ "shooter.cc",
+ "shooter_motor_plant.cc",
+ "unaugmented_shooter_motor_plant.cc",
+ ],
+ hdrs = [
+ "shooter.h",
+ "shooter_motor_plant.h",
+ "unaugmented_shooter_motor_plant.h",
+ ],
+ linkopts = [
+ "-lm",
+ ],
+ deps = [
+ ":shooter_queue",
+ "//aos/controls:control_loop",
+ "//aos/logging:queue_logging",
+ "//frc971/control_loops:state_feedback_loop",
+ "//y2014:constants",
+ ],
)
cc_test(
- name = 'shooter_lib_test',
- srcs = [
- 'shooter_lib_test.cc',
- ],
- deps = [
- ':shooter_lib',
- ':shooter_queue',
- '//aos/controls:control_loop_test',
- '//aos/testing:googletest',
- '//frc971/control_loops:state_feedback_loop',
- '//frc971/control_loops:team_number_test_environment',
- ],
+ name = "shooter_lib_test",
+ srcs = [
+ "shooter_lib_test.cc",
+ ],
+ deps = [
+ ":shooter_lib",
+ ":shooter_queue",
+ "//aos/controls:control_loop_test",
+ "//aos/testing:googletest",
+ "//frc971/control_loops:state_feedback_loop",
+ "//frc971/control_loops:team_number_test_environment",
+ ],
)
cc_binary(
- name = 'shooter',
- srcs = [
- 'shooter_main.cc',
- ],
- deps = [
- '//aos:init',
- ':shooter_lib',
- ],
+ name = "shooter",
+ srcs = [
+ "shooter_main.cc",
+ ],
+ deps = [
+ ":shooter_lib",
+ "//aos:init",
+ "//aos/events:shm-event-loop",
+ ],
)
diff --git a/y2014/control_loops/shooter/shooter.cc b/y2014/control_loops/shooter/shooter.cc
index 7f3a3b0..d87c638 100644
--- a/y2014/control_loops/shooter/shooter.cc
+++ b/y2014/control_loops/shooter/shooter.cc
@@ -116,9 +116,10 @@
previous_offset, offset_));
}
-ShooterMotor::ShooterMotor(::y2014::control_loops::ShooterQueue *my_shooter)
+ShooterMotor::ShooterMotor(::aos::EventLoop *event_loop,
+ const ::std::string &name)
: aos::controls::ControlLoop<::y2014::control_loops::ShooterQueue>(
- my_shooter),
+ event_loop, name),
shooter_(MakeShooterLoop()),
state_(STATE_INITIALIZE),
cycles_not_moved_(0),
diff --git a/y2014/control_loops/shooter/shooter.h b/y2014/control_loops/shooter/shooter.h
index 75a05db..a9a255b 100644
--- a/y2014/control_loops/shooter/shooter.h
+++ b/y2014/control_loops/shooter/shooter.h
@@ -129,8 +129,9 @@
class ShooterMotor
: public aos::controls::ControlLoop<::y2014::control_loops::ShooterQueue> {
public:
- explicit ShooterMotor(::y2014::control_loops::ShooterQueue *my_shooter =
- &::y2014::control_loops::shooter_queue);
+ explicit ShooterMotor(
+ ::aos::EventLoop *event_loop,
+ const ::std::string &name = ".y2014.control_loops.shooter_queue");
// True if the goal was moved to avoid goal windup.
bool capped_goal() const { return shooter_.capped_goal(); }
diff --git a/y2014/control_loops/shooter/shooter_lib_test.cc b/y2014/control_loops/shooter/shooter_lib_test.cc
index a5ac55c..e88a33e 100644
--- a/y2014/control_loops/shooter/shooter_lib_test.cc
+++ b/y2014/control_loops/shooter/shooter_lib_test.cc
@@ -289,6 +289,7 @@
// is no longer valid.
::y2014::control_loops::ShooterQueue shooter_queue_;
+ ::aos::ShmEventLoop event_loop_;
// Create a loop and simulation plant.
ShooterMotor shooter_motor_;
ShooterSimulation shooter_motor_plant_;
@@ -303,7 +304,7 @@
".y2014.control_loops.shooter_queue.position",
".y2014.control_loops.shooter_queue.output",
".y2014.control_loops.shooter_queue.status"),
- shooter_motor_(&shooter_queue_),
+ shooter_motor_(&event_loop_),
shooter_motor_plant_(0.2) {}
void VerifyNearGoal() {
diff --git a/y2014/control_loops/shooter/shooter_main.cc b/y2014/control_loops/shooter/shooter_main.cc
index b6f4a8c..a7b60f9 100644
--- a/y2014/control_loops/shooter/shooter_main.cc
+++ b/y2014/control_loops/shooter/shooter_main.cc
@@ -1,10 +1,12 @@
#include "y2014/control_loops/shooter/shooter.h"
+#include "aos/events/shm-event-loop.h"
#include "aos/init.h"
int main() {
::aos::Init();
- ::y2014::control_loops::ShooterMotor shooter;
+ ::aos::ShmEventLoop event_loop;
+ ::y2014::control_loops::ShooterMotor shooter(&event_loop);
shooter.Run();
::aos::Cleanup();
return 0;
diff --git a/y2014_bot3/control_loops/drivetrain/BUILD b/y2014_bot3/control_loops/drivetrain/BUILD
index 53605f3..18e0e90 100644
--- a/y2014_bot3/control_loops/drivetrain/BUILD
+++ b/y2014_bot3/control_loops/drivetrain/BUILD
@@ -77,6 +77,7 @@
deps = [
":drivetrain_base",
"//aos:init",
+ "//aos/events:shm-event-loop",
"//frc971/control_loops/drivetrain:drivetrain_lib",
],
)
diff --git a/y2014_bot3/control_loops/drivetrain/drivetrain_main.cc b/y2014_bot3/control_loops/drivetrain/drivetrain_main.cc
index 3a2dc6d..a76b5a3 100644
--- a/y2014_bot3/control_loops/drivetrain/drivetrain_main.cc
+++ b/y2014_bot3/control_loops/drivetrain/drivetrain_main.cc
@@ -1,5 +1,6 @@
#include "aos/init.h"
+#include "aos/events/shm-event-loop.h"
#include "frc971/control_loops/drivetrain/drivetrain.h"
#include "y2014_bot3/control_loops/drivetrain/drivetrain_base.h"
@@ -7,8 +8,10 @@
int main() {
::aos::Init();
+ ::aos::ShmEventLoop event_loop;
DrivetrainLoop drivetrain(
- ::y2014_bot3::control_loops::drivetrain::GetDrivetrainConfig());
+ ::y2014_bot3::control_loops::drivetrain::GetDrivetrainConfig(),
+ &event_loop);
drivetrain.Run();
::aos::Cleanup();
return 0;
diff --git a/y2014_bot3/control_loops/rollers/BUILD b/y2014_bot3/control_loops/rollers/BUILD
index 0ca9e1b..9535489 100644
--- a/y2014_bot3/control_loops/rollers/BUILD
+++ b/y2014_bot3/control_loops/rollers/BUILD
@@ -1,40 +1,41 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
-load('//aos/build:queues.bzl', 'queue_library')
+load("//aos/build:queues.bzl", "queue_library")
queue_library(
- name = 'rollers_queue',
- srcs = [
- 'rollers.q',
- ],
- deps = [
- '//aos/controls:control_loop_queues',
- '//frc971/control_loops:queues',
- ],
+ name = "rollers_queue",
+ srcs = [
+ "rollers.q",
+ ],
+ deps = [
+ "//aos/controls:control_loop_queues",
+ "//frc971/control_loops:queues",
+ ],
)
cc_library(
- name = 'rollers_lib',
- hdrs = [
- 'rollers.h',
- ],
- srcs = [
- 'rollers.cc',
- ],
- deps = [
- ':rollers_queue',
- '//aos/logging',
- '//aos/controls:control_loop',
- ],
+ name = "rollers_lib",
+ srcs = [
+ "rollers.cc",
+ ],
+ hdrs = [
+ "rollers.h",
+ ],
+ deps = [
+ ":rollers_queue",
+ "//aos/controls:control_loop",
+ "//aos/logging",
+ ],
)
cc_binary(
- name = 'rollers',
- srcs = [
- 'rollers_main.cc',
- ],
- deps = [
- ':rollers_lib',
- '//aos:init',
- ],
+ name = "rollers",
+ srcs = [
+ "rollers_main.cc",
+ ],
+ deps = [
+ ":rollers_lib",
+ "//aos:init",
+ "//aos/events:shm-event-loop",
+ ],
)
diff --git a/y2014_bot3/control_loops/rollers/rollers.cc b/y2014_bot3/control_loops/rollers/rollers.cc
index 573a41f..d2b4da9 100644
--- a/y2014_bot3/control_loops/rollers/rollers.cc
+++ b/y2014_bot3/control_loops/rollers/rollers.cc
@@ -5,8 +5,9 @@
namespace y2014_bot3 {
namespace control_loops {
-Rollers::Rollers(control_loops::RollersQueue *rollers)
- : aos::controls::ControlLoop<control_loops::RollersQueue>(rollers) {}
+Rollers::Rollers(::aos::EventLoop *event_loop, const ::std::string &name)
+ : aos::controls::ControlLoop<control_loops::RollersQueue>(event_loop,
+ name) {}
void Rollers::RunIteration(
const control_loops::RollersQueue::Goal *goal,
diff --git a/y2014_bot3/control_loops/rollers/rollers.h b/y2014_bot3/control_loops/rollers/rollers.h
index edbea7a..9890871 100644
--- a/y2014_bot3/control_loops/rollers/rollers.h
+++ b/y2014_bot3/control_loops/rollers/rollers.h
@@ -12,8 +12,9 @@
public:
// Constructs a control loops which can take a rollers or defaults to the
// rollers at ::2014_bot3::control_loops::rollers.
- explicit Rollers(control_loops::RollersQueue *rollers_queue =
- &control_loops::rollers_queue);
+ explicit Rollers(
+ ::aos::EventLoop *event_loop,
+ const ::std::string &name = ".y2014_bot3.control_loops.rollers_queue");
protected:
// Executes one cycle of the control loop.
diff --git a/y2014_bot3/control_loops/rollers/rollers_main.cc b/y2014_bot3/control_loops/rollers/rollers_main.cc
index b2bb7c9..d783d98 100644
--- a/y2014_bot3/control_loops/rollers/rollers_main.cc
+++ b/y2014_bot3/control_loops/rollers/rollers_main.cc
@@ -1,10 +1,12 @@
#include "y2014_bot3/control_loops/rollers/rollers.h"
+#include "aos/events/shm-event-loop.h"
#include "aos/init.h"
int main() {
::aos::Init();
- ::y2014_bot3::control_loops::Rollers rollers;
+ ::aos::ShmEventLoop event_loop;
+ ::y2014_bot3::control_loops::Rollers rollers(&event_loop);
rollers.Run();
::aos::Cleanup();
return 0;
diff --git a/y2016/control_loops/drivetrain/drivetrain_main.cc b/y2016/control_loops/drivetrain/drivetrain_main.cc
index f461581..e74ddea 100644
--- a/y2016/control_loops/drivetrain/drivetrain_main.cc
+++ b/y2016/control_loops/drivetrain/drivetrain_main.cc
@@ -1,5 +1,6 @@
#include "aos/init.h"
+#include "aos/events/shm-event-loop.h"
#include "frc971/control_loops/drivetrain/drivetrain.h"
#include "y2016/control_loops/drivetrain/drivetrain_base.h"
@@ -7,8 +8,9 @@
int main() {
::aos::Init();
+ ::aos::ShmEventLoop event_loop;
DrivetrainLoop drivetrain(
- ::y2016::control_loops::drivetrain::GetDrivetrainConfig());
+ ::y2016::control_loops::drivetrain::GetDrivetrainConfig(), &event_loop);
drivetrain.Run();
::aos::Cleanup();
return 0;
diff --git a/y2016/control_loops/shooter/BUILD b/y2016/control_loops/shooter/BUILD
index 4f62c7a..8938a2b 100644
--- a/y2016/control_loops/shooter/BUILD
+++ b/y2016/control_loops/shooter/BUILD
@@ -1,87 +1,88 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
-load('//aos/build:queues.bzl', 'queue_library')
+load("//aos/build:queues.bzl", "queue_library")
queue_library(
- name = 'shooter_queue',
- srcs = [
- 'shooter.q',
- ],
- deps = [
- '//aos/controls:control_loop_queues',
- '//frc971/control_loops:queues',
- ],
+ name = "shooter_queue",
+ srcs = [
+ "shooter.q",
+ ],
+ deps = [
+ "//aos/controls:control_loop_queues",
+ "//frc971/control_loops:queues",
+ ],
)
genrule(
- name = 'genrule_shooter',
- visibility = ['//visibility:private'],
- cmd = '$(location //y2016/control_loops/python:shooter) $(OUTS)',
- tools = [
- '//y2016/control_loops/python:shooter',
- ],
- outs = [
- 'shooter_plant.h',
- 'shooter_plant.cc',
- 'shooter_integral_plant.h',
- 'shooter_integral_plant.cc',
- ],
+ name = "genrule_shooter",
+ outs = [
+ "shooter_plant.h",
+ "shooter_plant.cc",
+ "shooter_integral_plant.h",
+ "shooter_integral_plant.cc",
+ ],
+ cmd = "$(location //y2016/control_loops/python:shooter) $(OUTS)",
+ tools = [
+ "//y2016/control_loops/python:shooter",
+ ],
+ visibility = ["//visibility:private"],
)
cc_library(
- name = 'shooter_plants',
- srcs = [
- 'shooter_plant.cc',
- 'shooter_integral_plant.cc',
- ],
- hdrs = [
- 'shooter_plant.h',
- 'shooter_integral_plant.h',
- ],
- deps = [
- '//frc971/control_loops:state_feedback_loop',
- ],
+ name = "shooter_plants",
+ srcs = [
+ "shooter_integral_plant.cc",
+ "shooter_plant.cc",
+ ],
+ hdrs = [
+ "shooter_integral_plant.h",
+ "shooter_plant.h",
+ ],
+ deps = [
+ "//frc971/control_loops:state_feedback_loop",
+ ],
)
cc_library(
- name = 'shooter_lib',
- srcs = [
- 'shooter.cc',
- ],
- hdrs = [
- 'shooter.h',
- ],
- deps = [
- ':shooter_queue',
- ':shooter_plants',
- '//aos/controls:control_loop',
- ],
+ name = "shooter_lib",
+ srcs = [
+ "shooter.cc",
+ ],
+ hdrs = [
+ "shooter.h",
+ ],
+ deps = [
+ ":shooter_plants",
+ ":shooter_queue",
+ "//aos/controls:control_loop",
+ ],
)
cc_test(
- name = 'shooter_lib_test',
- srcs = [
- 'shooter_lib_test.cc',
- ],
- deps = [
- ':shooter_queue',
- ':shooter_lib',
- '//aos/testing:googletest',
- '//aos:queues',
- '//aos/controls:control_loop_test',
- '//frc971/control_loops:state_feedback_loop',
- '//frc971/control_loops:team_number_test_environment',
- ],
+ name = "shooter_lib_test",
+ srcs = [
+ "shooter_lib_test.cc",
+ ],
+ deps = [
+ ":shooter_lib",
+ ":shooter_queue",
+ "//aos:queues",
+ "//aos/controls:control_loop_test",
+ "//aos/testing:googletest",
+ "//frc971/control_loops:state_feedback_loop",
+ "//frc971/control_loops:team_number_test_environment",
+ ],
)
cc_binary(
- name = 'shooter',
- srcs = [
- 'shooter_main.cc',
- ],
- deps = [
- '//aos:init',
- ':shooter_lib',
- ':shooter_queue',
- ],
+ name = "shooter",
+ srcs = [
+ "shooter_main.cc",
+ ],
+ deps = [
+ ":shooter_lib",
+ ":shooter_queue",
+ "//aos:init",
+ "//aos/events:shm-event-loop",
+ ],
)
diff --git a/y2016/control_loops/shooter/shooter.cc b/y2016/control_loops/shooter/shooter.cc
index a047f55..6ae7f0e 100644
--- a/y2016/control_loops/shooter/shooter.cc
+++ b/y2016/control_loops/shooter/shooter.cc
@@ -72,8 +72,8 @@
loop_->next_R(1, 0) > 1.0);
}
-Shooter::Shooter(ShooterQueue *my_shooter)
- : aos::controls::ControlLoop<ShooterQueue>(my_shooter),
+Shooter::Shooter(::aos::EventLoop *event_loop, const ::std::string &name)
+ : aos::controls::ControlLoop<ShooterQueue>(event_loop, name),
shots_(0),
last_pre_shot_timeout_(::aos::monotonic_clock::min_time) {}
diff --git a/y2016/control_loops/shooter/shooter.h b/y2016/control_loops/shooter/shooter.h
index ac5b2d7..9e6968f 100644
--- a/y2016/control_loops/shooter/shooter.h
+++ b/y2016/control_loops/shooter/shooter.h
@@ -4,11 +4,11 @@
#include <memory>
#include "aos/controls/control_loop.h"
+#include "aos/events/event-loop.h"
#include "aos/time/time.h"
#include "frc971/control_loops/state_feedback_loop.h"
-
-#include "y2016/control_loops/shooter/shooter_integral_plant.h"
#include "y2016/control_loops/shooter/shooter.q.h"
+#include "y2016/control_loops/shooter/shooter_integral_plant.h"
namespace y2016 {
namespace control_loops {
@@ -56,7 +56,8 @@
class Shooter : public ::aos::controls::ControlLoop<ShooterQueue> {
public:
explicit Shooter(
- ShooterQueue *shooter_queue = &control_loops::shooter::shooter_queue);
+ ::aos::EventLoop *event_loop,
+ const ::std::string &name = ".y2016.control_loops.shooter.shooter_queue");
enum class ShooterLatchState {
// Any shoot commands will be passed through without modification.
diff --git a/y2016/control_loops/shooter/shooter_lib_test.cc b/y2016/control_loops/shooter/shooter_lib_test.cc
index bba603f..3c8be30 100644
--- a/y2016/control_loops/shooter/shooter_lib_test.cc
+++ b/y2016/control_loops/shooter/shooter_lib_test.cc
@@ -53,11 +53,11 @@
::y2016::control_loops::shooter::MakeShooterPlant())),
shooter_plant_right_(new ShooterPlant(
::y2016::control_loops::shooter::MakeShooterPlant())),
- shooter_queue_(".y2016.control_loops.shooter",
- ".y2016.control_loops.shooter.goal",
- ".y2016.control_loops.shooter.position",
- ".y2016.control_loops.shooter.output",
- ".y2016.control_loops.shooter.status") {}
+ shooter_queue_(".y2016.control_loops.shooter.shooter_queue",
+ ".y2016.control_loops.shooter.shooter_queue.goal",
+ ".y2016.control_loops.shooter.shooter_queue.position",
+ ".y2016.control_loops.shooter.shooter_queue.output",
+ ".y2016.control_loops.shooter.shooter_queue.status") {}
// Sends a queue message with the position of the shooter.
void SendPositionMessage() {
@@ -101,12 +101,12 @@
class ShooterTest : public ::aos::testing::ControlLoopTest {
protected:
ShooterTest()
- : shooter_queue_(".y2016.control_loops.shooter",
- ".y2016.control_loops.shooter.goal",
- ".y2016.control_loops.shooter.position",
- ".y2016.control_loops.shooter.output",
- ".y2016.control_loops.shooter.status"),
- shooter_(&shooter_queue_),
+ : shooter_queue_(".y2016.control_loops.shooter.shooter_queue",
+ ".y2016.control_loops.shooter.shooter_queue.goal",
+ ".y2016.control_loops.shooter.shooter_queue.position",
+ ".y2016.control_loops.shooter.shooter_queue.output",
+ ".y2016.control_loops.shooter.shooter_queue.status"),
+ shooter_(&event_loop_),
shooter_plant_() {
set_team_id(kTeamNumber);
}
@@ -153,6 +153,7 @@
// is no longer valid.
ShooterQueue shooter_queue_;
+ ::aos::ShmEventLoop event_loop_;
// Create a control loop and simulation.
Shooter shooter_;
ShooterSimulation shooter_plant_;
diff --git a/y2016/control_loops/shooter/shooter_main.cc b/y2016/control_loops/shooter/shooter_main.cc
index 2e1d875..8070dde 100644
--- a/y2016/control_loops/shooter/shooter_main.cc
+++ b/y2016/control_loops/shooter/shooter_main.cc
@@ -1,10 +1,12 @@
#include "y2016/control_loops/shooter/shooter.h"
+#include "aos/events/shm-event-loop.h"
#include "aos/init.h"
int main() {
::aos::Init();
- ::y2016::control_loops::shooter::Shooter shooter;
+ ::aos::ShmEventLoop event_loop;
+ ::y2016::control_loops::shooter::Shooter shooter(&event_loop);
shooter.Run();
::aos::Cleanup();
return 0;
diff --git a/y2016/control_loops/superstructure/BUILD b/y2016/control_loops/superstructure/BUILD
index 7f08651..6a14a5f 100644
--- a/y2016/control_loops/superstructure/BUILD
+++ b/y2016/control_loops/superstructure/BUILD
@@ -1,118 +1,119 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
-load('//aos/build:queues.bzl', 'queue_library')
+load("//aos/build:queues.bzl", "queue_library")
queue_library(
- name = 'superstructure_queue',
- srcs = [
- 'superstructure.q',
- ],
- deps = [
- '//aos/controls:control_loop_queues',
- '//frc971/control_loops:queues',
- ],
+ name = "superstructure_queue",
+ srcs = [
+ "superstructure.q",
+ ],
+ deps = [
+ "//aos/controls:control_loop_queues",
+ "//frc971/control_loops:queues",
+ ],
)
genrule(
- name = 'genrule_intake',
- visibility = ['//visibility:private'],
- cmd = '$(location //y2016/control_loops/python:intake) $(OUTS)',
- tools = [
- '//y2016/control_loops/python:intake',
- ],
- outs = [
- 'intake_plant.h',
- 'intake_plant.cc',
- 'integral_intake_plant.h',
- 'integral_intake_plant.cc',
- ],
+ name = "genrule_intake",
+ outs = [
+ "intake_plant.h",
+ "intake_plant.cc",
+ "integral_intake_plant.h",
+ "integral_intake_plant.cc",
+ ],
+ cmd = "$(location //y2016/control_loops/python:intake) $(OUTS)",
+ tools = [
+ "//y2016/control_loops/python:intake",
+ ],
+ visibility = ["//visibility:private"],
)
genrule(
- name = 'genrule_arm',
- visibility = ['//visibility:private'],
- cmd = '$(location //y2016/control_loops/python:arm) $(OUTS)',
- tools = [
- '//y2016/control_loops/python:arm',
- ],
- outs = [
- 'arm_plant.h',
- 'arm_plant.cc',
- 'integral_arm_plant.h',
- 'integral_arm_plant.cc',
- ],
+ name = "genrule_arm",
+ outs = [
+ "arm_plant.h",
+ "arm_plant.cc",
+ "integral_arm_plant.h",
+ "integral_arm_plant.cc",
+ ],
+ cmd = "$(location //y2016/control_loops/python:arm) $(OUTS)",
+ tools = [
+ "//y2016/control_loops/python:arm",
+ ],
+ visibility = ["//visibility:private"],
)
cc_library(
- name = 'superstructure_plants',
- srcs = [
- 'intake_plant.cc',
- 'arm_plant.cc',
- 'integral_intake_plant.cc',
- 'integral_arm_plant.cc',
- ],
- hdrs = [
- 'intake_plant.h',
- 'arm_plant.h',
- 'integral_intake_plant.h',
- 'integral_arm_plant.h',
- ],
- deps = [
- '//frc971/control_loops:state_feedback_loop',
- ],
+ name = "superstructure_plants",
+ srcs = [
+ "arm_plant.cc",
+ "intake_plant.cc",
+ "integral_arm_plant.cc",
+ "integral_intake_plant.cc",
+ ],
+ hdrs = [
+ "arm_plant.h",
+ "intake_plant.h",
+ "integral_arm_plant.h",
+ "integral_intake_plant.h",
+ ],
+ deps = [
+ "//frc971/control_loops:state_feedback_loop",
+ ],
)
cc_library(
- name = 'superstructure_lib',
- srcs = [
- 'superstructure.cc',
- 'superstructure_controls.cc',
- ],
- hdrs = [
- 'superstructure.h',
- 'superstructure_controls.h',
- ],
- deps = [
- ':superstructure_queue',
- ':superstructure_plants',
- '//aos/controls:control_loop',
- '//aos/util:trapezoid_profile',
- '//aos:math',
- '//frc971/control_loops:profiled_subsystem',
- '//frc971/control_loops:simple_capped_state_feedback_loop',
- '//frc971/control_loops:state_feedback_loop',
- '//frc971/zeroing',
- '//y2016/queues:ball_detector',
- '//y2016:constants',
- ],
+ name = "superstructure_lib",
+ srcs = [
+ "superstructure.cc",
+ "superstructure_controls.cc",
+ ],
+ hdrs = [
+ "superstructure.h",
+ "superstructure_controls.h",
+ ],
+ deps = [
+ ":superstructure_plants",
+ ":superstructure_queue",
+ "//aos:math",
+ "//aos/controls:control_loop",
+ "//aos/util:trapezoid_profile",
+ "//frc971/control_loops:profiled_subsystem",
+ "//frc971/control_loops:simple_capped_state_feedback_loop",
+ "//frc971/control_loops:state_feedback_loop",
+ "//frc971/zeroing",
+ "//y2016:constants",
+ "//y2016/queues:ball_detector",
+ ],
)
cc_test(
- name = 'superstructure_lib_test',
- srcs = [
- 'superstructure_lib_test.cc',
- ],
- deps = [
- ':superstructure_queue',
- ':superstructure_lib',
- '//aos/testing:googletest',
- '//aos:queues',
- '//aos/controls:control_loop_test',
- '//aos:math',
- '//aos/time:time',
- '//frc971/control_loops:position_sensor_sim',
- '//frc971/control_loops:team_number_test_environment',
- ],
+ name = "superstructure_lib_test",
+ srcs = [
+ "superstructure_lib_test.cc",
+ ],
+ deps = [
+ ":superstructure_lib",
+ ":superstructure_queue",
+ "//aos:math",
+ "//aos:queues",
+ "//aos/controls:control_loop_test",
+ "//aos/testing:googletest",
+ "//aos/time",
+ "//frc971/control_loops:position_sensor_sim",
+ "//frc971/control_loops:team_number_test_environment",
+ ],
)
cc_binary(
- name = 'superstructure',
- srcs = [
- 'superstructure_main.cc',
- ],
- deps = [
- '//aos:init',
- ':superstructure_lib',
- ':superstructure_queue',
- ],
+ name = "superstructure",
+ srcs = [
+ "superstructure_main.cc",
+ ],
+ deps = [
+ ":superstructure_lib",
+ ":superstructure_queue",
+ "//aos:init",
+ "//aos/events:shm-event-loop",
+ ],
)
diff --git a/y2016/control_loops/superstructure/superstructure.cc b/y2016/control_loops/superstructure/superstructure.cc
index 1bcac52..984bcc3 100644
--- a/y2016/control_loops/superstructure/superstructure.cc
+++ b/y2016/control_loops/superstructure/superstructure.cc
@@ -225,10 +225,10 @@
constexpr double CollisionAvoidance::kMaxWristAngleForSafeArmStowing;
constexpr double CollisionAvoidance::kMaxShoulderAngleUntilSafeIntakeStowing;
-Superstructure::Superstructure(
- control_loops::SuperstructureQueue *superstructure_queue)
- : aos::controls::ControlLoop<control_loops::SuperstructureQueue>(
- superstructure_queue),
+Superstructure::Superstructure(::aos::EventLoop *event_loop,
+ const ::std::string &name)
+ : aos::controls::ControlLoop<control_loops::SuperstructureQueue>(event_loop,
+ name),
collision_avoidance_(&intake_, &arm_) {}
bool Superstructure::IsArmNear(double shoulder_tolerance,
diff --git a/y2016/control_loops/superstructure/superstructure.h b/y2016/control_loops/superstructure/superstructure.h
index 17a1547..7215067 100644
--- a/y2016/control_loops/superstructure/superstructure.h
+++ b/y2016/control_loops/superstructure/superstructure.h
@@ -107,8 +107,8 @@
: public ::aos::controls::ControlLoop<control_loops::SuperstructureQueue> {
public:
explicit Superstructure(
- control_loops::SuperstructureQueue *my_superstructure =
- &control_loops::superstructure_queue);
+ ::aos::EventLoop *event_loop,
+ const ::std::string &name = ".y2016.control_loops.superstructure_queue");
static constexpr double kZeroingVoltage = 6.0;
static constexpr double kShooterHangingVoltage = 6.0;
diff --git a/y2016/control_loops/superstructure/superstructure_lib_test.cc b/y2016/control_loops/superstructure/superstructure_lib_test.cc
index 57ca9fa..d0c4362 100644
--- a/y2016/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2016/control_loops/superstructure/superstructure_lib_test.cc
@@ -88,11 +88,11 @@
pot_encoder_shoulder_(
constants::Values::kShoulderEncoderIndexDifference),
pot_encoder_wrist_(constants::Values::kWristEncoderIndexDifference),
- superstructure_queue_(".y2016.control_loops.superstructure",
- ".y2016.control_loops.superstructure.goal",
- ".y2016.control_loops.superstructure.position",
- ".y2016.control_loops.superstructure.output",
- ".y2016.control_loops.superstructure.status") {
+ superstructure_queue_(".y2016.control_loops.superstructure_queue",
+ ".y2016.control_loops.superstructure_queue.goal",
+ ".y2016.control_loops.superstructure_queue.position",
+ ".y2016.control_loops.superstructure_queue.output",
+ ".y2016.control_loops.superstructure_queue.status") {
InitializeIntakePosition(0.0);
InitializeShoulderPosition(0.0);
InitializeRelativeWristPosition(0.0);
@@ -246,12 +246,12 @@
class SuperstructureTest : public ::aos::testing::ControlLoopTest {
protected:
SuperstructureTest()
- : superstructure_queue_(".y2016.control_loops.superstructure",
- ".y2016.control_loops.superstructure.goal",
- ".y2016.control_loops.superstructure.position",
- ".y2016.control_loops.superstructure.output",
- ".y2016.control_loops.superstructure.status"),
- superstructure_(&superstructure_queue_),
+ : superstructure_queue_(".y2016.control_loops.superstructure_queue",
+ ".y2016.control_loops.superstructure_queue.goal",
+ ".y2016.control_loops.superstructure_queue.position",
+ ".y2016.control_loops.superstructure_queue.output",
+ ".y2016.control_loops.superstructure_queue.status"),
+ superstructure_(&event_loop_),
superstructure_plant_() {}
void VerifyNearGoal() {
@@ -375,6 +375,7 @@
// shared memory that is no longer valid.
SuperstructureQueue superstructure_queue_;
+ ::aos::ShmEventLoop event_loop_;
// Create a control loop and simulation.
Superstructure superstructure_;
SuperstructureSimulation superstructure_plant_;
diff --git a/y2016/control_loops/superstructure/superstructure_main.cc b/y2016/control_loops/superstructure/superstructure_main.cc
index a08074d..435724b 100644
--- a/y2016/control_loops/superstructure/superstructure_main.cc
+++ b/y2016/control_loops/superstructure/superstructure_main.cc
@@ -1,10 +1,13 @@
#include "y2016/control_loops/superstructure/superstructure.h"
+#include "aos/events/shm-event-loop.h"
#include "aos/init.h"
int main() {
::aos::Init();
- ::y2016::control_loops::superstructure::Superstructure superstructure;
+ ::aos::ShmEventLoop event_loop;
+ ::y2016::control_loops::superstructure::Superstructure superstructure(
+ &event_loop);
superstructure.Run();
::aos::Cleanup();
return 0;
diff --git a/y2017/control_loops/drivetrain/BUILD b/y2017/control_loops/drivetrain/BUILD
index 2eb2a0f..409fc93 100644
--- a/y2017/control_loops/drivetrain/BUILD
+++ b/y2017/control_loops/drivetrain/BUILD
@@ -78,6 +78,7 @@
deps = [
":drivetrain_base",
"//aos:init",
+ "//aos/events:shm-event-loop",
"//frc971/control_loops/drivetrain:drivetrain_lib",
],
)
diff --git a/y2017/control_loops/drivetrain/drivetrain_main.cc b/y2017/control_loops/drivetrain/drivetrain_main.cc
index 4507a4a..ffe479a 100644
--- a/y2017/control_loops/drivetrain/drivetrain_main.cc
+++ b/y2017/control_loops/drivetrain/drivetrain_main.cc
@@ -1,5 +1,6 @@
#include "aos/init.h"
+#include "aos/events/shm-event-loop.h"
#include "frc971/control_loops/drivetrain/drivetrain.h"
#include "y2017/control_loops/drivetrain/drivetrain_base.h"
@@ -7,8 +8,9 @@
int main() {
::aos::Init();
+ ::aos::ShmEventLoop event_loop;
DrivetrainLoop drivetrain(
- ::y2017::control_loops::drivetrain::GetDrivetrainConfig());
+ ::y2017::control_loops::drivetrain::GetDrivetrainConfig(), &event_loop);
drivetrain.Run();
::aos::Cleanup();
return 0;
diff --git a/y2017/control_loops/superstructure/BUILD b/y2017/control_loops/superstructure/BUILD
index 732c6dc..e7e6f73 100644
--- a/y2017/control_loops/superstructure/BUILD
+++ b/y2017/control_loops/superstructure/BUILD
@@ -65,6 +65,7 @@
":superstructure_lib",
":superstructure_queue",
"//aos:init",
+ "//aos/events:shm-event-loop",
],
)
diff --git a/y2017/control_loops/superstructure/superstructure.cc b/y2017/control_loops/superstructure/superstructure.cc
index 054fab4..730cd24 100644
--- a/y2017/control_loops/superstructure/superstructure.cc
+++ b/y2017/control_loops/superstructure/superstructure.cc
@@ -23,10 +23,10 @@
typedef ::y2017::constants::Values::ShotParams ShotParams;
using ::frc971::control_loops::drivetrain_queue;
-Superstructure::Superstructure(
- control_loops::SuperstructureQueue *superstructure_queue)
- : aos::controls::ControlLoop<control_loops::SuperstructureQueue>(
- superstructure_queue) {
+Superstructure::Superstructure(::aos::EventLoop *event_loop,
+ const ::std::string &name)
+ : aos::controls::ControlLoop<control_loops::SuperstructureQueue>(event_loop,
+ name) {
shot_interpolation_table_ =
::frc971::shooter_interpolation::InterpolationTable<ShotParams>({
// { distance_to_target, { shot_angle, shot_power, indexer_velocity }},
diff --git a/y2017/control_loops/superstructure/superstructure.h b/y2017/control_loops/superstructure/superstructure.h
index 399e166..580b6a5 100644
--- a/y2017/control_loops/superstructure/superstructure.h
+++ b/y2017/control_loops/superstructure/superstructure.h
@@ -20,8 +20,8 @@
: public ::aos::controls::ControlLoop<control_loops::SuperstructureQueue> {
public:
explicit Superstructure(
- control_loops::SuperstructureQueue *my_superstructure =
- &control_loops::superstructure_queue);
+ ::aos::EventLoop *event_loop,
+ const ::std::string &name = ".y2017.control_loops.superstructure_queue");
const hood::Hood &hood() const { return hood_; }
const intake::Intake &intake() const { return intake_; }
diff --git a/y2017/control_loops/superstructure/superstructure_lib_test.cc b/y2017/control_loops/superstructure/superstructure_lib_test.cc
index de47690..c8f55ff 100644
--- a/y2017/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2017/control_loops/superstructure/superstructure_lib_test.cc
@@ -134,11 +134,12 @@
column_plant_(new ColumnPlant(
::y2017::control_loops::superstructure::column::MakeColumnPlant())),
- superstructure_queue_(".y2017.control_loops.superstructure",
- ".y2017.control_loops.superstructure.goal",
- ".y2017.control_loops.superstructure.position",
- ".y2017.control_loops.superstructure.output",
- ".y2017.control_loops.superstructure.status") {
+ superstructure_queue_(
+ ".y2017.control_loops.superstructure_queue",
+ ".y2017.control_loops.superstructure_queue.goal",
+ ".y2017.control_loops.superstructure_queue.position",
+ ".y2017.control_loops.superstructure_queue.output",
+ ".y2017.control_loops.superstructure_queue.status") {
// Start the hood out in the middle by default.
InitializeHoodPosition((constants::Values::kHoodRange.lower +
constants::Values::kHoodRange.upper) /
@@ -432,12 +433,13 @@
class SuperstructureTest : public ::aos::testing::ControlLoopTest {
protected:
SuperstructureTest()
- : superstructure_queue_(".y2017.control_loops.superstructure",
- ".y2017.control_loops.superstructure.goal",
- ".y2017.control_loops.superstructure.position",
- ".y2017.control_loops.superstructure.output",
- ".y2017.control_loops.superstructure.status"),
- superstructure_(&superstructure_queue_) {
+ : superstructure_queue_(
+ ".y2017.control_loops.superstructure_queue",
+ ".y2017.control_loops.superstructure_queue.goal",
+ ".y2017.control_loops.superstructure_queue.position",
+ ".y2017.control_loops.superstructure_queue.output",
+ ".y2017.control_loops.superstructure_queue.status"),
+ superstructure_(&event_loop_) {
set_team_id(::frc971::control_loops::testing::kTeamNumber);
}
@@ -562,6 +564,7 @@
// that is no longer valid.
SuperstructureQueue superstructure_queue_;
+ ::aos::ShmEventLoop event_loop_;
// Create a control loop and simulation.
Superstructure superstructure_;
SuperstructureSimulation superstructure_plant_;
diff --git a/y2017/control_loops/superstructure/superstructure_main.cc b/y2017/control_loops/superstructure/superstructure_main.cc
index 6ab834b..6ebf91a 100644
--- a/y2017/control_loops/superstructure/superstructure_main.cc
+++ b/y2017/control_loops/superstructure/superstructure_main.cc
@@ -1,10 +1,13 @@
#include "y2017/control_loops/superstructure/superstructure.h"
+#include "aos/events/shm-event-loop.h"
#include "aos/init.h"
int main() {
::aos::Init();
- ::y2017::control_loops::superstructure::Superstructure superstructure;
+ ::aos::ShmEventLoop event_loop;
+ ::y2017::control_loops::superstructure::Superstructure superstructure(
+ &event_loop);
superstructure.Run();
::aos::Cleanup();
return 0;
diff --git a/y2017_bot3/control_loops/drivetrain/BUILD b/y2017_bot3/control_loops/drivetrain/BUILD
index 679e4bf..08aaab2 100644
--- a/y2017_bot3/control_loops/drivetrain/BUILD
+++ b/y2017_bot3/control_loops/drivetrain/BUILD
@@ -77,6 +77,7 @@
deps = [
":drivetrain_base",
"//aos:init",
+ "//aos/events:shm-event-loop",
"//frc971/control_loops/drivetrain:drivetrain_lib",
],
)
diff --git a/y2017_bot3/control_loops/drivetrain/drivetrain_main.cc b/y2017_bot3/control_loops/drivetrain/drivetrain_main.cc
index f24b949..ac581eb 100644
--- a/y2017_bot3/control_loops/drivetrain/drivetrain_main.cc
+++ b/y2017_bot3/control_loops/drivetrain/drivetrain_main.cc
@@ -1,5 +1,6 @@
#include "aos/init.h"
+#include "aos/events/shm-event-loop.h"
#include "frc971/control_loops/drivetrain/drivetrain.h"
#include "y2017_bot3/control_loops/drivetrain/drivetrain_base.h"
@@ -7,8 +8,10 @@
int main() {
::aos::Init();
+ ::aos::ShmEventLoop event_loop;
DrivetrainLoop drivetrain(
- ::y2017_bot3::control_loops::drivetrain::GetDrivetrainConfig());
+ ::y2017_bot3::control_loops::drivetrain::GetDrivetrainConfig(),
+ &event_loop);
drivetrain.Run();
::aos::Cleanup();
return 0;
diff --git a/y2017_bot3/control_loops/superstructure/BUILD b/y2017_bot3/control_loops/superstructure/BUILD
index 17cfc20..9c9f750 100644
--- a/y2017_bot3/control_loops/superstructure/BUILD
+++ b/y2017_bot3/control_loops/superstructure/BUILD
@@ -1,47 +1,48 @@
-package(default_visibility = ['//visibility:public'])
+package(default_visibility = ["//visibility:public"])
-load('//aos/build:queues.bzl', 'queue_library')
+load("//aos/build:queues.bzl", "queue_library")
queue_library(
- name = 'superstructure_queue',
- srcs = [
- 'superstructure.q',
- ],
- deps = [
- '//aos/controls:control_loop_queues',
- '//frc971/control_loops:profiled_subsystem_queue',
- '//frc971/control_loops:queues',
- ],
+ name = "superstructure_queue",
+ srcs = [
+ "superstructure.q",
+ ],
+ deps = [
+ "//aos/controls:control_loop_queues",
+ "//frc971/control_loops:profiled_subsystem_queue",
+ "//frc971/control_loops:queues",
+ ],
)
cc_library(
- name = 'superstructure_lib',
- srcs = [
- 'superstructure.cc',
- ],
- hdrs = [
- 'superstructure.h',
- ],
- deps = [
- ':superstructure_queue',
- '//aos/controls:control_loop',
- '//aos/util:trapezoid_profile',
- '//aos:math',
- '//frc971/control_loops:profiled_subsystem',
- '//frc971/control_loops:simple_capped_state_feedback_loop',
- '//frc971/control_loops:state_feedback_loop',
- '//frc971/zeroing',
- ],
+ name = "superstructure_lib",
+ srcs = [
+ "superstructure.cc",
+ ],
+ hdrs = [
+ "superstructure.h",
+ ],
+ deps = [
+ ":superstructure_queue",
+ "//aos:math",
+ "//aos/controls:control_loop",
+ "//aos/util:trapezoid_profile",
+ "//frc971/control_loops:profiled_subsystem",
+ "//frc971/control_loops:simple_capped_state_feedback_loop",
+ "//frc971/control_loops:state_feedback_loop",
+ "//frc971/zeroing",
+ ],
)
cc_binary(
- name = 'superstructure',
- srcs = [
- 'superstructure_main.cc',
- ],
- deps = [
- '//aos:init',
- ':superstructure_lib',
- ':superstructure_queue',
- ],
+ name = "superstructure",
+ srcs = [
+ "superstructure_main.cc",
+ ],
+ deps = [
+ ":superstructure_lib",
+ ":superstructure_queue",
+ "//aos:init",
+ "//aos/events:shm-event-loop",
+ ],
)
diff --git a/y2017_bot3/control_loops/superstructure/superstructure.cc b/y2017_bot3/control_loops/superstructure/superstructure.cc
index 1b91c69..e75ffed 100644
--- a/y2017_bot3/control_loops/superstructure/superstructure.cc
+++ b/y2017_bot3/control_loops/superstructure/superstructure.cc
@@ -8,10 +8,10 @@
namespace control_loops {
namespace superstructure {
-Superstructure::Superstructure(
- control_loops::SuperstructureQueue *superstructure_queue)
- : aos::controls::ControlLoop<control_loops::SuperstructureQueue>(
- superstructure_queue) {}
+Superstructure::Superstructure(::aos::EventLoop *event_loop,
+ const ::std::string &name)
+ : aos::controls::ControlLoop<control_loops::SuperstructureQueue>(event_loop,
+ name) {}
void Superstructure::RunIteration(
const control_loops::SuperstructureQueue::Goal *unsafe_goal,
diff --git a/y2017_bot3/control_loops/superstructure/superstructure.h b/y2017_bot3/control_loops/superstructure/superstructure.h
index 99a75e3..a9378eb 100644
--- a/y2017_bot3/control_loops/superstructure/superstructure.h
+++ b/y2017_bot3/control_loops/superstructure/superstructure.h
@@ -16,9 +16,9 @@
class Superstructure
: public ::aos::controls::ControlLoop<control_loops::SuperstructureQueue> {
public:
- explicit Superstructure(
- control_loops::SuperstructureQueue *my_superstructure =
- &control_loops::superstructure_queue);
+ explicit Superstructure(::aos::EventLoop *event_loop,
+ const ::std::string &name =
+ ".y2017_bot3.control_loops.superstructure_queue");
static constexpr double kOperatingVoltage = 12.0;
diff --git a/y2017_bot3/control_loops/superstructure/superstructure_main.cc b/y2017_bot3/control_loops/superstructure/superstructure_main.cc
index 378b498..38df40e 100644
--- a/y2017_bot3/control_loops/superstructure/superstructure_main.cc
+++ b/y2017_bot3/control_loops/superstructure/superstructure_main.cc
@@ -4,7 +4,9 @@
int main() {
::aos::Init();
- ::y2017_bot3::control_loops::superstructure::Superstructure superstructure;
+ ::aos::ShmEventLoop event_loop;
+ ::y2017_bot3::control_loops::superstructure::Superstructure superstructure(
+ &event_loop);
superstructure.Run();
::aos::Cleanup();
return 0;
diff --git a/y2018/control_loops/drivetrain/drivetrain_main.cc b/y2018/control_loops/drivetrain/drivetrain_main.cc
index 15d99be..f0c7f0e 100644
--- a/y2018/control_loops/drivetrain/drivetrain_main.cc
+++ b/y2018/control_loops/drivetrain/drivetrain_main.cc
@@ -1,5 +1,6 @@
#include "aos/init.h"
+#include "aos/events/shm-event-loop.h"
#include "frc971/control_loops/drivetrain/drivetrain.h"
#include "y2018/control_loops/drivetrain/drivetrain_base.h"
@@ -7,8 +8,9 @@
int main() {
::aos::Init();
+ ::aos::ShmEventLoop event_loop;
DrivetrainLoop drivetrain(
- ::y2018::control_loops::drivetrain::GetDrivetrainConfig());
+ ::y2018::control_loops::drivetrain::GetDrivetrainConfig(), &event_loop);
drivetrain.Run();
::aos::Cleanup();
return 0;
diff --git a/y2018/control_loops/superstructure/superstructure.cc b/y2018/control_loops/superstructure/superstructure.cc
index c2d0bcf..9474b6d 100644
--- a/y2018/control_loops/superstructure/superstructure.cc
+++ b/y2018/control_loops/superstructure/superstructure.cc
@@ -35,10 +35,10 @@
}
}
-Superstructure::Superstructure(
- control_loops::SuperstructureQueue *superstructure_queue)
- : aos::controls::ControlLoop<control_loops::SuperstructureQueue>(
- superstructure_queue),
+Superstructure::Superstructure(::aos::EventLoop *event_loop,
+ const ::std::string &name)
+ : aos::controls::ControlLoop<control_loops::SuperstructureQueue>(event_loop,
+ name),
intake_left_(constants::GetValues().left_intake.zeroing),
intake_right_(constants::GetValues().right_intake.zeroing) {}
diff --git a/y2018/control_loops/superstructure/superstructure.h b/y2018/control_loops/superstructure/superstructure.h
index 4f8f4d5..3d1a6af 100644
--- a/y2018/control_loops/superstructure/superstructure.h
+++ b/y2018/control_loops/superstructure/superstructure.h
@@ -17,8 +17,8 @@
: public ::aos::controls::ControlLoop<control_loops::SuperstructureQueue> {
public:
explicit Superstructure(
- control_loops::SuperstructureQueue *my_superstructure =
- &control_loops::superstructure_queue);
+ ::aos::EventLoop *event_loop,
+ const ::std::string &name = ".y2018.control_loops.superstructure_queue");
const intake::IntakeSide &intake_left() const { return intake_left_; }
const intake::IntakeSide &intake_right() const { return intake_right_; }
diff --git a/y2018/control_loops/superstructure/superstructure_lib_test.cc b/y2018/control_loops/superstructure/superstructure_lib_test.cc
index 0ad4d16..89cfaa0 100644
--- a/y2018/control_loops/superstructure/superstructure_lib_test.cc
+++ b/y2018/control_loops/superstructure/superstructure_lib_test.cc
@@ -273,7 +273,7 @@
".y2018.control_loops.superstructure.output",
".y2018.control_loops.superstructure.status",
".y2018.control_loops.superstructure.position"),
- superstructure_(&superstructure_queue_) {
+ superstructure_(&event_loop_, ".y2018.control_loops.superstructure") {
status_light.Clear();
::y2018::vision::vision_status.Clear();
::frc971::control_loops::drivetrain_queue.output.Clear();
@@ -323,6 +323,7 @@
}
}
+ ::aos::ShmEventLoop event_loop_;
// Create a new instance of the test queue so that it invalidates the queue
// that it points to. Otherwise, we will have a pointer to shared memory
// that is no longer valid.
diff --git a/y2018/control_loops/superstructure/superstructure_main.cc b/y2018/control_loops/superstructure/superstructure_main.cc
index fca04e8..f5b026c 100644
--- a/y2018/control_loops/superstructure/superstructure_main.cc
+++ b/y2018/control_loops/superstructure/superstructure_main.cc
@@ -1,10 +1,13 @@
#include "y2018/control_loops/superstructure/superstructure.h"
+#include "aos/events/shm-event-loop.h"
#include "aos/init.h"
int main() {
::aos::InitNRT(true);
- ::y2018::control_loops::superstructure::Superstructure superstructure;
+ ::aos::ShmEventLoop event_loop;
+ ::y2018::control_loops::superstructure::Superstructure superstructure(
+ &event_loop);
::aos::GoRT();
superstructure.Run();
::aos::Cleanup();
diff --git a/y2018_bot3/control_loops/drivetrain/BUILD b/y2018_bot3/control_loops/drivetrain/BUILD
index d3fabe1..62484c0 100644
--- a/y2018_bot3/control_loops/drivetrain/BUILD
+++ b/y2018_bot3/control_loops/drivetrain/BUILD
@@ -74,6 +74,7 @@
deps = [
":drivetrain_base",
"//aos:init",
+ "//aos/events:shm-event-loop",
"//frc971/control_loops/drivetrain:drivetrain_lib",
],
)
diff --git a/y2018_bot3/control_loops/drivetrain/drivetrain_main.cc b/y2018_bot3/control_loops/drivetrain/drivetrain_main.cc
index cd91f7c..e481f6c 100644
--- a/y2018_bot3/control_loops/drivetrain/drivetrain_main.cc
+++ b/y2018_bot3/control_loops/drivetrain/drivetrain_main.cc
@@ -1,5 +1,6 @@
#include "aos/init.h"
+#include "aos/events/shm-event-loop.h"
#include "frc971/control_loops/drivetrain/drivetrain.h"
#include "y2018_bot3/control_loops/drivetrain/drivetrain_base.h"
@@ -7,8 +8,10 @@
int main() {
::aos::Init();
+ ::aos::ShmEventLoop event_loop;
DrivetrainLoop drivetrain(
- ::y2018_bot3::control_loops::drivetrain::GetDrivetrainConfig());
+ ::y2018_bot3::control_loops::drivetrain::GetDrivetrainConfig(),
+ &event_loop);
drivetrain.Run();
::aos::Cleanup();
return 0;
diff --git a/y2019/control_loops/drivetrain/BUILD b/y2019/control_loops/drivetrain/BUILD
index 819c7f8..959e839 100644
--- a/y2019/control_loops/drivetrain/BUILD
+++ b/y2019/control_loops/drivetrain/BUILD
@@ -76,6 +76,7 @@
deps = [
":drivetrain_base",
"//aos:init",
+ "//aos/events:shm-event-loop",
"//frc971/control_loops/drivetrain:drivetrain_lib",
],
)
diff --git a/y2019/control_loops/drivetrain/drivetrain_main.cc b/y2019/control_loops/drivetrain/drivetrain_main.cc
index c872622..4e23987 100644
--- a/y2019/control_loops/drivetrain/drivetrain_main.cc
+++ b/y2019/control_loops/drivetrain/drivetrain_main.cc
@@ -1,5 +1,6 @@
#include "aos/init.h"
+#include "aos/events/shm-event-loop.h"
#include "frc971/control_loops/drivetrain/drivetrain.h"
#include "y2019/control_loops/drivetrain/drivetrain_base.h"
@@ -7,8 +8,9 @@
int main() {
::aos::Init();
+ ::aos::ShmEventLoop event_loop;
DrivetrainLoop drivetrain(
- ::y2019::control_loops::drivetrain::GetDrivetrainConfig());
+ ::y2019::control_loops::drivetrain::GetDrivetrainConfig(), &event_loop);
drivetrain.Run();
::aos::Cleanup();
return 0;
diff --git a/y2019/control_loops/superstructure/BUILD b/y2019/control_loops/superstructure/BUILD
index 79d851a..5d07e17 100644
--- a/y2019/control_loops/superstructure/BUILD
+++ b/y2019/control_loops/superstructure/BUILD
@@ -15,7 +15,7 @@
)
cc_library(
- name = 'superstructure_lib',
+ name = "superstructure_lib",
srcs = [
"superstructure.cc",
],
@@ -25,7 +25,7 @@
deps = [
":superstructure_queue",
"//aos/controls:control_loop",
- ]
+ ],
)
cc_binary(
@@ -36,5 +36,6 @@
deps = [
":superstructure_lib",
"//aos:init",
- ]
-)
\ No newline at end of file
+ "//aos/events:shm-event-loop",
+ ],
+)
diff --git a/y2019/control_loops/superstructure/superstructure.cc b/y2019/control_loops/superstructure/superstructure.cc
index 2f0832c..e87ef6e 100644
--- a/y2019/control_loops/superstructure/superstructure.cc
+++ b/y2019/control_loops/superstructure/superstructure.cc
@@ -7,10 +7,9 @@
namespace control_loops {
namespace superstructure {
-Superstructure::Superstructure(
- SuperstructureQueue *superstructure_queue)
- : aos::controls::ControlLoop<SuperstructureQueue>(
- superstructure_queue) {}
+Superstructure::Superstructure(::aos::EventLoop *event_loop,
+ const ::std::string &name)
+ : aos::controls::ControlLoop<SuperstructureQueue>(event_loop, name) {}
void Superstructure::RunIteration(
const SuperstructureQueue::Goal *unsafe_goal,
@@ -29,4 +28,4 @@
} // namespace superstructure
} // namespace control_loops
-} // namespace y2019
\ No newline at end of file
+} // namespace y2019
diff --git a/y2019/control_loops/superstructure/superstructure.h b/y2019/control_loops/superstructure/superstructure.h
index 1faa6b4..0d6765e 100644
--- a/y2019/control_loops/superstructure/superstructure.h
+++ b/y2019/control_loops/superstructure/superstructure.h
@@ -12,8 +12,9 @@
: public ::aos::controls::ControlLoop<SuperstructureQueue> {
public:
explicit Superstructure(
- SuperstructureQueue *my_superstructure =
- &superstructure_queue);
+ ::aos::EventLoop *event_loop,
+ const ::std::string &name =
+ ".y2019.control_loops.superstructure.superstructure_queue");
protected:
virtual void RunIteration(
@@ -31,4 +32,4 @@
} // namespace control_loops
} // namespace y2019
-#endif // Y2019_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_
\ No newline at end of file
+#endif // Y2019_CONTROL_LOOPS_SUPERSTRUCTURE_SUPERSTRUCTURE_H_
diff --git a/y2019/control_loops/superstructure/superstructure_main.cc b/y2019/control_loops/superstructure/superstructure_main.cc
index f3dd1ad..fe7be09 100644
--- a/y2019/control_loops/superstructure/superstructure_main.cc
+++ b/y2019/control_loops/superstructure/superstructure_main.cc
@@ -1,10 +1,13 @@
#include "y2019/control_loops/superstructure/superstructure.h"
+#include "aos/events/shm-event-loop.h"
#include "aos/init.h"
int main() {
::aos::Init();
- ::y2019::control_loops::superstructure::Superstructure superstructure;
+ ::aos::ShmEventLoop event_loop;
+ ::y2019::control_loops::superstructure::Superstructure superstructure(
+ &event_loop);
superstructure.Run();
::aos::Cleanup();
return 0;