Move aos/input and aos/robot_state to frc971/input
Neither folder makes any sense as part of aos/.
Change-Id: I10e0532da4e688c18a9354012b783c43566fd2a1
diff --git a/y2014/BUILD b/y2014/BUILD
index 458c411..a223253 100644
--- a/y2014/BUILD
+++ b/y2014/BUILD
@@ -32,7 +32,7 @@
":constants",
"//aos:init",
"//aos/actions:action_lib",
- "//aos/input:action_joystick_input",
+ "//frc971/input:action_joystick_input",
"//aos/logging",
"//aos/time",
"//aos/util:log_interval",
@@ -91,7 +91,7 @@
target_compatible_with = ["@platforms//os:linux"],
visibility = ["//visibility:public"],
deps = [
- "//aos/robot_state:config",
+ "//frc971/input:config",
"//frc971/control_loops/drivetrain:config",
],
)
@@ -108,7 +108,7 @@
"//aos:make_unique",
"//aos/controls:control_loop",
"//aos/logging",
- "//aos/robot_state:robot_state_fbs",
+ "//frc971/input:robot_state_fbs",
"//aos/stl_mutex",
"//aos/time",
"//aos/util:log_interval",
diff --git a/y2014/joystick_reader.cc b/y2014/joystick_reader.cc
index 136f65a..d2a7ed9 100644
--- a/y2014/joystick_reader.cc
+++ b/y2014/joystick_reader.cc
@@ -1,17 +1,16 @@
+#include <math.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <math.h>
#include "aos/actions/actions.h"
#include "aos/init.h"
-#include "aos/input/action_joystick_input.h"
-#include "aos/input/driver_station_data.h"
#include "aos/logging/logging.h"
#include "aos/time/time.h"
#include "aos/util/log_interval.h"
-
#include "frc971/control_loops/drivetrain/drivetrain_status_generated.h"
+#include "frc971/input/action_joystick_input.h"
+#include "frc971/input/driver_station_data.h"
#include "y2014/actors/shoot_actor.h"
#include "y2014/constants.h"
#include "y2014/control_loops/claw/claw_goal_generated.h"
@@ -19,9 +18,9 @@
#include "y2014/control_loops/drivetrain/drivetrain_base.h"
#include "y2014/control_loops/shooter/shooter_goal_generated.h"
-using ::aos::input::driver_station::ButtonLocation;
-using ::aos::input::driver_station::JoystickAxis;
-using ::aos::input::driver_station::ControlBit;
+using ::frc971::input::driver_station::ButtonLocation;
+using ::frc971::input::driver_station::ControlBit;
+using ::frc971::input::driver_station::JoystickAxis;
#define OLD_DS 0
@@ -30,7 +29,7 @@
namespace joysticks {
const ButtonLocation kDriveControlLoopEnable1(1, 7),
- kDriveControlLoopEnable2(1, 11);
+ kDriveControlLoopEnable2(1, 11);
const JoystickAxis kSteeringWheel(1, 1), kDriveThrottle(2, 2);
const ButtonLocation kShiftHigh(2, 3), kShiftLow(2, 1);
const ButtonLocation kQuickTurn(1, 5);
@@ -150,12 +149,13 @@
const ClawGoal k254PassGoal = {-1.95, kGrabSeparation};
const ClawGoal kFlipped254PassGoal = {1.96, kGrabSeparation};
-class Reader : public ::aos::input::ActionJoystickInput {
+class Reader : public ::frc971::input::ActionJoystickInput {
public:
Reader(::aos::EventLoop *event_loop)
- : ::aos::input::ActionJoystickInput(
+ : ::frc971::input::ActionJoystickInput(
event_loop, control_loops::GetDrivetrainConfig(),
- ::aos::input::DrivetrainInputReader::InputType::kSteeringWheel, {}),
+ ::frc971::input::DrivetrainInputReader::InputType::kSteeringWheel,
+ {}),
claw_status_fetcher_(
event_loop->MakeFetcher<::y2014::control_loops::claw::Status>(
"/claw")),
@@ -194,7 +194,8 @@
intake_power_ = goal.intake_power;
}
- void HandleTeleop(const ::aos::input::driver_station::Data &data) override {
+ void HandleTeleop(
+ const ::frc971::input::driver_station::Data &data) override {
if (data.IsPressed(kRollersIn) || data.IsPressed(kRollersOut)) {
intake_power_ = 0.0;
separation_angle_ = kGrabSeparation;
@@ -206,8 +207,8 @@
if (OLD_DS || ::std::abs(claw_goal_adjust) < kAdjustClawGoalDeadband) {
claw_goal_adjust = 0;
} else {
- claw_goal_adjust = (claw_goal_adjust -
- ((claw_goal_adjust < 0) ? -kAdjustClawGoalDeadband
+ claw_goal_adjust = (claw_goal_adjust - ((claw_goal_adjust < 0)
+ ? -kAdjustClawGoalDeadband
: kAdjustClawGoalDeadband)) *
0.035;
}
@@ -217,8 +218,8 @@
claw_separation_adjust = 0;
} else {
claw_separation_adjust =
- (claw_separation_adjust -
- ((claw_separation_adjust < 0) ? -kAdjustClawGoalDeadband
+ (claw_separation_adjust - ((claw_separation_adjust < 0)
+ ? -kAdjustClawGoalDeadband
: kAdjustClawGoalDeadband)) *
-0.035;
}
diff --git a/y2014/wpilib_interface.cc b/y2014/wpilib_interface.cc
index ae2ced0..8f53ee2 100644
--- a/y2014/wpilib_interface.cc
+++ b/y2014/wpilib_interface.cc
@@ -1,12 +1,12 @@
+#include <inttypes.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
-#include <inttypes.h>
-#include <thread>
#include <chrono>
-#include <mutex>
#include <functional>
+#include <mutex>
+#include <thread>
#include "frc971/wpilib/ahal/AnalogInput.h"
#include "frc971/wpilib/ahal/Compressor.h"
@@ -22,7 +22,6 @@
#include "aos/init.h"
#include "aos/logging/logging.h"
#include "aos/make_unique.h"
-#include "aos/robot_state/robot_state_generated.h"
#include "aos/stl_mutex/stl_mutex.h"
#include "aos/time/time.h"
#include "aos/util/log_interval.h"
@@ -30,6 +29,7 @@
#include "aos/util/wrapping_counter.h"
#include "frc971/control_loops/drivetrain/drivetrain_output_generated.h"
#include "frc971/control_loops/drivetrain/drivetrain_position_generated.h"
+#include "frc971/input/robot_state_generated.h"
#include "frc971/shifter_hall_effect.h"
#include "frc971/wpilib/buffered_pcm.h"
#include "frc971/wpilib/buffered_solenoid.h"
@@ -63,8 +63,7 @@
// The low bit is direction.
double drivetrain_translate(int32_t in) {
- return -static_cast<double>(in) /
- (256.0 /*cpr*/ * 4.0 /*4x*/) *
+ return -static_cast<double>(in) / (256.0 /*cpr*/ * 4.0 /*4x*/) *
constants::GetValues().drivetrain_encoder_ratio *
(3.5 /*wheel diameter*/ * 2.54 / 100.0 * M_PI) * 2.0 / 2.0;
}
@@ -75,16 +74,16 @@
(3.5 /*wheel diameter*/ * 2.54 / 100.0 * M_PI) * 2.0 / 2.0;
}
-float hall_translate(const constants::DualHallShifterHallEffect &k, float in_low,
- float in_high) {
+float hall_translate(const constants::DualHallShifterHallEffect &k,
+ float in_low, float in_high) {
const float low_ratio =
0.5 * (in_low - static_cast<float>(k.shifter_hall_effect.low_gear_low)) /
- static_cast<float>(k.low_gear_middle - k.shifter_hall_effect.low_gear_low);
+ static_cast<float>(k.low_gear_middle -
+ k.shifter_hall_effect.low_gear_low);
const float high_ratio =
- 0.5 +
- 0.5 * (in_high - static_cast<float>(k.high_gear_middle)) /
- static_cast<float>(k.shifter_hall_effect.high_gear_high -
- k.high_gear_middle);
+ 0.5 + 0.5 * (in_high - static_cast<float>(k.high_gear_middle)) /
+ static_cast<float>(k.shifter_hall_effect.high_gear_high -
+ k.high_gear_middle);
// Return low when we are below 1/2, and high when we are above 1/2.
if (low_ratio + high_ratio < 1.0) {
@@ -378,7 +377,6 @@
synchronizer_.RunIteration();
-
::frc971::HallEffectStructT front;
CopyPosition(front_counter_.get(), &front);
flatbuffers::Offset<::frc971::HallEffectStruct> front_offset =
diff --git a/y2014/y2014.json b/y2014/y2014.json
index 38440a0..837529e 100644
--- a/y2014/y2014.json
+++ b/y2014/y2014.json
@@ -48,7 +48,7 @@
}
],
"imports": [
- "../aos/robot_state/robot_state_config.json",
+ "../frc971/input/robot_state_config.json",
"../frc971/control_loops/drivetrain/drivetrain_config.json"
]
}