Move 2015-specific code to its own folder.
Known issues:
-I didn't change the namespace for it, but I am open to discussion
on doing that in a separate change.
-There are a couple of files which should get split out into
year-specific and not-year-specific files to reduce how much needs
to get copied around each year still.
-The control loop python code doesn't yet generate code with the
right #include etc paths.
Change-Id: Iabf078e75107c283247f58a5ffceb4dbd6a0815f
diff --git a/frc971/zeroing/zeroing.cc b/frc971/zeroing/zeroing.cc
index d8c77e8..e54446a 100644
--- a/frc971/zeroing/zeroing.cc
+++ b/frc971/zeroing/zeroing.cc
@@ -1,6 +1,6 @@
#include "frc971/zeroing/zeroing.h"
-#include <math.h>
+#include <cmath>
#include <vector>
namespace frc971 {
@@ -14,7 +14,7 @@
}
ZeroingEstimator::ZeroingEstimator(
- const constants::Values::ZeroingConstants& constants) {
+ const constants::ZeroingConstants& constants) {
index_diff_ = constants.index_difference;
max_sample_count_ = constants.average_filter_size;
known_index_pos_ = constants.measured_index_position;
diff --git a/frc971/zeroing/zeroing.gyp b/frc971/zeroing/zeroing.gyp
index a868e19..0a7a2fc 100644
--- a/frc971/zeroing/zeroing.gyp
+++ b/frc971/zeroing/zeroing.gyp
@@ -8,10 +8,8 @@
],
'dependencies': [
'<(DEPTH)/frc971/control_loops/control_loops.gyp:queues',
- '<(DEPTH)/frc971/frc971.gyp:constants',
],
'export_dependent_settings': [
- '<(DEPTH)/frc971/frc971.gyp:constants',
'<(DEPTH)/frc971/control_loops/control_loops.gyp:queues',
],
},
diff --git a/frc971/zeroing/zeroing.h b/frc971/zeroing/zeroing.h
index 08911ac..4176f48 100644
--- a/frc971/zeroing/zeroing.h
+++ b/frc971/zeroing/zeroing.h
@@ -23,7 +23,7 @@
// the pot and the indices.
class ZeroingEstimator {
public:
- ZeroingEstimator(const constants::Values::ZeroingConstants &constants);
+ ZeroingEstimator(const constants::ZeroingConstants &constants);
// Update the internal logic with the next sensor values.
void UpdateEstimate(const PotAndIndexPosition &info);
diff --git a/frc971/zeroing/zeroing_test.cc b/frc971/zeroing/zeroing_test.cc
index 404b0e0..4a82e04 100644
--- a/frc971/zeroing/zeroing_test.cc
+++ b/frc971/zeroing/zeroing_test.cc
@@ -16,7 +16,7 @@
namespace zeroing {
using control_loops::PositionSensorSimulator;
-using constants::Values;
+using constants::ZeroingConstants;
static const size_t kSampleSize = 30;
static const double kAcceptableUnzeroedError = 0.2;
@@ -41,7 +41,7 @@
const double index_diff = 1.0;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.6 * index_diff, index_diff / 3.0);
- ZeroingEstimator estimator(Values::ZeroingConstants{
+ ZeroingEstimator estimator(ZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// The zeroing code is supposed to perform some filtering on the difference
@@ -65,7 +65,7 @@
double position = 3.6 * index_diff;
PositionSensorSimulator sim(index_diff);
sim.Initialize(position, index_diff / 3.0);
- ZeroingEstimator estimator(Values::ZeroingConstants{
+ ZeroingEstimator estimator(ZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// Make sure that the zeroing code does not consider itself zeroed until we
@@ -84,7 +84,7 @@
double index_diff = 1.0;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.6, index_diff / 3.0);
- ZeroingEstimator estimator(Values::ZeroingConstants{
+ ZeroingEstimator estimator(ZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// The zeroing code is supposed to perform some filtering on the difference
@@ -117,7 +117,7 @@
double index_diff = 0.89;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.5 * index_diff, index_diff / 3.0);
- ZeroingEstimator estimator(Values::ZeroingConstants{
+ ZeroingEstimator estimator(ZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// The zeroing code is supposed to perform some filtering on the difference
@@ -151,7 +151,7 @@
double index_diff = 0.89;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.5 * index_diff, index_diff / 3.0);
- ZeroingEstimator estimator(Values::ZeroingConstants{
+ ZeroingEstimator estimator(ZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
for (unsigned int i = 0; i < kSampleSize / 2; i++) {
@@ -164,7 +164,7 @@
double index_diff = 0.89;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.1 * index_diff, index_diff / 3.0);
- ZeroingEstimator estimator(Values::ZeroingConstants{
+ ZeroingEstimator estimator(ZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
MoveTo(&sim, &estimator, 3.1 * index_diff);
@@ -180,7 +180,7 @@
double index_diff = 0.6;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.1 * index_diff, index_diff / 3.0);
- ZeroingEstimator estimator(Values::ZeroingConstants{
+ ZeroingEstimator estimator(ZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
// Make sure to fill up the averaging filter with samples.
@@ -215,7 +215,7 @@
const double known_index_pos = 3.5 * index_diff;
PositionSensorSimulator sim(index_diff);
sim.Initialize(3.3 * index_diff, index_diff / 3.0, known_index_pos);
- ZeroingEstimator estimator(Values::ZeroingConstants{
+ ZeroingEstimator estimator(ZeroingConstants{
kSampleSize, index_diff, known_index_pos, kIndexErrorFraction});
// Make sure to fill up the averaging filter with samples.
@@ -240,7 +240,7 @@
TEST_F(ZeroingTest, BasicErrorAPITest) {
const double index_diff = 1.0;
- ZeroingEstimator estimator(Values::ZeroingConstants{
+ ZeroingEstimator estimator(ZeroingConstants{
kSampleSize, index_diff, 0.0, kIndexErrorFraction});
PositionSensorSimulator sim(index_diff);
sim.Initialize(1.5 * index_diff, index_diff / 3.0, 0.0);
@@ -276,7 +276,7 @@
int sample_size = 30;
PositionSensorSimulator sim(index_diff);
sim.Initialize(10 * index_diff, index_diff / 3.0, known_index_pos);
- ZeroingEstimator estimator(Values::ZeroingConstants{
+ ZeroingEstimator estimator(ZeroingConstants{
sample_size, index_diff, known_index_pos, kIndexErrorFraction});
for (int i = 0; i < sample_size; i++) {