Pot + absolute encoder zeroing class
This class takes a pot, absolute encoder, and relative encoder and uses
them to compute the offset. It doesn't yet detect errors or wait until
stopped.
Change-Id: I74bc2031132974d9f3e2e6ddf93b954384a6ce2c
diff --git a/frc971/constants.h b/frc971/constants.h
index fbf7b1c..276dcc2 100644
--- a/frc971/constants.h
+++ b/frc971/constants.h
@@ -1,12 +1,14 @@
#ifndef FRC971_CONSTANTS_H_
#define FRC971_CONSTANTS_H_
+#include <cstddef>
+
namespace frc971 {
namespace constants {
struct PotAndIndexPulseZeroingConstants {
// The number of samples in the moving average filter.
- int average_filter_size;
+ size_t average_filter_size;
// The difference in scaled units between two index pulses.
double index_difference;
// The absolute position in scaled units of one of the index pulses.
@@ -22,11 +24,16 @@
};
struct PotAndAbsoluteEncoderZeroingConstants {
+ // The number of samples in the moving average filter.
+ size_t average_filter_size;
// The distance that the absolute encoder needs to complete a full rotation.
- double abs_duration;
- // Sample mechanism angle and absolute encoder value.
- double sample_abs_value;
- double sample_degrees;
+ double one_revolution_distance;
+ // Measured absolute position of the encoder when at zero.
+ double measured_absolute_position;
+
+ // Treshold for deciding if we are moving
+ // TODO(austin): Figure out what this is actually measuring.
+ double zeroing_threshold;
};
// Defines a range of motion for a subsystem.