Dedulicate make_unique
This also gets us off of the WPILib one which goes away for 2019.
Change-Id: I0436ce8fd477bbb27d9b0a7c4832dad01c9bad35
diff --git a/y2014/BUILD b/y2014/BUILD
index dfd2325..e4ad2ed 100644
--- a/y2014/BUILD
+++ b/y2014/BUILD
@@ -11,8 +11,8 @@
visibility = ["//visibility:public"],
deps = [
"//aos:once",
- "//aos/mutex:mutex",
"//aos/logging",
+ "//aos/mutex",
"//aos/network:team_number",
"//frc971:shifter_hall_effect",
"//frc971/control_loops:state_feedback_loop",
@@ -27,12 +27,12 @@
],
deps = [
":constants",
- "//aos/time:time",
- "//aos/actions:action_lib",
- "//aos/logging",
- "//aos/util:log_interval",
- "//aos/input:joystick_input",
"//aos:init",
+ "//aos/actions:action_lib",
+ "//aos/input:joystick_input",
+ "//aos/logging",
+ "//aos/time",
+ "//aos/util:log_interval",
"//frc971/autonomous:auto_queue",
"//frc971/control_loops/drivetrain:drivetrain_queue",
"//frc971/queues:gyro",
@@ -61,10 +61,10 @@
"hot_goal_reader.cc",
],
deps = [
- "//aos/time:time",
+ "//aos:init",
"//aos/logging",
"//aos/logging:queue_logging",
- "//aos:init",
+ "//aos/time",
"//y2014/queues:hot_goal",
],
)
@@ -77,16 +77,17 @@
restricted_to = ["//tools:roborio"],
deps = [
":constants",
- "//aos/stl_mutex:stl_mutex",
- "//aos/time:time",
+ "//aos:init",
+ "//aos:make_unique",
"//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/control_loops:queues",
"//frc971/control_loops/drivetrain:drivetrain_queue",
"//frc971/wpilib:buffered_pcm",
diff --git a/y2014/wpilib_interface.cc b/y2014/wpilib_interface.cc
index 2cd9b50..af28012 100644
--- a/y2014/wpilib_interface.cc
+++ b/y2014/wpilib_interface.cc
@@ -18,15 +18,16 @@
#include "frc971/wpilib/wpilib_robot_base.h"
#undef ERROR
+#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"
#include "aos/util/log_interval.h"
#include "aos/util/phased_loop.h"
#include "aos/util/wrapping_counter.h"
-#include "aos/stl_mutex/stl_mutex.h"
-#include "aos/init.h"
-#include "aos/robot_state/robot_state.q.h"
#include "frc971/shifter_hall_effect.h"
@@ -57,6 +58,7 @@
using ::y2014::control_loops::claw_queue;
using ::y2014::control_loops::shooter_queue;
using namespace frc;
+using aos::make_unique;
namespace y2014 {
namespace wpilib {
@@ -65,13 +67,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)...));
-}
-
double drivetrain_translate(int32_t in) {
return -static_cast<double>(in) /
(256.0 /*cpr*/ * 4.0 /*4x*/) *