Moved 2014 code into y2014 namespace.
Change-Id: Ibece165daa9e267ea1c3c7b822b0ba3eeb9830bb
diff --git a/y2014/control_loops/claw/claw.cc b/y2014/control_loops/claw/claw.cc
index 5c1b843..040cef3 100644
--- a/y2014/control_loops/claw/claw.cc
+++ b/y2014/control_loops/claw/claw.cc
@@ -44,10 +44,13 @@
// If a claw runs up against a movable limit, move both claws outwards to get
// out of the condition.
-namespace frc971 {
+namespace y2014 {
namespace control_loops {
+using ::frc971::HallEffectTracker;
using ::y2014::control_loops::claw::kDt;
+using ::frc971::control_loops::DoCoerceGoal;
+using ::frc971::control_loops::ClawPositionToLog;
static const double kZeroingVoltage = 4.0;
static const double kMaxVoltage = 12.0;
@@ -216,7 +219,8 @@
encoder_(0.0),
last_encoder_(0.0) {}
-void ZeroedStateFeedbackLoop::SetPositionValues(const HalfClawPosition &claw) {
+void ZeroedStateFeedbackLoop::SetPositionValues(
+ const ::frc971::control_loops::HalfClawPosition &claw) {
front_.Update(claw.front);
calibration_.Update(claw.calibration);
back_.Update(claw.back);
@@ -290,7 +294,8 @@
any_triggered_last_ = any_sensor_triggered;
}
-void ZeroedStateFeedbackLoop::Reset(const HalfClawPosition &claw) {
+void ZeroedStateFeedbackLoop::Reset(
+ const ::frc971::control_loops::HalfClawPosition &claw) {
set_zeroing_state(ZeroedStateFeedbackLoop::UNKNOWN_POSITION);
front_.Reset(claw.front);
@@ -366,8 +371,8 @@
return false;
}
-ClawMotor::ClawMotor(control_loops::ClawQueue *my_claw)
- : aos::controls::ControlLoop<control_loops::ClawQueue>(my_claw),
+ClawMotor::ClawMotor(::frc971::control_loops::ClawQueue *my_claw)
+ : aos::controls::ControlLoop<::frc971::control_loops::ClawQueue>(my_claw),
has_top_claw_goal_(false),
top_claw_goal_(0.0),
top_claw_(this),
@@ -547,7 +552,7 @@
}
void LimitClawGoal(double *bottom_goal, double *top_goal,
- const frc971::constants::Values &values) {
+ const constants::Values &values) {
// first update position based on angle limit
const double separation = *top_goal - *bottom_goal;
if (separation > values.claw.soft_max_separation) {
@@ -611,10 +616,11 @@
bool ClawMotor::is_zeroing() const { return !is_ready(); }
// Positive angle is up, and positive power is up.
-void ClawMotor::RunIteration(const control_loops::ClawQueue::Goal *goal,
- const control_loops::ClawQueue::Position *position,
- control_loops::ClawQueue::Output *output,
- control_loops::ClawQueue::Status *status) {
+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) {
// Disable the motors now so that all early returns will return with the
// motors disabled.
if (output) {
@@ -637,7 +643,7 @@
bottom_claw_.Reset(position->bottom);
}
- const frc971::constants::Values &values = constants::GetValues();
+ const constants::Values &values = constants::GetValues();
if (position) {
Eigen::Matrix<double, 2, 1> Y;
@@ -1020,5 +1026,4 @@
}
} // namespace control_loops
-} // namespace frc971
-
+} // namespace y2014
diff --git a/y2014/control_loops/claw/claw.h b/y2014/control_loops/claw/claw.h
index cdd3948..86875bb 100644
--- a/y2014/control_loops/claw/claw.h
+++ b/y2014/control_loops/claw/claw.h
@@ -12,7 +12,7 @@
#include "y2014/control_loops/claw/claw_motor_plant.h"
#include "frc971/control_loops/hall_effect_tracker.h"
-namespace frc971 {
+namespace y2014 {
namespace control_loops {
namespace testing {
class WindupClawTest;
@@ -77,15 +77,15 @@
}
JointZeroingState zeroing_state() const { return zeroing_state_; }
- void SetPositionValues(const HalfClawPosition &claw);
+ void SetPositionValues(const ::frc971::control_loops::HalfClawPosition &claw);
- void Reset(const HalfClawPosition &claw);
+ void Reset(const ::frc971::control_loops::HalfClawPosition &claw);
double absolute_position() const { return encoder() + offset(); }
- const HallEffectTracker &front() const { return front_; }
- const HallEffectTracker &calibration() const { return calibration_; }
- const HallEffectTracker &back() const { return back_; }
+ const ::frc971::HallEffectTracker &front() const { return front_; }
+ const ::frc971::HallEffectTracker &calibration() const { return calibration_; }
+ const ::frc971::HallEffectTracker &back() const { return back_; }
bool any_hall_effect_changed() const {
return front().either_count_changed() ||
@@ -109,13 +109,13 @@
bool GetPositionOfEdge(const constants::Values::Claws::Claw &claw,
double *edge_encoder, double *edge_angle);
- bool SawFilteredPosedge(const HallEffectTracker &this_sensor,
- const HallEffectTracker &sensorA,
- const HallEffectTracker &sensorB);
+ bool SawFilteredPosedge(const ::frc971::HallEffectTracker &this_sensor,
+ const ::frc971::HallEffectTracker &sensorA,
+ const ::frc971::HallEffectTracker &sensorB);
- bool SawFilteredNegedge(const HallEffectTracker &this_sensor,
- const HallEffectTracker &sensorA,
- const HallEffectTracker &sensorB);
+ bool SawFilteredNegedge(const ::frc971::HallEffectTracker &this_sensor,
+ const ::frc971::HallEffectTracker &sensorA,
+ const ::frc971::HallEffectTracker &sensorB);
#undef COUNT_SETTER_GETTER
@@ -126,7 +126,7 @@
ClawMotor *motor_;
- HallEffectTracker front_, calibration_, back_;
+ ::frc971::HallEffectTracker front_, calibration_, back_;
JointZeroingState zeroing_state_;
double min_hall_effect_on_angle_;
@@ -139,16 +139,16 @@
double last_off_encoder_;
bool any_triggered_last_;
- const HallEffectTracker* posedge_filter_ = nullptr;
- const HallEffectTracker* negedge_filter_ = nullptr;
+ const ::frc971::HallEffectTracker* posedge_filter_ = nullptr;
+ const ::frc971::HallEffectTracker* negedge_filter_ = nullptr;
private:
// Does the edges of 1 sensor for GetPositionOfEdge.
bool DoGetPositionOfEdge(const constants::Values::Claws::AnglePair &angles,
double *edge_encoder, double *edge_angle,
- const HallEffectTracker &sensor,
- const HallEffectTracker &sensorA,
- const HallEffectTracker &sensorB,
+ const ::frc971::HallEffectTracker &sensor,
+ const ::frc971::HallEffectTracker &sensorA,
+ const ::frc971::HallEffectTracker &sensorB,
const char *hall_effect_name);
};
@@ -182,10 +182,11 @@
const constants::Values::Claws::Claw &claw_values);
};
-class ClawMotor : public aos::controls::ControlLoop<control_loops::ClawQueue> {
+class ClawMotor
+ : public aos::controls::ControlLoop<::frc971::control_loops::ClawQueue> {
public:
- explicit ClawMotor(control_loops::ClawQueue *my_claw =
- &control_loops::claw_queue);
+ explicit ClawMotor(::frc971::control_loops::ClawQueue *my_claw =
+ &::frc971::control_loops::claw_queue);
// True if the state machine is ready.
bool capped_goal() const { return capped_goal_; }
@@ -215,10 +216,11 @@
CalibrationMode mode() const { return mode_; }
protected:
- virtual void RunIteration(const control_loops::ClawQueue::Goal *goal,
- const control_loops::ClawQueue::Position *position,
- control_loops::ClawQueue::Output *output,
- control_loops::ClawQueue::Status *status);
+ 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);
double top_absolute_position() const {
return claw_.X_hat(1, 0) + claw_.X_hat(0, 0);
@@ -257,9 +259,9 @@
// Modifies the bottom and top goal such that they are within the limits and
// their separation isn't too much or little.
void LimitClawGoal(double *bottom_goal, double *top_goal,
- const frc971::constants::Values &values);
+ const constants::Values &values);
} // namespace control_loops
-} // namespace frc971
+} // namespace y2014
#endif // Y2014_CONTROL_LOOPS_CLAW_CLAW_H_
diff --git a/y2014/control_loops/claw/claw_calibration.cc b/y2014/control_loops/claw/claw_calibration.cc
index 772a940..01d57a4 100644
--- a/y2014/control_loops/claw/claw_calibration.cc
+++ b/y2014/control_loops/claw/claw_calibration.cc
@@ -4,9 +4,10 @@
#include "aos/linux_code/init.h"
#include "y2014/constants.h"
-namespace frc971 {
+namespace y2014 {
typedef constants::Values::Claws Claws;
+using ::frc971::HallEffectStruct;
class Sensor {
public:
@@ -23,7 +24,7 @@
}
bool DoGetPositionOfEdge(
- const control_loops::HalfClawPosition &claw_position,
+ const ::frc971::control_loops::HalfClawPosition &claw_position,
const HallEffectStruct &hall_effect, Claws::AnglePair *limits) {
bool print = false;
@@ -109,16 +110,17 @@
class ClawSensors {
public:
- ClawSensors(const double start_position,
- const control_loops::HalfClawPosition &initial_claw_position)
+ ClawSensors(
+ const double start_position,
+ const ::frc971::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 control_loops::HalfClawPosition &claw_position,
- Claws::Claw *claw) {
-
+ bool GetPositionOfEdge(
+ const ::frc971::control_loops::HalfClawPosition &claw_position,
+ Claws::Claw *claw) {
bool print = false;
if (front_.DoGetPositionOfEdge(claw_position,
claw_position.front, &claw->front)) {
@@ -153,17 +155,17 @@
};
int Main() {
- control_loops::claw_queue.position.FetchNextBlocking();
+ ::frc971::control_loops::claw_queue.position.FetchNextBlocking();
const double top_start_position =
- control_loops::claw_queue.position->top.position;
+ ::frc971::control_loops::claw_queue.position->top.position;
const double bottom_start_position =
- control_loops::claw_queue.position->bottom.position;
+ ::frc971::control_loops::claw_queue.position->bottom.position;
ClawSensors top(top_start_position,
- control_loops::claw_queue.position->top);
+ ::frc971::control_loops::claw_queue.position->top);
ClawSensors bottom(bottom_start_position,
- control_loops::claw_queue.position->bottom);
+ ::frc971::control_loops::claw_queue.position->bottom);
Claws limits;
@@ -217,28 +219,28 @@
limits.start_fine_tune_pos = -0.2;
limits.max_zeroing_voltage = 4.0;
- control_loops::ClawQueue::Position last_position =
- *control_loops::claw_queue.position;
+ ::frc971::control_loops::ClawQueue::Position last_position =
+ *::frc971::control_loops::claw_queue.position;
while (true) {
- control_loops::claw_queue.position.FetchNextBlocking();
+ ::frc971::control_loops::claw_queue.position.FetchNextBlocking();
bool print = false;
- if (top.GetPositionOfEdge(control_loops::claw_queue.position->top,
+ if (top.GetPositionOfEdge(::frc971::control_loops::claw_queue.position->top,
&limits.upper_claw)) {
print = true;
printf("Got an edge on the upper claw\n");
}
if (bottom.GetPositionOfEdge(
- control_loops::claw_queue.position->bottom,
+ ::frc971::control_loops::claw_queue.position->bottom,
&limits.lower_claw)) {
print = true;
printf("Got an edge on the lower claw\n");
}
const double top_position =
- control_loops::claw_queue.position->top.position -
+ ::frc971::control_loops::claw_queue.position->top.position -
top_start_position;
const double bottom_position =
- control_loops::claw_queue.position->bottom.position -
+ ::frc971::control_loops::claw_queue.position->bottom.position -
bottom_start_position;
const double separation = top_position - bottom_position;
if (separation > limits.claw_max_separation) {
@@ -300,16 +302,16 @@
printf("}\n");
}
- last_position = *control_loops::claw_queue.position;
+ last_position = *::frc971::control_loops::claw_queue.position;
}
return 0;
}
-} // namespace frc971
+} // namespace y2014
int main() {
::aos::Init();
- int returnvalue = ::frc971::Main();
+ int returnvalue = ::y2014::Main();
::aos::Cleanup();
return returnvalue;
}
diff --git a/y2014/control_loops/claw/claw_lib_test.cc b/y2014/control_loops/claw/claw_lib_test.cc
index acec791..85cb679 100644
--- a/y2014/control_loops/claw/claw_lib_test.cc
+++ b/y2014/control_loops/claw/claw_lib_test.cc
@@ -13,11 +13,13 @@
#include "gtest/gtest.h"
-namespace frc971 {
+namespace y2014 {
namespace control_loops {
namespace testing {
using ::y2014::control_loops::claw::MakeClawPlant;
+using ::frc971::HallEffectStruct;
+using ::frc971::control_loops::HalfClawPosition;
typedef enum {
TOP_CLAW = 0,
@@ -100,7 +102,7 @@
void SetClawHallEffects(double pos,
const constants::Values::Claws::Claw &claw,
- control_loops::HalfClawPosition *half_claw) {
+ HalfClawPosition *half_claw) {
SetHallEffect(pos, claw.front, &half_claw->front);
SetHallEffect(pos, claw.calibration, &half_claw->calibration);
SetHallEffect(pos, claw.back, &half_claw->back);
@@ -108,7 +110,8 @@
// Sets the values of the physical sensors that can be directly observed
// (encoder, hall effect).
- void SetPhysicalSensors(control_loops::ClawQueue::Position *position) {
+ void SetPhysicalSensors(
+ ::frc971::control_loops::ClawQueue::Position *position) {
position->top.position = GetPosition(TOP_CLAW);
position->bottom.position = GetPosition(BOTTOM_CLAW);
@@ -117,7 +120,7 @@
LOG(DEBUG, "Physical claws are at {top: %f, bottom: %f}\n", pos[TOP_CLAW],
pos[BOTTOM_CLAW]);
- const frc971::constants::Values& values = constants::GetValues();
+ const constants::Values& values = constants::GetValues();
// Signal that each hall effect sensor has been triggered if it is within
// the correct range.
@@ -162,8 +165,8 @@
}
void UpdateClawHallEffects(
- control_loops::HalfClawPosition *position,
- const control_loops::HalfClawPosition &last_position,
+ HalfClawPosition *position,
+ const HalfClawPosition &last_position,
const constants::Values::Claws::Claw &claw, double initial_position,
const char *claw_name) {
UpdateHallEffect(position->position + initial_position,
@@ -183,15 +186,15 @@
// Sends out the position queue messages.
void SendPositionMessage() {
- ::aos::ScopedMessagePtr<control_loops::ClawQueue::Position> position =
- claw_queue.position.MakeMessage();
+ ::aos::ScopedMessagePtr<::frc971::control_loops::ClawQueue::Position>
+ position = claw_queue.position.MakeMessage();
// Initialize all the counters to their previous values.
*position = last_position_;
SetPhysicalSensors(position.get());
- const frc971::constants::Values& values = constants::GetValues();
+ const constants::Values& values = constants::GetValues();
UpdateClawHallEffects(&position->top, last_position_.top,
values.claw.upper_claw, initial_position_[TOP_CLAW],
@@ -208,7 +211,7 @@
// Simulates the claw moving for one timestep.
void Simulate() {
- const frc971::constants::Values& v = constants::GetValues();
+ const constants::Values& v = constants::GetValues();
EXPECT_TRUE(claw_queue.output.FetchLatest());
claw_plant_->mutable_U() << claw_queue.output->bottom_claw_voltage,
@@ -236,10 +239,10 @@
initial_position_[type] = initial_position;
}
- ClawQueue claw_queue;
+ ::frc971::control_loops::ClawQueue claw_queue;
double initial_position_[CLAW_COUNT];
- control_loops::ClawQueue::Position last_position_;
+ ::frc971::control_loops::ClawQueue::Position last_position_;
};
@@ -248,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.
- ClawQueue claw_queue;
+ ::frc971::control_loops::ClawQueue claw_queue;
// Create a loop and simulation plant.
ClawMotor claw_motor_;
@@ -310,7 +313,7 @@
// Tests that the wrist zeros correctly and goes to a position.
TEST_F(ClawTest, LimitClawGoal) {
- frc971::constants::Values values;
+ constants::Values values;
values.claw.claw_min_separation = -2.0;
values.claw.claw_max_separation = 1.0;
values.claw.soft_min_separation = -2.0;
@@ -510,7 +513,7 @@
protected:
void TestWindup(ClawMotor::CalibrationMode mode, ::aos::time::Time start_time, double offset) {
int capped_count = 0;
- const frc971::constants::Values& values = constants::GetValues();
+ const constants::Values& values = constants::GetValues();
bool kicked = false;
bool measured = false;
while (::aos::time::Time::Now() < ::aos::time::Time::InSeconds(7)) {
@@ -611,4 +614,4 @@
} // namespace testing
} // namespace control_loops
-} // namespace frc971
+} // namespace y2014
diff --git a/y2014/control_loops/claw/claw_main.cc b/y2014/control_loops/claw/claw_main.cc
index e573d6f..8126851 100644
--- a/y2014/control_loops/claw/claw_main.cc
+++ b/y2014/control_loops/claw/claw_main.cc
@@ -4,7 +4,7 @@
int main() {
::aos::Init();
- frc971::control_loops::ClawMotor claw;
+ ::y2014::control_loops::ClawMotor claw;
claw.Run();
::aos::Cleanup();
return 0;
diff --git a/y2014/control_loops/shooter/shooter.cc b/y2014/control_loops/shooter/shooter.cc
index 21c5b1e..39bf5c0 100644
--- a/y2014/control_loops/shooter/shooter.cc
+++ b/y2014/control_loops/shooter/shooter.cc
@@ -12,7 +12,7 @@
#include "y2014/constants.h"
#include "y2014/control_loops/shooter/shooter_motor_plant.h"
-namespace frc971 {
+namespace y2014 {
namespace control_loops {
using ::y2014::control_loops::shooter::kSpringConstant;
@@ -42,7 +42,9 @@
voltage_ = std::max(-max_voltage_, voltage_);
mutable_U(0, 0) = voltage_ - old_voltage;
- LOG_STRUCT(DEBUG, "shooter_output", ShooterVoltageToLog(X_hat(2, 0), voltage_));
+ LOG_STRUCT(
+ DEBUG, "shooter_output",
+ ::frc971::control_loops::ShooterVoltageToLog(X_hat(2, 0), voltage_));
last_voltage_ = voltage_;
capped_goal_ = false;
@@ -61,7 +63,8 @@
mutable_R(0, 0) -= dx;
}
capped_goal_ = true;
- LOG_STRUCT(DEBUG, "to prevent windup", ShooterMovingGoal(dx));
+ LOG_STRUCT(DEBUG, "to prevent windup",
+ ::frc971::control_loops::ShooterMovingGoal(dx));
} else if (uncapped_voltage() < -max_voltage_) {
double dx;
if (controller_index() == 0) {
@@ -74,7 +77,8 @@
mutable_R(0, 0) -= dx;
}
capped_goal_ = true;
- LOG_STRUCT(DEBUG, "to prevent windup", ShooterMovingGoal(dx));
+ LOG_STRUCT(DEBUG, "to prevent windup",
+ ::frc971::control_loops::ShooterMovingGoal(dx));
} else {
capped_goal_ = false;
}
@@ -100,14 +104,15 @@
if (controller_index() == 0) {
mutable_R(2, 0) += -A(1, 0) / A(1, 2) * (doffset);
}
- LOG_STRUCT(
- DEBUG, "sensor edge (fake?)",
- ShooterChangeCalibration(encoder_val, known_position, old_position,
- absolute_position(), previous_offset, offset_));
+ LOG_STRUCT(DEBUG, "sensor edge (fake?)",
+ ::frc971::control_loops::ShooterChangeCalibration(
+ encoder_val, known_position, old_position, absolute_position(),
+ previous_offset, offset_));
}
-ShooterMotor::ShooterMotor(control_loops::ShooterQueue *my_shooter)
- : aos::controls::ControlLoop<control_loops::ShooterQueue>(my_shooter),
+ShooterMotor::ShooterMotor(::frc971::control_loops::ShooterQueue *my_shooter)
+ : aos::controls::ControlLoop<::frc971::control_loops::ShooterQueue>(
+ my_shooter),
shooter_(MakeShooterLoop()),
state_(STATE_INITIALIZE),
loading_problem_end_time_(0, 0),
@@ -124,16 +129,18 @@
last_proximal_current_(true) {}
double ShooterMotor::PowerToPosition(double power) {
- const frc971::constants::Values &values = constants::GetValues();
+ const constants::Values &values = constants::GetValues();
double maxpower = 0.5 * kSpringConstant *
(kMaxExtension * kMaxExtension -
(kMaxExtension - values.shooter.upper_limit) *
(kMaxExtension - values.shooter.upper_limit));
if (power < 0) {
- LOG_STRUCT(WARNING, "negative power", PowerAdjustment(power, 0));
+ LOG_STRUCT(WARNING, "negative power",
+ ::frc971::control_loops::PowerAdjustment(power, 0));
power = 0;
} else if (power > maxpower) {
- LOG_STRUCT(WARNING, "power too high", PowerAdjustment(power, maxpower));
+ LOG_STRUCT(WARNING, "power too high",
+ ::frc971::control_loops::PowerAdjustment(power, maxpower));
power = maxpower;
}
@@ -157,9 +164,9 @@
}
void ShooterMotor::CheckCalibrations(
- const control_loops::ShooterQueue::Position *position) {
+ const ::frc971::control_loops::ShooterQueue::Position *position) {
CHECK_NOTNULL(position);
- const frc971::constants::Values &values = constants::GetValues();
+ const constants::Values &values = constants::GetValues();
// TODO(austin): Validate that this is the right edge.
// If we see a posedge on any of the hall effects,
@@ -206,10 +213,10 @@
// Positive is out, and positive power is out.
void ShooterMotor::RunIteration(
- const control_loops::ShooterQueue::Goal *goal,
- const control_loops::ShooterQueue::Position *position,
- control_loops::ShooterQueue::Output *output,
- control_loops::ShooterQueue::Status *status) {
+ 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) {
if (goal && ::std::isnan(goal->shot_power)) {
state_ = STATE_ESTOP;
LOG(ERROR, "Estopping because got a shot power of NAN.\n");
@@ -236,7 +243,7 @@
// motors disabled.
if (output) output->voltage = 0;
- const frc971::constants::Values &values = constants::GetValues();
+ const constants::Values &values = constants::GetValues();
// Don't even let the control loops run.
bool shooter_loop_disable = false;
@@ -641,8 +648,8 @@
if (!shooter_loop_disable) {
LOG_STRUCT(DEBUG, "running the loop",
- ShooterStatusToLog(shooter_.goal_position(),
- shooter_.absolute_position()));
+ ::frc971::control_loops::ShooterStatusToLog(
+ shooter_.goal_position(), shooter_.absolute_position()));
if (!cap_goal) {
shooter_.set_max_voltage(12.0);
}
@@ -668,7 +675,7 @@
if (position) {
LOG_STRUCT(DEBUG, "internal state",
- ShooterStateToLog(
+ ::frc971::control_loops::ShooterStateToLog(
shooter_.absolute_position(), shooter_.absolute_velocity(),
state_, position->latch, position->pusher_proximal.current,
position->pusher_distal.current, position->plunger,
@@ -698,4 +705,4 @@
}
} // namespace control_loops
-} // namespace frc971
+} // namespace y2014
diff --git a/y2014/control_loops/shooter/shooter.h b/y2014/control_loops/shooter/shooter.h
index 93b45e0..107fc65 100644
--- a/y2014/control_loops/shooter/shooter.h
+++ b/y2014/control_loops/shooter/shooter.h
@@ -11,7 +11,7 @@
#include "y2014/control_loops/shooter/shooter_motor_plant.h"
#include "y2014/control_loops/shooter/shooter.q.h"
-namespace frc971 {
+namespace y2014 {
namespace control_loops {
namespace testing {
class ShooterTest_UnloadWindupPositive_Test;
@@ -122,17 +122,18 @@
const Time kPrepareFireEndTime = Time::InMS(40);
class ShooterMotor
- : public aos::controls::ControlLoop<control_loops::ShooterQueue> {
+ : public aos::controls::ControlLoop<::frc971::control_loops::ShooterQueue> {
public:
- explicit ShooterMotor(control_loops::ShooterQueue *my_shooter =
- &control_loops::shooter_queue);
+ explicit ShooterMotor(::frc971::control_loops::ShooterQueue *my_shooter =
+ &::frc971::control_loops::shooter_queue);
// True if the goal was moved to avoid goal windup.
bool capped_goal() const { return shooter_.capped_goal(); }
double PowerToPosition(double power);
double PositionToPower(double position);
- void CheckCalibrations(const control_loops::ShooterQueue::Position *position);
+ void CheckCalibrations(
+ const ::frc971::control_loops::ShooterQueue::Position *position);
typedef enum {
STATE_INITIALIZE = 0,
@@ -153,9 +154,10 @@
protected:
virtual void RunIteration(
- const ShooterQueue::Goal *goal,
- const control_loops::ShooterQueue::Position *position,
- ShooterQueue::Output *output, ShooterQueue::Status *status);
+ 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);
private:
// We have to override this to keep the pistons in the correct positions.
@@ -177,7 +179,7 @@
load_timeout_ = Time::Now() + kLoadTimeout;
}
- control_loops::ShooterQueue::Position last_position_;
+ ::frc971::control_loops::ShooterQueue::Position last_position_;
ZeroedStateFeedbackLoop shooter_;
@@ -220,6 +222,6 @@
};
} // namespace control_loops
-} // namespace frc971
+} // namespace y2014
#endif // Y2014_CONTROL_LOOPS_shooter_shooter_H_
diff --git a/y2014/control_loops/shooter/shooter_lib_test.cc b/y2014/control_loops/shooter/shooter_lib_test.cc
index 648bbd7..e22ee7a 100644
--- a/y2014/control_loops/shooter/shooter_lib_test.cc
+++ b/y2014/control_loops/shooter/shooter_lib_test.cc
@@ -12,7 +12,7 @@
using ::aos::time::Time;
-namespace frc971 {
+namespace y2014 {
namespace control_loops {
namespace testing {
@@ -85,8 +85,9 @@
// Sets the values of the physical sensors that can be directly observed
// (encoder, hall effect).
- void SetPhysicalSensors(control_loops::ShooterQueue::Position *position) {
- const frc971::constants::Values &values = constants::GetValues();
+ void SetPhysicalSensors(
+ ::frc971::control_loops::ShooterQueue::Position *position) {
+ const constants::Values &values = constants::GetValues();
position->position = GetPosition();
@@ -115,10 +116,10 @@
}
void UpdateEffectEdge(
- PosedgeOnlyCountedHallEffectStruct *sensor,
- const PosedgeOnlyCountedHallEffectStruct &last_sensor,
+ ::frc971::PosedgeOnlyCountedHallEffectStruct *sensor,
+ const ::frc971::PosedgeOnlyCountedHallEffectStruct &last_sensor,
const constants::Values::AnglePair &limits,
- const control_loops::ShooterQueue::Position &last_position) {
+ const ::frc971::control_loops::ShooterQueue::Position &last_position) {
sensor->posedge_count = last_sensor.posedge_count;
sensor->negedge_count = last_sensor.negedge_count;
@@ -152,9 +153,9 @@
// it into a state using the passed values
void SendPositionMessage(bool use_passed, bool plunger_in,
bool latch_in, bool brake_in) {
- const frc971::constants::Values &values = constants::GetValues();
- ::aos::ScopedMessagePtr<control_loops::ShooterQueue::Position> position =
- shooter_queue_.position.MakeMessage();
+ const constants::Values &values = constants::GetValues();
+ ::aos::ScopedMessagePtr<::frc971::control_loops::ShooterQueue::Position>
+ position = shooter_queue_.position.MakeMessage();
if (use_passed) {
plunger_latched_ = latch_in && plunger_in;
@@ -282,11 +283,11 @@
int brake_delay_count_;
private:
- ShooterQueue shooter_queue_;
+ ::frc971::control_loops::ShooterQueue shooter_queue_;
double initial_position_;
double last_voltage_;
- control_loops::ShooterQueue::Position last_position_message_;
+ ::frc971::control_loops::ShooterQueue::Position last_position_message_;
double last_plant_position_;
};
@@ -296,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.
- ShooterQueue shooter_queue_;
+ ::frc971::control_loops::ShooterQueue shooter_queue_;
// Create a loop and simulation plant.
ShooterMotor shooter_motor_;
@@ -326,7 +327,7 @@
};
TEST_F(ShooterTest, PowerConversion) {
- const frc971::constants::Values &values = constants::GetValues();
+ const constants::Values &values = constants::GetValues();
// test a couple of values return the right thing
EXPECT_NEAR(0.254001, shooter_motor_.PowerToPosition(140.0), 0.00001);
EXPECT_NEAR(0.00058, shooter_motor_.PowerToPosition(0.53), 0.00001);
@@ -719,4 +720,4 @@
} // namespace testing
} // namespace control_loops
-} // namespace frc971
+} // namespace y2014
diff --git a/y2014/control_loops/shooter/shooter_main.cc b/y2014/control_loops/shooter/shooter_main.cc
index 31b24bf..2819f10 100644
--- a/y2014/control_loops/shooter/shooter_main.cc
+++ b/y2014/control_loops/shooter/shooter_main.cc
@@ -4,7 +4,7 @@
int main() {
::aos::Init();
- frc971::control_loops::ShooterMotor shooter;
+ ::y2014::control_loops::ShooterMotor shooter;
shooter.Run();
::aos::Cleanup();
return 0;