Dedulicate make_unique
This also gets us off of the WPILib one which goes away for 2019.
Change-Id: I0436ce8fd477bbb27d9b0a7c4832dad01c9bad35
diff --git a/y2017/BUILD b/y2017/BUILD
index e002758..4e86603 100644
--- a/y2017/BUILD
+++ b/y2017/BUILD
@@ -1,4 +1,4 @@
-load('//frc971:downloader.bzl', 'robot_downloader')
+load("//frc971:downloader.bzl", "robot_downloader")
cc_library(
name = "constants",
@@ -11,8 +11,8 @@
visibility = ["//visibility:public"],
deps = [
"//aos:once",
- "//aos/mutex:mutex",
"//aos/logging",
+ "//aos/mutex",
"//aos/network:team_number",
"//frc971:constants",
"//frc971/shooter_interpolation:interpolation",
@@ -31,13 +31,13 @@
],
deps = [
":constants",
- "//aos/time:time",
+ "//aos:init",
"//aos/actions:action_lib",
- "//aos/logging",
- "//aos/util:log_interval",
"//aos/input:drivetrain_input",
"//aos/input:joystick_input",
- "//aos:init",
+ "//aos/logging",
+ "//aos/time",
+ "//aos/util:log_interval",
"//frc971/autonomous:auto_queue",
"//frc971/control_loops/drivetrain:drivetrain_queue",
"//y2017/actors:autonomous_action_lib",
@@ -54,17 +54,18 @@
restricted_to = ["//tools:roborio"],
deps = [
":constants",
+ "//aos:init",
+ "//aos:make_unique",
"//aos:math",
- "//aos/stl_mutex:stl_mutex",
- "//aos/time:time",
"//aos/controls:control_loop",
"//aos/logging",
"//aos/logging:queue_logging",
- "//aos/robot_state:robot_state",
+ "//aos/robot_state",
+ "//aos/stl_mutex",
+ "//aos/time",
"//aos/util:log_interval",
"//aos/util:phased_loop",
"//aos/util:wrapping_counter",
- "//aos:init",
"//frc971/autonomous:auto_queue",
"//frc971/control_loops:queues",
"//frc971/control_loops/drivetrain:drivetrain_queue",
@@ -86,13 +87,13 @@
)
robot_downloader(
- start_binaries = [
- ':joystick_reader',
- ':wpilib_interface',
- '//y2017/control_loops/drivetrain:drivetrain',
- '//y2017/control_loops/superstructure:superstructure',
- '//y2017/actors:autonomous_action',
- ],
+ start_binaries = [
+ ":joystick_reader",
+ ":wpilib_interface",
+ "//y2017/control_loops/drivetrain:drivetrain",
+ "//y2017/control_loops/superstructure:superstructure",
+ "//y2017/actors:autonomous_action",
+ ],
)
py_library(
diff --git a/y2017/wpilib_interface.cc b/y2017/wpilib_interface.cc
index 4906009..1663ecd 100644
--- a/y2017/wpilib_interface.cc
+++ b/y2017/wpilib_interface.cc
@@ -22,8 +22,10 @@
#undef ERROR
#include "aos/commonmath.h"
+#include "aos/init.h"
#include "aos/logging/logging.h"
#include "aos/logging/queue_logging.h"
+#include "aos/make_unique.h"
#include "aos/robot_state/robot_state.q.h"
#include "aos/stl_mutex/stl_mutex.h"
#include "aos/time/time.h"
@@ -31,7 +33,6 @@
#include "aos/util/log_interval.h"
#include "aos/util/phased_loop.h"
#include "aos/util/wrapping_counter.h"
-#include "aos/init.h"
#include "frc971/autonomous/auto.q.h"
#include "frc971/control_loops/control_loops.q.h"
@@ -62,6 +63,7 @@
using ::aos::monotonic_clock;
namespace chrono = ::std::chrono;
using namespace frc;
+using aos::make_unique;
namespace y2017 {
namespace wpilib {
@@ -73,13 +75,6 @@
// DMA stuff and then removing the * 2.0 in *_translate.
// The low bit is direction.
-// TODO(brian): Replace this with ::std::make_unique once all our toolchains
-// have support.
-template <class T, class... U>
-std::unique_ptr<T> make_unique(U &&... u) {
- return std::unique_ptr<T>(new T(std::forward<U>(u)...));
-}
-
// TODO(brian): Use ::std::max instead once we have C++14 so that can be
// constexpr.
template <typename T>