Change ZeroingEstimator constructors to explicit
Change-Id: I6dc6df30d7351ac52f4a8a06dfea57bbf1a47fdf
diff --git a/frc971/control_loops/profiled_subsystem.h b/frc971/control_loops/profiled_subsystem.h
index 84803af..fe64b75 100644
--- a/frc971/control_loops/profiled_subsystem.h
+++ b/frc971/control_loops/profiled_subsystem.h
@@ -217,8 +217,8 @@
const typename ZeroingEstimator::ZeroingConstants &zeroing_constants,
const ::frc971::constants::Range &range, double default_velocity,
double default_acceleration)
- : ProfiledSubsystem<3, 1, ZeroingEstimator>(::std::move(loop),
- {{zeroing_constants}}),
+ : ProfiledSubsystem<3, 1, ZeroingEstimator>(
+ ::std::move(loop), {{ZeroingEstimator(zeroing_constants)}}),
profile_(::aos::controls::kLoopFrequency),
range_(range),
default_velocity_(default_velocity),
diff --git a/frc971/zeroing/zeroing.h b/frc971/zeroing/zeroing.h
index 9d7cea1..cfac284 100644
--- a/frc971/zeroing/zeroing.h
+++ b/frc971/zeroing/zeroing.h
@@ -42,7 +42,7 @@
using ZeroingConstants = constants::PotAndIndexPulseZeroingConstants;
using State = EstimatorState;
- PotAndIndexPulseZeroingEstimator(
+ explicit PotAndIndexPulseZeroingEstimator(
const constants::PotAndIndexPulseZeroingConstants &constants);
// Update the internal logic with the next sensor values.
@@ -121,8 +121,7 @@
double first_start_pos_;
};
-// Estimates the position with an incremental encoder with an index pulse and a
-// potentiometer.
+// Estimates the position with an incremental encoder and a hall effect sensor.
class HallEffectAndPositionZeroingEstimator : public ZeroingEstimator {
public:
using Position = HallEffectAndPosition;
@@ -203,7 +202,7 @@
using ZeroingConstants = constants::PotAndAbsoluteEncoderZeroingConstants;
using State = AbsoluteEstimatorState;
- PotAndAbsEncoderZeroingEstimator(
+ explicit PotAndAbsEncoderZeroingEstimator(
const constants::PotAndAbsoluteEncoderZeroingConstants &constants);
// Resets the internal logic so it needs to be re-zeroed.
@@ -276,7 +275,7 @@
using ZeroingConstants = constants::EncoderPlusIndexZeroingConstants;
using State = IndexEstimatorState;
- PulseIndexZeroingEstimator(const ZeroingConstants &constants)
+ explicit PulseIndexZeroingEstimator(const ZeroingConstants &constants)
: constants_(constants) {
Reset();
}
diff --git a/y2016/control_loops/superstructure/superstructure_controls.cc b/y2016/control_loops/superstructure/superstructure_controls.cc
index 13a949a..a522e40 100644
--- a/y2016/control_loops/superstructure/superstructure_controls.cc
+++ b/y2016/control_loops/superstructure/superstructure_controls.cc
@@ -42,8 +42,10 @@
: ProfiledSubsystem(
::std::unique_ptr<ArmControlLoop>(new ArmControlLoop(
::y2016::control_loops::superstructure::MakeIntegralArmLoop())),
- {{constants::GetValues().shoulder.zeroing,
- constants::GetValues().wrist.zeroing}}),
+ {{::frc971::zeroing::PotAndIndexPulseZeroingEstimator(
+ constants::GetValues().shoulder.zeroing),
+ ::frc971::zeroing::PotAndIndexPulseZeroingEstimator(
+ constants::GetValues().wrist.zeroing)}}),
shoulder_profile_(::aos::controls::kLoopFrequency),
wrist_profile_(::aos::controls::kLoopFrequency) {
Y_.setZero();