Finish moving //y2014/... into its own namespace
Stuff didn't compile in the half-switched state it was in before.
Change-Id: I00ec3c79a2682982b12d4e8c8e682cb8625eb06d
diff --git a/y2014/actors/drivetrain_action.q b/y2014/actors/drivetrain_action.q
index 9ad55d3..2f3eb15 100644
--- a/y2014/actors/drivetrain_action.q
+++ b/y2014/actors/drivetrain_action.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2014.actors;
import "aos/common/actions/actions.q";
diff --git a/y2014/actors/drivetrain_actor.cc b/y2014/actors/drivetrain_actor.cc
index aa1f6f2..9f94ff4 100644
--- a/y2014/actors/drivetrain_actor.cc
+++ b/y2014/actors/drivetrain_actor.cc
@@ -15,7 +15,7 @@
#include "y2014/constants.h"
#include "y2014/control_loops/drivetrain/drivetrain.q.h"
-namespace frc971 {
+namespace y2014 {
namespace actors {
DrivetrainActor::DrivetrainActor(actors::DrivetrainActionQueueGroup* s)
@@ -162,10 +162,10 @@
}
::std::unique_ptr<DrivetrainAction> MakeDrivetrainAction(
- const ::frc971::actors::DrivetrainActionParams& params) {
+ const ::y2014::actors::DrivetrainActionParams& params) {
return ::std::unique_ptr<DrivetrainAction>(
- new DrivetrainAction(&::frc971::actors::drivetrain_action, params));
+ new DrivetrainAction(&::y2014::actors::drivetrain_action, params));
}
} // namespace actors
-} // namespace frc971
+} // namespace y2014
diff --git a/y2014/actors/drivetrain_actor.h b/y2014/actors/drivetrain_actor.h
index 888b2c0..2a9e307 100644
--- a/y2014/actors/drivetrain_actor.h
+++ b/y2014/actors/drivetrain_actor.h
@@ -9,7 +9,7 @@
#include "y2014/actors/drivetrain_action.q.h"
-namespace frc971 {
+namespace y2014 {
namespace actors {
class DrivetrainActor
@@ -28,9 +28,9 @@
// Makes a new DrivetrainActor action.
::std::unique_ptr<DrivetrainAction> MakeDrivetrainAction(
- const ::frc971::actors::DrivetrainActionParams& params);
+ const ::y2014::actors::DrivetrainActionParams& params);
} // namespace actors
-} // namespace frc971
+} // namespace y2014
#endif
diff --git a/y2014/actors/drivetrain_actor_main.cc b/y2014/actors/drivetrain_actor_main.cc
index 375e71c..ef65d5b 100644
--- a/y2014/actors/drivetrain_actor_main.cc
+++ b/y2014/actors/drivetrain_actor_main.cc
@@ -9,8 +9,8 @@
int main(int /*argc*/, char * /*argv*/[]) {
::aos::Init();
- frc971::actors::DrivetrainActor drivetrain(
- &::frc971::actors::drivetrain_action);
+ ::y2014::actors::DrivetrainActor drivetrain(
+ &::y2014::actors::drivetrain_action);
drivetrain.Run();
::aos::Cleanup();
diff --git a/y2014/actors/shoot_action.q b/y2014/actors/shoot_action.q
index 1c545aa..9c56e99 100644
--- a/y2014/actors/shoot_action.q
+++ b/y2014/actors/shoot_action.q
@@ -1,4 +1,4 @@
-package frc971.actors;
+package y2014.actors;
import "aos/common/actions/actions.q";
diff --git a/y2014/actors/shoot_actor.cc b/y2014/actors/shoot_actor.cc
index 9db34c4..a70d692 100644
--- a/y2014/actors/shoot_actor.cc
+++ b/y2014/actors/shoot_actor.cc
@@ -9,7 +9,7 @@
#include "y2014/constants.h"
#include "y2014/control_loops/drivetrain/drivetrain.q.h"
-namespace frc971 {
+namespace y2014 {
namespace actors {
namespace {
@@ -44,7 +44,7 @@
: ::aos::common::actions::ActorBase<actors::ShootActionQueueGroup>(s) {}
double ShootActor::SpeedToAngleOffset(double speed) {
- const frc971::constants::Values& values = frc971::constants::GetValues();
+ const constants::Values& values = constants::GetValues();
// scale speed to a [0.0-1.0] on something close to the max
return (speed / values.drivetrain_max_speed) * kOffsetRadians;
}
@@ -171,8 +171,8 @@
::std::unique_ptr<ShootAction> MakeShootAction() {
return ::std::unique_ptr<ShootAction>(
- new ShootAction(&::frc971::actors::shoot_action, 0.0));
+ new ShootAction(&::y2014::actors::shoot_action, 0.0));
}
} // namespace actors
-} // namespace frc971
+} // namespace y2014
diff --git a/y2014/actors/shoot_actor.h b/y2014/actors/shoot_actor.h
index 3adfe31..4ede888 100644
--- a/y2014/actors/shoot_actor.h
+++ b/y2014/actors/shoot_actor.h
@@ -8,7 +8,7 @@
#include "y2014/actors/shoot_action.q.h"
-namespace frc971 {
+namespace y2014 {
namespace actors {
class ShootActor
@@ -47,6 +47,6 @@
::std::unique_ptr<ShootAction> MakeShootAction();
} // namespace actors
-} // namespace frc971
+} // namespace y2014
#endif // Y2014_ACTORS_SHOOT_ACTOR_H_
diff --git a/y2014/actors/shoot_actor_main.cc b/y2014/actors/shoot_actor_main.cc
index efa4377..fb27f93 100644
--- a/y2014/actors/shoot_actor_main.cc
+++ b/y2014/actors/shoot_actor_main.cc
@@ -9,7 +9,7 @@
int main(int /*argc*/, char * /*argv*/[]) {
::aos::Init();
- frc971::actors::ShootActor shoot(&::frc971::actors::shoot_action);
+ ::y2014::actors::ShootActor shoot(&::y2014::actors::shoot_action);
shoot.Run();
::aos::Cleanup();
diff --git a/y2014/autonomous/auto.cc b/y2014/autonomous/auto.cc
index fe4099a..899d071 100644
--- a/y2014/autonomous/auto.cc
+++ b/y2014/autonomous/auto.cc
@@ -23,7 +23,7 @@
using ::aos::time::Time;
-namespace frc971 {
+namespace y2014 {
namespace autonomous {
namespace time = ::aos::time;
@@ -180,12 +180,12 @@
const ProfileParams kSlowWithBallDrive = {2.5, 2.0};
const ProfileParams kFastTurn = {3.0, 10.0};
-::std::unique_ptr<::frc971::actors::DrivetrainAction> SetDriveGoal(
+::std::unique_ptr<::y2014::actors::DrivetrainAction> SetDriveGoal(
double distance, const ProfileParams drive_params, double theta = 0,
const ProfileParams &turn_params = kFastTurn) {
LOG(INFO, "Driving to %f\n", distance);
- ::frc971::actors::DrivetrainActionParams params;
+ ::y2014::actors::DrivetrainActionParams params;
params.left_initial_position = left_initial_position;
params.right_initial_position = right_initial_position;
params.y_offset = distance;
@@ -328,7 +328,7 @@
private:
static const uint64_t kThreshold = 5;
- ::frc971::HotGoal start_counts_;
+ ::y2014::HotGoal start_counts_;
bool start_counts_valid_;
};
@@ -348,17 +348,17 @@
LOG(INFO, "Handling auto mode\n");
AutoVersion auto_version;
- ::frc971::sensors::auto_mode.FetchLatest();
- if (!::frc971::sensors::auto_mode.get()) {
+ ::y2014::sensors::auto_mode.FetchLatest();
+ if (!::y2014::sensors::auto_mode.get()) {
LOG(WARNING, "not sure which auto mode to use\n");
auto_version = AutoVersion::kStraight;
} else {
static const double kSelectorMin = 0.2, kSelectorMax = 4.4;
const double kSelectorStep = (kSelectorMax - kSelectorMin) / 3.0;
- if (::frc971::sensors::auto_mode->voltage < kSelectorStep + kSelectorMin) {
+ if (::y2014::sensors::auto_mode->voltage < kSelectorStep + kSelectorMin) {
auto_version = AutoVersion::kSingleHot;
- } else if (::frc971::sensors::auto_mode->voltage <
+ } else if (::y2014::sensors::auto_mode->voltage <
2 * kSelectorStep + kSelectorMin) {
auto_version = AutoVersion::kStraight;
} else {
@@ -529,4 +529,4 @@
}
} // namespace autonomous
-} // namespace frc971
+} // namespace y2014
diff --git a/y2014/autonomous/auto.h b/y2014/autonomous/auto.h
index 3e4885f..dd00bba 100644
--- a/y2014/autonomous/auto.h
+++ b/y2014/autonomous/auto.h
@@ -1,12 +1,12 @@
#ifndef Y2014_AUTONOMOUS_AUTO_H_
#define Y2014_AUTONOMOUS_AUTO_H_
-namespace frc971 {
+namespace y2014 {
namespace autonomous {
void HandleAuto();
} // namespace autonomous
-} // namespace frc971
+} // namespace y2014
#endif // Y2014_AUTONOMOUS_AUTO_H_
diff --git a/y2014/autonomous/auto_main.cc b/y2014/autonomous/auto_main.cc
index 3dbad2c..253b237 100644
--- a/y2014/autonomous/auto_main.cc
+++ b/y2014/autonomous/auto_main.cc
@@ -25,7 +25,7 @@
}
LOG(INFO, "Starting auto mode\n");
::aos::time::Time start_time = ::aos::time::Time::Now();
- ::frc971::autonomous::HandleAuto();
+ ::y2014::autonomous::HandleAuto();
::aos::time::Time elapsed_time = ::aos::time::Time::Now() - start_time;
LOG(INFO, "Auto mode exited in %f, waiting for it to finish.\n",
diff --git a/y2014/control_loops/claw/claw.cc b/y2014/control_loops/claw/claw.cc
index 040cef3..4f71410 100644
--- a/y2014/control_loops/claw/claw.cc
+++ b/y2014/control_loops/claw/claw.cc
@@ -50,7 +50,7 @@
using ::frc971::HallEffectTracker;
using ::y2014::control_loops::claw::kDt;
using ::frc971::control_loops::DoCoerceGoal;
-using ::frc971::control_loops::ClawPositionToLog;
+using ::y2014::control_loops::ClawPositionToLog;
static const double kZeroingVoltage = 4.0;
static const double kMaxVoltage = 12.0;
@@ -220,7 +220,7 @@
last_encoder_(0.0) {}
void ZeroedStateFeedbackLoop::SetPositionValues(
- const ::frc971::control_loops::HalfClawPosition &claw) {
+ const ::y2014::control_loops::HalfClawPosition &claw) {
front_.Update(claw.front);
calibration_.Update(claw.calibration);
back_.Update(claw.back);
@@ -295,7 +295,7 @@
}
void ZeroedStateFeedbackLoop::Reset(
- const ::frc971::control_loops::HalfClawPosition &claw) {
+ const ::y2014::control_loops::HalfClawPosition &claw) {
set_zeroing_state(ZeroedStateFeedbackLoop::UNKNOWN_POSITION);
front_.Reset(claw.front);
@@ -371,8 +371,8 @@
return false;
}
-ClawMotor::ClawMotor(::frc971::control_loops::ClawQueue *my_claw)
- : aos::controls::ControlLoop<::frc971::control_loops::ClawQueue>(my_claw),
+ClawMotor::ClawMotor(::y2014::control_loops::ClawQueue *my_claw)
+ : aos::controls::ControlLoop<::y2014::control_loops::ClawQueue>(my_claw),
has_top_claw_goal_(false),
top_claw_goal_(0.0),
top_claw_(this),
@@ -617,10 +617,10 @@
// Positive angle is up, and positive power is up.
void ClawMotor::RunIteration(
- const ::frc971::control_loops::ClawQueue::Goal *goal,
- const ::frc971::control_loops::ClawQueue::Position *position,
- ::frc971::control_loops::ClawQueue::Output *output,
- ::frc971::control_loops::ClawQueue::Status *status) {
+ const ::y2014::control_loops::ClawQueue::Goal *goal,
+ const ::y2014::control_loops::ClawQueue::Position *position,
+ ::y2014::control_loops::ClawQueue::Output *output,
+ ::y2014::control_loops::ClawQueue::Status *status) {
// Disable the motors now so that all early returns will return with the
// motors disabled.
if (output) {
diff --git a/y2014/control_loops/claw/claw.h b/y2014/control_loops/claw/claw.h
index 86875bb..88f038f 100644
--- a/y2014/control_loops/claw/claw.h
+++ b/y2014/control_loops/claw/claw.h
@@ -77,9 +77,9 @@
}
JointZeroingState zeroing_state() const { return zeroing_state_; }
- void SetPositionValues(const ::frc971::control_loops::HalfClawPosition &claw);
+ void SetPositionValues(const ::y2014::control_loops::HalfClawPosition &claw);
- void Reset(const ::frc971::control_loops::HalfClawPosition &claw);
+ void Reset(const ::y2014::control_loops::HalfClawPosition &claw);
double absolute_position() const { return encoder() + offset(); }
@@ -183,10 +183,10 @@
};
class ClawMotor
- : public aos::controls::ControlLoop<::frc971::control_loops::ClawQueue> {
+ : public aos::controls::ControlLoop<::y2014::control_loops::ClawQueue> {
public:
- explicit ClawMotor(::frc971::control_loops::ClawQueue *my_claw =
- &::frc971::control_loops::claw_queue);
+ explicit ClawMotor(::y2014::control_loops::ClawQueue *my_claw =
+ &::y2014::control_loops::claw_queue);
// True if the state machine is ready.
bool capped_goal() const { return capped_goal_; }
@@ -217,10 +217,10 @@
protected:
virtual void RunIteration(
- const ::frc971::control_loops::ClawQueue::Goal *goal,
- const ::frc971::control_loops::ClawQueue::Position *position,
- ::frc971::control_loops::ClawQueue::Output *output,
- ::frc971::control_loops::ClawQueue::Status *status);
+ const ::y2014::control_loops::ClawQueue::Goal *goal,
+ const ::y2014::control_loops::ClawQueue::Position *position,
+ ::y2014::control_loops::ClawQueue::Output *output,
+ ::y2014::control_loops::ClawQueue::Status *status);
double top_absolute_position() const {
return claw_.X_hat(1, 0) + claw_.X_hat(0, 0);
diff --git a/y2014/control_loops/claw/claw.q b/y2014/control_loops/claw/claw.q
index a116970..1afdd85 100644
--- a/y2014/control_loops/claw/claw.q
+++ b/y2014/control_loops/claw/claw.q
@@ -1,4 +1,4 @@
-package frc971.control_loops;
+package y2014.control_loops;
import "aos/common/controls/control_loops.q";
import "frc971/control_loops/control_loops.q";
@@ -8,11 +8,11 @@
double position;
// The hall effect sensor at the front limit.
- HallEffectStruct front;
+ .frc971.HallEffectStruct front;
// The hall effect sensor in the middle to use for real calibration.
- HallEffectStruct calibration;
+ .frc971.HallEffectStruct calibration;
// The hall effect at the back limit.
- HallEffectStruct back;
+ .frc971.HallEffectStruct back;
};
// All angles here are 0 vertical, positive "up" (aka backwards).
diff --git a/y2014/control_loops/claw/claw_calibration.cc b/y2014/control_loops/claw/claw_calibration.cc
index 01d57a4..0dc3c06 100644
--- a/y2014/control_loops/claw/claw_calibration.cc
+++ b/y2014/control_loops/claw/claw_calibration.cc
@@ -24,7 +24,7 @@
}
bool DoGetPositionOfEdge(
- const ::frc971::control_loops::HalfClawPosition &claw_position,
+ const ::y2014::control_loops::HalfClawPosition &claw_position,
const HallEffectStruct &hall_effect, Claws::AnglePair *limits) {
bool print = false;
@@ -112,14 +112,14 @@
public:
ClawSensors(
const double start_position,
- const ::frc971::control_loops::HalfClawPosition &initial_claw_position)
+ const ::y2014::control_loops::HalfClawPosition &initial_claw_position)
: start_position_(start_position),
front_(start_position, initial_claw_position.front),
calibration_(start_position, initial_claw_position.calibration),
back_(start_position, initial_claw_position.back) {}
bool GetPositionOfEdge(
- const ::frc971::control_loops::HalfClawPosition &claw_position,
+ const ::y2014::control_loops::HalfClawPosition &claw_position,
Claws::Claw *claw) {
bool print = false;
if (front_.DoGetPositionOfEdge(claw_position,
@@ -155,17 +155,17 @@
};
int Main() {
- ::frc971::control_loops::claw_queue.position.FetchNextBlocking();
+ ::y2014::control_loops::claw_queue.position.FetchNextBlocking();
const double top_start_position =
- ::frc971::control_loops::claw_queue.position->top.position;
+ ::y2014::control_loops::claw_queue.position->top.position;
const double bottom_start_position =
- ::frc971::control_loops::claw_queue.position->bottom.position;
+ ::y2014::control_loops::claw_queue.position->bottom.position;
ClawSensors top(top_start_position,
- ::frc971::control_loops::claw_queue.position->top);
+ ::y2014::control_loops::claw_queue.position->top);
ClawSensors bottom(bottom_start_position,
- ::frc971::control_loops::claw_queue.position->bottom);
+ ::y2014::control_loops::claw_queue.position->bottom);
Claws limits;
@@ -219,28 +219,28 @@
limits.start_fine_tune_pos = -0.2;
limits.max_zeroing_voltage = 4.0;
- ::frc971::control_loops::ClawQueue::Position last_position =
- *::frc971::control_loops::claw_queue.position;
+ ::y2014::control_loops::ClawQueue::Position last_position =
+ *::y2014::control_loops::claw_queue.position;
while (true) {
- ::frc971::control_loops::claw_queue.position.FetchNextBlocking();
+ ::y2014::control_loops::claw_queue.position.FetchNextBlocking();
bool print = false;
- if (top.GetPositionOfEdge(::frc971::control_loops::claw_queue.position->top,
+ if (top.GetPositionOfEdge(::y2014::control_loops::claw_queue.position->top,
&limits.upper_claw)) {
print = true;
printf("Got an edge on the upper claw\n");
}
if (bottom.GetPositionOfEdge(
- ::frc971::control_loops::claw_queue.position->bottom,
+ ::y2014::control_loops::claw_queue.position->bottom,
&limits.lower_claw)) {
print = true;
printf("Got an edge on the lower claw\n");
}
const double top_position =
- ::frc971::control_loops::claw_queue.position->top.position -
+ ::y2014::control_loops::claw_queue.position->top.position -
top_start_position;
const double bottom_position =
- ::frc971::control_loops::claw_queue.position->bottom.position -
+ ::y2014::control_loops::claw_queue.position->bottom.position -
bottom_start_position;
const double separation = top_position - bottom_position;
if (separation > limits.claw_max_separation) {
@@ -302,7 +302,7 @@
printf("}\n");
}
- last_position = *::frc971::control_loops::claw_queue.position;
+ last_position = *::y2014::control_loops::claw_queue.position;
}
return 0;
}
diff --git a/y2014/control_loops/claw/claw_lib_test.cc b/y2014/control_loops/claw/claw_lib_test.cc
index 85cb679..afce10e 100644
--- a/y2014/control_loops/claw/claw_lib_test.cc
+++ b/y2014/control_loops/claw/claw_lib_test.cc
@@ -19,7 +19,7 @@
using ::y2014::control_loops::claw::MakeClawPlant;
using ::frc971::HallEffectStruct;
-using ::frc971::control_loops::HalfClawPosition;
+using ::y2014::control_loops::HalfClawPosition;
typedef enum {
TOP_CLAW = 0,
@@ -111,7 +111,7 @@
// Sets the values of the physical sensors that can be directly observed
// (encoder, hall effect).
void SetPhysicalSensors(
- ::frc971::control_loops::ClawQueue::Position *position) {
+ ::y2014::control_loops::ClawQueue::Position *position) {
position->top.position = GetPosition(TOP_CLAW);
position->bottom.position = GetPosition(BOTTOM_CLAW);
@@ -186,7 +186,7 @@
// Sends out the position queue messages.
void SendPositionMessage() {
- ::aos::ScopedMessagePtr<::frc971::control_loops::ClawQueue::Position>
+ ::aos::ScopedMessagePtr<::y2014::control_loops::ClawQueue::Position>
position = claw_queue.position.MakeMessage();
// Initialize all the counters to their previous values.
@@ -239,10 +239,10 @@
initial_position_[type] = initial_position;
}
- ::frc971::control_loops::ClawQueue claw_queue;
+ ::y2014::control_loops::ClawQueue claw_queue;
double initial_position_[CLAW_COUNT];
- ::frc971::control_loops::ClawQueue::Position last_position_;
+ ::y2014::control_loops::ClawQueue::Position last_position_;
};
@@ -251,7 +251,7 @@
// 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.
- ::frc971::control_loops::ClawQueue claw_queue;
+ ::y2014::control_loops::ClawQueue claw_queue;
// Create a loop and simulation plant.
ClawMotor claw_motor_;
diff --git a/y2014/control_loops/claw/replay_claw.cc b/y2014/control_loops/claw/replay_claw.cc
index 70d881c..15cc9d9 100644
--- a/y2014/control_loops/claw/replay_claw.cc
+++ b/y2014/control_loops/claw/replay_claw.cc
@@ -14,8 +14,8 @@
::aos::InitNRT();
- ::aos::controls::ControlLoopReplayer<::frc971::control_loops::ClawQueue>
- replayer(&::frc971::control_loops::claw_queue, "claw");
+ ::aos::controls::ControlLoopReplayer<::y2014::control_loops::ClawQueue>
+ replayer(&::y2014::control_loops::claw_queue, "claw");
for (int i = 1; i < argc; ++i) {
replayer.ProcessFile(argv[i]);
}
diff --git a/y2014/control_loops/drivetrain/drivetrain.cc b/y2014/control_loops/drivetrain/drivetrain.cc
index 23b03f3..98974a5 100644
--- a/y2014/control_loops/drivetrain/drivetrain.cc
+++ b/y2014/control_loops/drivetrain/drivetrain.cc
@@ -30,18 +30,18 @@
namespace drivetrain {
DrivetrainLoop::DrivetrainLoop(
- ::frc971::control_loops::DrivetrainQueue *my_drivetrain)
- : aos::controls::ControlLoop<::frc971::control_loops::DrivetrainQueue>(
+ ::y2014::control_loops::DrivetrainQueue *my_drivetrain)
+ : aos::controls::ControlLoop<::y2014::control_loops::DrivetrainQueue>(
my_drivetrain),
kf_(::y2014::control_loops::drivetrain::MakeKFDrivetrainLoop()) {
::aos::controls::HPolytope<0>::Init();
}
void DrivetrainLoop::RunIteration(
- const ::frc971::control_loops::DrivetrainQueue::Goal *goal,
- const ::frc971::control_loops::DrivetrainQueue::Position *position,
- ::frc971::control_loops::DrivetrainQueue::Output *output,
- ::frc971::control_loops::DrivetrainQueue::Status *status) {
+ const ::y2014::control_loops::DrivetrainQueue::Goal *goal,
+ const ::y2014::control_loops::DrivetrainQueue::Position *position,
+ ::y2014::control_loops::DrivetrainQueue::Output *output,
+ ::y2014::control_loops::DrivetrainQueue::Status *status) {
bool bad_pos = false;
if (position == nullptr) {
LOG_INTERVAL(no_position_);
diff --git a/y2014/control_loops/drivetrain/drivetrain.h b/y2014/control_loops/drivetrain/drivetrain.h
index 5b8da12..7ecc09f 100644
--- a/y2014/control_loops/drivetrain/drivetrain.h
+++ b/y2014/control_loops/drivetrain/drivetrain.h
@@ -15,22 +15,22 @@
namespace control_loops {
namespace drivetrain {
-class DrivetrainLoop
- : public aos::controls::ControlLoop<::frc971::control_loops::DrivetrainQueue> {
+class DrivetrainLoop : public aos::controls::ControlLoop<
+ ::y2014::control_loops::DrivetrainQueue> {
public:
// Constructs a control loop which can take a Drivetrain or defaults to the
- // drivetrain at frc971::control_loops::drivetrain
+ // drivetrain at y2014::control_loops::drivetrain
explicit DrivetrainLoop(
- ::frc971::control_loops::DrivetrainQueue *my_drivetrain =
- &::frc971::control_loops::drivetrain_queue);
+ ::y2014::control_loops::DrivetrainQueue *my_drivetrain =
+ &::y2014::control_loops::drivetrain_queue);
protected:
// Executes one cycle of the control loop.
virtual void RunIteration(
- const ::frc971::control_loops::DrivetrainQueue::Goal *goal,
- const ::frc971::control_loops::DrivetrainQueue::Position *position,
- ::frc971::control_loops::DrivetrainQueue::Output *output,
- ::frc971::control_loops::DrivetrainQueue::Status *status);
+ const ::y2014::control_loops::DrivetrainQueue::Goal *goal,
+ const ::y2014::control_loops::DrivetrainQueue::Position *position,
+ ::y2014::control_loops::DrivetrainQueue::Output *output,
+ ::y2014::control_loops::DrivetrainQueue::Status *status);
typedef ::aos::util::SimpleLogInterval SimpleLogInterval;
SimpleLogInterval no_position_ = SimpleLogInterval(
diff --git a/y2014/control_loops/drivetrain/drivetrain.q b/y2014/control_loops/drivetrain/drivetrain.q
index 585b8ed..86b8b04 100644
--- a/y2014/control_loops/drivetrain/drivetrain.q
+++ b/y2014/control_loops/drivetrain/drivetrain.q
@@ -1,4 +1,4 @@
-package frc971.control_loops;
+package y2014.control_loops;
import "aos/common/controls/control_loops.q";
diff --git a/y2014/control_loops/drivetrain/drivetrain_lib_test.cc b/y2014/control_loops/drivetrain/drivetrain_lib_test.cc
index f455b57..9fdfbd8 100644
--- a/y2014/control_loops/drivetrain/drivetrain_lib_test.cc
+++ b/y2014/control_loops/drivetrain/drivetrain_lib_test.cc
@@ -79,7 +79,7 @@
const double left_encoder = GetLeftPosition();
const double right_encoder = GetRightPosition();
- ::aos::ScopedMessagePtr<::frc971::control_loops::DrivetrainQueue::Position>
+ ::aos::ScopedMessagePtr<::y2014::control_loops::DrivetrainQueue::Position>
position = my_drivetrain_queue_.position.MakeMessage();
position->left_encoder = left_encoder;
position->right_encoder = right_encoder;
@@ -98,7 +98,7 @@
::std::unique_ptr<StateFeedbackPlant<4, 2, 2>> drivetrain_plant_;
private:
- ::frc971::control_loops::DrivetrainQueue my_drivetrain_queue_;
+ ::y2014::control_loops::DrivetrainQueue my_drivetrain_queue_;
double last_left_position_;
double last_right_position_;
};
@@ -108,7 +108,7 @@
// 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.
- ::frc971::control_loops::DrivetrainQueue my_drivetrain_queue_;
+ ::y2014::control_loops::DrivetrainQueue my_drivetrain_queue_;
// Create a loop and simulation plant.
DrivetrainLoop drivetrain_motor_;
diff --git a/y2014/control_loops/drivetrain/polydrivetrain.cc b/y2014/control_loops/drivetrain/polydrivetrain.cc
index 795ad04..a49fa22 100644
--- a/y2014/control_loops/drivetrain/polydrivetrain.cc
+++ b/y2014/control_loops/drivetrain/polydrivetrain.cc
@@ -19,8 +19,8 @@
namespace control_loops {
namespace drivetrain {
-using ::frc971::control_loops::GearLogging;
-using ::frc971::control_loops::CIMLogging;
+using ::y2014::control_loops::GearLogging;
+using ::y2014::control_loops::CIMLogging;
using ::frc971::control_loops::CoerceGoal;
PolyDrivetrain::PolyDrivetrain()
@@ -158,7 +158,7 @@
}
}
void PolyDrivetrain::SetPosition(
- const ::frc971::control_loops::DrivetrainQueue::Position *position) {
+ const ::y2014::control_loops::DrivetrainQueue::Position *position) {
const auto &values = constants::GetValues();
if (position == NULL) {
++stale_count_;
@@ -402,7 +402,7 @@
}
void PolyDrivetrain::SendMotors(
- ::frc971::control_loops::DrivetrainQueue::Output *output) {
+ ::y2014::control_loops::DrivetrainQueue::Output *output) {
if (output != NULL) {
output->left_voltage = loop_->U(0, 0);
output->right_voltage = loop_->U(1, 0);
diff --git a/y2014/control_loops/drivetrain/polydrivetrain.h b/y2014/control_loops/drivetrain/polydrivetrain.h
index 999509e..864eec8 100644
--- a/y2014/control_loops/drivetrain/polydrivetrain.h
+++ b/y2014/control_loops/drivetrain/polydrivetrain.h
@@ -47,7 +47,7 @@
void SetGoal(double wheel, double throttle, bool quickturn, bool highgear);
void SetPosition(
- const ::frc971::control_loops::DrivetrainQueue::Position *position);
+ const ::y2014::control_loops::DrivetrainQueue::Position *position);
double FilterVelocity(double throttle);
@@ -55,7 +55,7 @@
void Update();
- void SendMotors(::frc971::control_loops::DrivetrainQueue::Output *output);
+ void SendMotors(::y2014::control_loops::DrivetrainQueue::Output *output);
private:
const ::aos::controls::HPolytope<2> U_Poly_;
@@ -70,8 +70,8 @@
double position_time_delta_;
Gear left_gear_;
Gear right_gear_;
- ::frc971::control_loops::DrivetrainQueue::Position last_position_;
- ::frc971::control_loops::DrivetrainQueue::Position position_;
+ ::y2014::control_loops::DrivetrainQueue::Position last_position_;
+ ::y2014::control_loops::DrivetrainQueue::Position position_;
int counter_;
};
diff --git a/y2014/control_loops/drivetrain/replay_drivetrain.cc b/y2014/control_loops/drivetrain/replay_drivetrain.cc
index 091d992..346ca69 100644
--- a/y2014/control_loops/drivetrain/replay_drivetrain.cc
+++ b/y2014/control_loops/drivetrain/replay_drivetrain.cc
@@ -15,8 +15,8 @@
::aos::InitNRT();
- ::aos::controls::ControlLoopReplayer<::frc971::control_loops::DrivetrainQueue>
- replayer(&::frc971::control_loops::drivetrain_queue, "drivetrain");
+ ::aos::controls::ControlLoopReplayer<::y2014::control_loops::DrivetrainQueue>
+ replayer(&::y2014::control_loops::drivetrain_queue, "drivetrain");
replayer.AddDirectQueueSender("wpilib_interface.Gyro", "sending",
::frc971::sensors::gyro_reading);
diff --git a/y2014/control_loops/drivetrain/ssdrivetrain.cc b/y2014/control_loops/drivetrain/ssdrivetrain.cc
index 3c2a962..9576bcd 100644
--- a/y2014/control_loops/drivetrain/ssdrivetrain.cc
+++ b/y2014/control_loops/drivetrain/ssdrivetrain.cc
@@ -172,7 +172,7 @@
}
void DrivetrainMotorsSS::SendMotors(
- ::frc971::control_loops::DrivetrainQueue::Output *output) const {
+ ::y2014::control_loops::DrivetrainQueue::Output *output) const {
if (output) {
output->left_voltage = loop_->U(0, 0);
output->right_voltage = loop_->U(1, 0);
diff --git a/y2014/control_loops/drivetrain/ssdrivetrain.h b/y2014/control_loops/drivetrain/ssdrivetrain.h
index 5945f96..1964ac5 100644
--- a/y2014/control_loops/drivetrain/ssdrivetrain.h
+++ b/y2014/control_loops/drivetrain/ssdrivetrain.h
@@ -63,7 +63,7 @@
}
void SendMotors(
- ::frc971::control_loops::DrivetrainQueue::Output *output) const;
+ ::y2014::control_loops::DrivetrainQueue::Output *output) const;
const LimitedDrivetrainLoop &loop() const { return *loop_; }
diff --git a/y2014/control_loops/shooter/replay_shooter.cc b/y2014/control_loops/shooter/replay_shooter.cc
index 20c953f..1263f8a 100644
--- a/y2014/control_loops/shooter/replay_shooter.cc
+++ b/y2014/control_loops/shooter/replay_shooter.cc
@@ -14,8 +14,8 @@
::aos::InitNRT();
- ::aos::controls::ControlLoopReplayer<::frc971::control_loops::ShooterQueue>
- replayer(&::frc971::control_loops::shooter_queue, "shooter");
+ ::aos::controls::ControlLoopReplayer<::y2014::control_loops::ShooterQueue>
+ replayer(&::y2014::control_loops::shooter_queue, "shooter");
for (int i = 1; i < argc; ++i) {
replayer.ProcessFile(argv[i]);
}
diff --git a/y2014/control_loops/shooter/shooter.cc b/y2014/control_loops/shooter/shooter.cc
index 39bf5c0..faeeaf0 100644
--- a/y2014/control_loops/shooter/shooter.cc
+++ b/y2014/control_loops/shooter/shooter.cc
@@ -44,7 +44,7 @@
LOG_STRUCT(
DEBUG, "shooter_output",
- ::frc971::control_loops::ShooterVoltageToLog(X_hat(2, 0), voltage_));
+ ::y2014::control_loops::ShooterVoltageToLog(X_hat(2, 0), voltage_));
last_voltage_ = voltage_;
capped_goal_ = false;
@@ -64,7 +64,7 @@
}
capped_goal_ = true;
LOG_STRUCT(DEBUG, "to prevent windup",
- ::frc971::control_loops::ShooterMovingGoal(dx));
+ ::y2014::control_loops::ShooterMovingGoal(dx));
} else if (uncapped_voltage() < -max_voltage_) {
double dx;
if (controller_index() == 0) {
@@ -78,7 +78,7 @@
}
capped_goal_ = true;
LOG_STRUCT(DEBUG, "to prevent windup",
- ::frc971::control_loops::ShooterMovingGoal(dx));
+ ::y2014::control_loops::ShooterMovingGoal(dx));
} else {
capped_goal_ = false;
}
@@ -105,13 +105,13 @@
mutable_R(2, 0) += -A(1, 0) / A(1, 2) * (doffset);
}
LOG_STRUCT(DEBUG, "sensor edge (fake?)",
- ::frc971::control_loops::ShooterChangeCalibration(
+ ::y2014::control_loops::ShooterChangeCalibration(
encoder_val, known_position, old_position, absolute_position(),
previous_offset, offset_));
}
-ShooterMotor::ShooterMotor(::frc971::control_loops::ShooterQueue *my_shooter)
- : aos::controls::ControlLoop<::frc971::control_loops::ShooterQueue>(
+ShooterMotor::ShooterMotor(::y2014::control_loops::ShooterQueue *my_shooter)
+ : aos::controls::ControlLoop<::y2014::control_loops::ShooterQueue>(
my_shooter),
shooter_(MakeShooterLoop()),
state_(STATE_INITIALIZE),
@@ -136,11 +136,11 @@
(kMaxExtension - values.shooter.upper_limit));
if (power < 0) {
LOG_STRUCT(WARNING, "negative power",
- ::frc971::control_loops::PowerAdjustment(power, 0));
+ ::y2014::control_loops::PowerAdjustment(power, 0));
power = 0;
} else if (power > maxpower) {
LOG_STRUCT(WARNING, "power too high",
- ::frc971::control_loops::PowerAdjustment(power, maxpower));
+ ::y2014::control_loops::PowerAdjustment(power, maxpower));
power = maxpower;
}
@@ -164,7 +164,7 @@
}
void ShooterMotor::CheckCalibrations(
- const ::frc971::control_loops::ShooterQueue::Position *position) {
+ const ::y2014::control_loops::ShooterQueue::Position *position) {
CHECK_NOTNULL(position);
const constants::Values &values = constants::GetValues();
@@ -213,10 +213,10 @@
// Positive is out, and positive power is out.
void ShooterMotor::RunIteration(
- const ::frc971::control_loops::ShooterQueue::Goal *goal,
- const ::frc971::control_loops::ShooterQueue::Position *position,
- ::frc971::control_loops::ShooterQueue::Output *output,
- ::frc971::control_loops::ShooterQueue::Status *status) {
+ const ::y2014::control_loops::ShooterQueue::Goal *goal,
+ const ::y2014::control_loops::ShooterQueue::Position *position,
+ ::y2014::control_loops::ShooterQueue::Output *output,
+ ::y2014::control_loops::ShooterQueue::Status *status) {
if (goal && ::std::isnan(goal->shot_power)) {
state_ = STATE_ESTOP;
LOG(ERROR, "Estopping because got a shot power of NAN.\n");
@@ -648,7 +648,7 @@
if (!shooter_loop_disable) {
LOG_STRUCT(DEBUG, "running the loop",
- ::frc971::control_loops::ShooterStatusToLog(
+ ::y2014::control_loops::ShooterStatusToLog(
shooter_.goal_position(), shooter_.absolute_position()));
if (!cap_goal) {
shooter_.set_max_voltage(12.0);
@@ -675,7 +675,7 @@
if (position) {
LOG_STRUCT(DEBUG, "internal state",
- ::frc971::control_loops::ShooterStateToLog(
+ ::y2014::control_loops::ShooterStateToLog(
shooter_.absolute_position(), shooter_.absolute_velocity(),
state_, position->latch, position->pusher_proximal.current,
position->pusher_distal.current, position->plunger,
diff --git a/y2014/control_loops/shooter/shooter.h b/y2014/control_loops/shooter/shooter.h
index 107fc65..cccb953 100644
--- a/y2014/control_loops/shooter/shooter.h
+++ b/y2014/control_loops/shooter/shooter.h
@@ -122,10 +122,10 @@
const Time kPrepareFireEndTime = Time::InMS(40);
class ShooterMotor
- : public aos::controls::ControlLoop<::frc971::control_loops::ShooterQueue> {
+ : public aos::controls::ControlLoop<::y2014::control_loops::ShooterQueue> {
public:
- explicit ShooterMotor(::frc971::control_loops::ShooterQueue *my_shooter =
- &::frc971::control_loops::shooter_queue);
+ explicit ShooterMotor(::y2014::control_loops::ShooterQueue *my_shooter =
+ &::y2014::control_loops::shooter_queue);
// True if the goal was moved to avoid goal windup.
bool capped_goal() const { return shooter_.capped_goal(); }
@@ -133,7 +133,7 @@
double PowerToPosition(double power);
double PositionToPower(double position);
void CheckCalibrations(
- const ::frc971::control_loops::ShooterQueue::Position *position);
+ const ::y2014::control_loops::ShooterQueue::Position *position);
typedef enum {
STATE_INITIALIZE = 0,
@@ -154,10 +154,10 @@
protected:
virtual void RunIteration(
- const ::frc971::control_loops::ShooterQueue::Goal *goal,
- const ::frc971::control_loops::ShooterQueue::Position *position,
- ::frc971::control_loops::ShooterQueue::Output *output,
- ::frc971::control_loops::ShooterQueue::Status *status);
+ const ::y2014::control_loops::ShooterQueue::Goal *goal,
+ const ::y2014::control_loops::ShooterQueue::Position *position,
+ ::y2014::control_loops::ShooterQueue::Output *output,
+ ::y2014::control_loops::ShooterQueue::Status *status);
private:
// We have to override this to keep the pistons in the correct positions.
@@ -179,7 +179,7 @@
load_timeout_ = Time::Now() + kLoadTimeout;
}
- ::frc971::control_loops::ShooterQueue::Position last_position_;
+ ::y2014::control_loops::ShooterQueue::Position last_position_;
ZeroedStateFeedbackLoop shooter_;
diff --git a/y2014/control_loops/shooter/shooter.q b/y2014/control_loops/shooter/shooter.q
index eaaaa2e..ab8f590 100644
--- a/y2014/control_loops/shooter/shooter.q
+++ b/y2014/control_loops/shooter/shooter.q
@@ -1,4 +1,4 @@
-package frc971.control_loops;
+package y2014.control_loops;
import "aos/common/controls/control_loops.q";
import "frc971/control_loops/control_loops.q";
@@ -31,9 +31,9 @@
// plunger is all the way back and latched.
bool plunger;
// Gets triggered when the pusher is all the way back.
- PosedgeOnlyCountedHallEffectStruct pusher_distal;
+ .frc971.PosedgeOnlyCountedHallEffectStruct pusher_distal;
// Triggers just before pusher_distal.
- PosedgeOnlyCountedHallEffectStruct pusher_proximal;
+ .frc971.PosedgeOnlyCountedHallEffectStruct pusher_proximal;
// Triggers when the latch engages.
bool latch;
};
diff --git a/y2014/control_loops/shooter/shooter_lib_test.cc b/y2014/control_loops/shooter/shooter_lib_test.cc
index e22ee7a..ce279bb 100644
--- a/y2014/control_loops/shooter/shooter_lib_test.cc
+++ b/y2014/control_loops/shooter/shooter_lib_test.cc
@@ -86,7 +86,7 @@
// Sets the values of the physical sensors that can be directly observed
// (encoder, hall effect).
void SetPhysicalSensors(
- ::frc971::control_loops::ShooterQueue::Position *position) {
+ ::y2014::control_loops::ShooterQueue::Position *position) {
const constants::Values &values = constants::GetValues();
position->position = GetPosition();
@@ -119,7 +119,7 @@
::frc971::PosedgeOnlyCountedHallEffectStruct *sensor,
const ::frc971::PosedgeOnlyCountedHallEffectStruct &last_sensor,
const constants::Values::AnglePair &limits,
- const ::frc971::control_loops::ShooterQueue::Position &last_position) {
+ const ::y2014::control_loops::ShooterQueue::Position &last_position) {
sensor->posedge_count = last_sensor.posedge_count;
sensor->negedge_count = last_sensor.negedge_count;
@@ -154,7 +154,7 @@
void SendPositionMessage(bool use_passed, bool plunger_in,
bool latch_in, bool brake_in) {
const constants::Values &values = constants::GetValues();
- ::aos::ScopedMessagePtr<::frc971::control_loops::ShooterQueue::Position>
+ ::aos::ScopedMessagePtr<::y2014::control_loops::ShooterQueue::Position>
position = shooter_queue_.position.MakeMessage();
if (use_passed) {
@@ -283,11 +283,11 @@
int brake_delay_count_;
private:
- ::frc971::control_loops::ShooterQueue shooter_queue_;
+ ::y2014::control_loops::ShooterQueue shooter_queue_;
double initial_position_;
double last_voltage_;
- ::frc971::control_loops::ShooterQueue::Position last_position_message_;
+ ::y2014::control_loops::ShooterQueue::Position last_position_message_;
double last_plant_position_;
};
@@ -297,7 +297,7 @@
// 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.
- ::frc971::control_loops::ShooterQueue shooter_queue_;
+ ::y2014::control_loops::ShooterQueue shooter_queue_;
// Create a loop and simulation plant.
ShooterMotor shooter_motor_;
diff --git a/y2014/hot_goal_reader.cc b/y2014/hot_goal_reader.cc
index ffdb3a3..7bf9fa2 100644
--- a/y2014/hot_goal_reader.cc
+++ b/y2014/hot_goal_reader.cc
@@ -17,11 +17,11 @@
::aos::InitNRT();
uint64_t left_count, right_count;
- ::frc971::hot_goal.FetchLatest();
- if (::frc971::hot_goal.get()) {
- LOG_STRUCT(DEBUG, "starting with", *::frc971::hot_goal);
- left_count = ::frc971::hot_goal->left_count;
- right_count = ::frc971::hot_goal->left_count;
+ ::y2014::hot_goal.FetchLatest();
+ if (::y2014::hot_goal.get()) {
+ LOG_STRUCT(DEBUG, "starting with", *::y2014::hot_goal);
+ left_count = ::y2014::hot_goal->left_count;
+ right_count = ::y2014::hot_goal->left_count;
} else {
LOG(DEBUG, "no starting message\n");
left_count = right_count = 0;
@@ -85,7 +85,7 @@
}
if (data & 0x01) ++right_count;
if (data & 0x02) ++left_count;
- auto message = ::frc971::hot_goal.MakeMessage();
+ auto message = ::y2014::hot_goal.MakeMessage();
message->left_count = left_count;
message->right_count = right_count;
LOG_STRUCT(DEBUG, "sending", *message);
diff --git a/y2014/joystick_reader.cc b/y2014/joystick_reader.cc
index 058afb1..a0f2320 100644
--- a/y2014/joystick_reader.cc
+++ b/y2014/joystick_reader.cc
@@ -19,7 +19,7 @@
#include "y2014/control_loops/shooter/shooter.q.h"
#include "y2014/actors/shoot_actor.h"
-using ::frc971::control_loops::drivetrain_queue;
+using ::y2014::control_loops::drivetrain_queue;
using ::frc971::sensors::gyro_reading;
using ::aos::input::driver_station::ButtonLocation;
@@ -28,7 +28,7 @@
#define OLD_DS 0
-namespace frc971 {
+namespace y2014 {
namespace input {
namespace joysticks {
@@ -482,7 +482,7 @@
}
double SpeedToAngleOffset(double speed) {
- const frc971::constants::Values &values = frc971::constants::GetValues();
+ const ::y2014::constants::Values &values = ::y2014::constants::GetValues();
// scale speed to a [0.0-1.0] on something close to the max
// TODO(austin): Change the scale factor for different shots.
return (speed / values.drivetrain_max_speed) * velocity_compensation_;
@@ -509,7 +509,7 @@
bool moving_for_shot_ = false;
bool auto_running_ = false;
-
+
::aos::common::actions::ActionQueue action_queue_;
::aos::util::SimpleLogInterval no_drivetrain_status_ =
@@ -519,11 +519,11 @@
} // namespace joysticks
} // namespace input
-} // namespace frc971
+} // namespace y2014
int main() {
::aos::Init();
- ::frc971::input::joysticks::Reader reader;
+ ::y2014::input::joysticks::Reader reader;
reader.Run();
::aos::Cleanup();
}
diff --git a/y2014/queues/auto_mode.q b/y2014/queues/auto_mode.q
index 7922dbf..49c6192 100644
--- a/y2014/queues/auto_mode.q
+++ b/y2014/queues/auto_mode.q
@@ -1,4 +1,4 @@
-package frc971.sensors;
+package y2014.sensors;
message AutoMode {
double voltage;
diff --git a/y2014/queues/hot_goal.q b/y2014/queues/hot_goal.q
index 3444553..d936968 100644
--- a/y2014/queues/hot_goal.q
+++ b/y2014/queues/hot_goal.q
@@ -1,4 +1,4 @@
-package frc971;
+package y2014;
message HotGoal {
uint64_t left_count;
diff --git a/y2014/queues/profile_params.q b/y2014/queues/profile_params.q
index e7ffe9a..206ceff 100644
--- a/y2014/queues/profile_params.q
+++ b/y2014/queues/profile_params.q
@@ -1,4 +1,4 @@
-package frc971;
+package y2014;
struct ProfileParams {
double velocity;
diff --git a/y2014/wpilib/wpilib_interface.cc b/y2014/wpilib/wpilib_interface.cc
index 9d6b8b3..855905c 100644
--- a/y2014/wpilib/wpilib_interface.cc
+++ b/y2014/wpilib/wpilib_interface.cc
@@ -54,11 +54,11 @@
#define M_PI 3.14159265358979323846
#endif
-using ::frc971::control_loops::drivetrain_queue;
-using ::frc971::control_loops::claw_queue;
-using ::frc971::control_loops::shooter_queue;
+using ::y2014::control_loops::drivetrain_queue;
+using ::y2014::control_loops::claw_queue;
+using ::y2014::control_loops::shooter_queue;
-namespace frc971 {
+namespace y2014 {
namespace wpilib {
// TODO(Brian): Fix the interpretation of the result of GetRaw here and in the
@@ -211,24 +211,26 @@
hall_filter_.Add(hall.get());
shooter_plunger_ = ::std::move(hall);
shooter_plunger_reader_ =
- make_unique<DMADigitalReader>(shooter_plunger_.get());
+ make_unique<::frc971::wpilib::DMADigitalReader>(shooter_plunger_.get());
}
void set_shooter_latch(::std::unique_ptr<DigitalInput> hall) {
hall_filter_.Add(hall.get());
shooter_latch_ = ::std::move(hall);
- shooter_latch_reader_ = make_unique<DMADigitalReader>(shooter_latch_.get());
+ shooter_latch_reader_ =
+ make_unique<::frc971::wpilib::DMADigitalReader>(shooter_latch_.get());
}
// All of the DMA-related set_* calls must be made before this, and it doesn't
// hurt to do all of them.
void set_dma(::std::unique_ptr<DMA> dma) {
- shooter_proximal_counter_ = make_unique<DMAEdgeCounter>(
+ shooter_proximal_counter_ = make_unique<::frc971::wpilib::DMAEdgeCounter>(
shooter_encoder_.get(), shooter_proximal_.get());
- shooter_distal_counter_ = make_unique<DMAEdgeCounter>(
+ shooter_distal_counter_ = make_unique<::frc971::wpilib::DMAEdgeCounter>(
shooter_encoder_.get(), shooter_distal_.get());
- dma_synchronizer_.reset(new DMASynchronizer(::std::move(dma)));
+ dma_synchronizer_.reset(
+ new ::frc971::wpilib::DMASynchronizer(::std::move(dma)));
dma_synchronizer_->Add(shooter_proximal_counter_.get());
dma_synchronizer_->Add(shooter_distal_counter_.get());
dma_synchronizer_->Add(shooter_plunger_reader_.get());
@@ -291,7 +293,7 @@
drivetrain_message.Send();
}
- ::frc971::sensors::auto_mode.MakeWithBuilder()
+ ::y2014::sensors::auto_mode.MakeWithBuilder()
.voltage(auto_selector_analog_->GetVoltage())
.Send();
@@ -344,17 +346,18 @@
}
void Start() {
- front_counter_ =
- make_unique<EdgeCounter>(encoder_.get(), front_hall_.get());
+ front_counter_ = make_unique<::frc971::wpilib::EdgeCounter>(
+ encoder_.get(), front_hall_.get());
synchronizer_.Add(front_counter_.get());
- calibration_counter_ =
- make_unique<EdgeCounter>(encoder_.get(), calibration_hall_.get());
+ calibration_counter_ = make_unique<::frc971::wpilib::EdgeCounter>(
+ encoder_.get(), calibration_hall_.get());
synchronizer_.Add(calibration_counter_.get());
- back_counter_ =
- make_unique<EdgeCounter>(encoder_.get(), back_hall_.get());
+ back_counter_ = make_unique<::frc971::wpilib::EdgeCounter>(
+ encoder_.get(), back_hall_.get());
synchronizer_.Add(back_counter_.get());
synchronized_encoder_ =
- make_unique<InterruptSynchronizedEncoder>(encoder_.get());
+ make_unique<::frc971::wpilib::InterruptSynchronizedEncoder>(
+ encoder_.get());
synchronizer_.Add(synchronized_encoder_.get());
synchronizer_.Start();
@@ -376,7 +379,8 @@
}
private:
- void CopyPosition(const EdgeCounter *counter, HallEffectStruct *out) {
+ void CopyPosition(const ::frc971::wpilib::EdgeCounter *counter,
+ ::frc971::HallEffectStruct *out) {
const double multiplier = reversed_ ? -1.0 : 1.0;
out->current = !counter->polled_value();
@@ -388,12 +392,13 @@
multiplier * claw_translate(counter->last_negative_encoder_value());
}
- InterruptSynchronizer synchronizer_{kInterruptPriority};
+ ::frc971::wpilib::InterruptSynchronizer synchronizer_{kInterruptPriority};
- ::std::unique_ptr<EdgeCounter> front_counter_;
- ::std::unique_ptr<EdgeCounter> calibration_counter_;
- ::std::unique_ptr<EdgeCounter> back_counter_;
- ::std::unique_ptr<InterruptSynchronizedEncoder> synchronized_encoder_;
+ ::std::unique_ptr<::frc971::wpilib::EdgeCounter> front_counter_;
+ ::std::unique_ptr<::frc971::wpilib::EdgeCounter> calibration_counter_;
+ ::std::unique_ptr<::frc971::wpilib::EdgeCounter> back_counter_;
+ ::std::unique_ptr<::frc971::wpilib::InterruptSynchronizedEncoder>
+ synchronized_encoder_;
::std::unique_ptr<Encoder> encoder_;
::std::unique_ptr<DigitalInput> front_hall_;
@@ -406,8 +411,9 @@
static const int kPriority = 30;
static const int kInterruptPriority = 55;
- void CopyShooterPosedgeCounts(const DMAEdgeCounter *counter,
- PosedgeOnlyCountedHallEffectStruct *output) {
+ void CopyShooterPosedgeCounts(
+ const ::frc971::wpilib::DMAEdgeCounter *counter,
+ ::frc971::PosedgeOnlyCountedHallEffectStruct *output) {
output->current = !counter->polled_value();
// These are inverted because the hall effects give logical false when
// there's a magnet in front of them.
@@ -421,7 +427,7 @@
DriverStation *ds_;
::std::unique_ptr<PowerDistributionPanel> pdp_;
- ::std::unique_ptr<DMASynchronizer> dma_synchronizer_;
+ ::std::unique_ptr<::frc971::wpilib::DMASynchronizer> dma_synchronizer_;
::std::unique_ptr<AnalogInput> auto_selector_analog_;
@@ -437,9 +443,9 @@
::std::unique_ptr<Encoder> shooter_encoder_;
::std::unique_ptr<DigitalInput> shooter_proximal_, shooter_distal_;
::std::unique_ptr<DigitalInput> shooter_plunger_, shooter_latch_;
- ::std::unique_ptr<DMAEdgeCounter> shooter_proximal_counter_,
+ ::std::unique_ptr<::frc971::wpilib::DMAEdgeCounter> shooter_proximal_counter_,
shooter_distal_counter_;
- ::std::unique_ptr<DMADigitalReader> shooter_plunger_reader_,
+ ::std::unique_ptr<::frc971::wpilib::DMADigitalReader> shooter_plunger_reader_,
shooter_latch_reader_;
::std::atomic<bool> run_{true};
@@ -448,7 +454,7 @@
class SolenoidWriter {
public:
- SolenoidWriter(const ::std::unique_ptr<BufferedPcm> &pcm)
+ SolenoidWriter(const ::std::unique_ptr<::frc971::wpilib::BufferedPcm> &pcm)
: pcm_(pcm),
shooter_(".frc971.control_loops.shooter_queue.output"),
drivetrain_(".frc971.control_loops.drivetrain_queue.output") {}
@@ -461,19 +467,23 @@
compressor_relay_ = ::std::move(compressor_relay);
}
- void set_drivetrain_left(::std::unique_ptr<BufferedSolenoid> s) {
+ void set_drivetrain_left(
+ ::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> s) {
drivetrain_left_ = ::std::move(s);
}
- void set_drivetrain_right(::std::unique_ptr<BufferedSolenoid> s) {
+ void set_drivetrain_right(
+ ::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> s) {
drivetrain_right_ = ::std::move(s);
}
- void set_shooter_latch(::std::unique_ptr<BufferedSolenoid> s) {
+ void set_shooter_latch(
+ ::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> s) {
shooter_latch_ = ::std::move(s);
}
- void set_shooter_brake(::std::unique_ptr<BufferedSolenoid> s) {
+ void set_shooter_brake(
+ ::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> s) {
shooter_brake_ = ::std::move(s);
}
@@ -503,7 +513,7 @@
}
{
- PneumaticsToLog to_log;
+ ::frc971::wpilib::PneumaticsToLog to_log;
{
const bool compressor_on = !pressure_switch_->Get();
to_log.compressor_on = compressor_on;
@@ -524,23 +534,23 @@
void Quit() { run_ = false; }
private:
- const ::std::unique_ptr<BufferedPcm> &pcm_;
+ const ::std::unique_ptr<::frc971::wpilib::BufferedPcm> &pcm_;
- ::std::unique_ptr<BufferedSolenoid> drivetrain_left_;
- ::std::unique_ptr<BufferedSolenoid> drivetrain_right_;
- ::std::unique_ptr<BufferedSolenoid> shooter_latch_;
- ::std::unique_ptr<BufferedSolenoid> shooter_brake_;
+ ::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> drivetrain_left_;
+ ::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> drivetrain_right_;
+ ::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> shooter_latch_;
+ ::std::unique_ptr<::frc971::wpilib::BufferedSolenoid> shooter_brake_;
::std::unique_ptr<DigitalInput> pressure_switch_;
::std::unique_ptr<Relay> compressor_relay_;
- ::aos::Queue<::frc971::control_loops::ShooterQueue::Output> shooter_;
- ::aos::Queue<::frc971::control_loops::DrivetrainQueue::Output> drivetrain_;
+ ::aos::Queue<::y2014::control_loops::ShooterQueue::Output> shooter_;
+ ::aos::Queue<::y2014::control_loops::DrivetrainQueue::Output> drivetrain_;
::std::atomic<bool> run_{true};
};
-class DrivetrainWriter : public LoopOutputHandler {
+class DrivetrainWriter : public ::frc971::wpilib::LoopOutputHandler {
public:
void set_left_drivetrain_talon(::std::unique_ptr<Talon> t) {
left_drivetrain_talon_ = ::std::move(t);
@@ -552,11 +562,11 @@
private:
virtual void Read() override {
- ::frc971::control_loops::drivetrain_queue.output.FetchAnother();
+ ::y2014::control_loops::drivetrain_queue.output.FetchAnother();
}
virtual void Write() override {
- auto &queue = ::frc971::control_loops::drivetrain_queue.output;
+ auto &queue = ::y2014::control_loops::drivetrain_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
left_drivetrain_talon_->Set(-queue->left_voltage / 12.0);
right_drivetrain_talon_->Set(queue->right_voltage / 12.0);
@@ -572,7 +582,7 @@
::std::unique_ptr<Talon> right_drivetrain_talon_;
};
-class ShooterWriter : public LoopOutputHandler {
+class ShooterWriter : public ::frc971::wpilib::LoopOutputHandler {
public:
void set_shooter_talon(::std::unique_ptr<Talon> t) {
shooter_talon_ = ::std::move(t);
@@ -580,11 +590,11 @@
private:
virtual void Read() override {
- ::frc971::control_loops::shooter_queue.output.FetchAnother();
+ ::y2014::control_loops::shooter_queue.output.FetchAnother();
}
virtual void Write() override {
- auto &queue = ::frc971::control_loops::shooter_queue.output;
+ auto &queue = ::y2014::control_loops::shooter_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
shooter_talon_->Set(queue->voltage / 12.0);
}
@@ -597,7 +607,7 @@
::std::unique_ptr<Talon> shooter_talon_;
};
-class ClawWriter : public LoopOutputHandler {
+class ClawWriter : public ::frc971::wpilib::LoopOutputHandler {
public:
void set_top_claw_talon(::std::unique_ptr<Talon> t) {
top_claw_talon_ = ::std::move(t);
@@ -625,11 +635,11 @@
private:
virtual void Read() override {
- ::frc971::control_loops::claw_queue.output.FetchAnother();
+ ::y2014::control_loops::claw_queue.output.FetchAnother();
}
virtual void Write() override {
- auto &queue = ::frc971::control_loops::claw_queue.output;
+ auto &queue = ::y2014::control_loops::claw_queue.output;
LOG_STRUCT(DEBUG, "will output", *queue);
intake1_talon_->Set(queue->intake_voltage / 12.0);
intake2_talon_->Set(queue->intake_voltage / 12.0);
@@ -668,7 +678,7 @@
::aos::InitNRT();
::aos::SetCurrentThreadName("StartCompetition");
- JoystickSender joystick_sender;
+ ::frc971::wpilib::JoystickSender joystick_sender;
::std::thread joystick_thread(::std::ref(joystick_sender));
SensorReader reader;
@@ -706,7 +716,7 @@
reader.set_dma(make_unique<DMA>());
::std::thread reader_thread(::std::ref(reader));
- GyroSender gyro_sender;
+ ::frc971::wpilib::GyroSender gyro_sender;
::std::thread gyro_thread(::std::ref(gyro_sender));
DrivetrainWriter drivetrain_writer;
@@ -716,7 +726,7 @@
::std::unique_ptr<Talon>(new Talon(2)));
::std::thread drivetrain_writer_thread(::std::ref(drivetrain_writer));
- ::frc971::wpilib::ClawWriter claw_writer;
+ ::y2014::wpilib::ClawWriter claw_writer;
claw_writer.set_top_claw_talon(::std::unique_ptr<Talon>(new Talon(1)));
claw_writer.set_bottom_claw_talon(::std::unique_ptr<Talon>(new Talon(0)));
claw_writer.set_left_tusk_talon(::std::unique_ptr<Talon>(new Talon(4)));
@@ -725,7 +735,7 @@
claw_writer.set_intake2_talon(::std::unique_ptr<Talon>(new Talon(8)));
::std::thread claw_writer_thread(::std::ref(claw_writer));
- ::frc971::wpilib::ShooterWriter shooter_writer;
+ ::y2014::wpilib::ShooterWriter shooter_writer;
shooter_writer.set_shooter_talon(::std::unique_ptr<Talon>(new Talon(6)));
::std::thread shooter_writer_thread(::std::ref(shooter_writer));
@@ -767,7 +777,7 @@
};
} // namespace wpilib
-} // namespace frc971
+} // namespace y2014
-START_ROBOT_CLASS(::frc971::wpilib::WPILibRobot);
+START_ROBOT_CLASS(::y2014::wpilib::WPILibRobot);