Converted hood to only need an index pulse.
We now have a more complicated seek mechanism which runs the hood to
each hard stop, or until we find both index pulses.
Change-Id: I9932cc158beec0bc55dc0e908accb0aea6a73506
diff --git a/frc971/control_loops/profiled_subsystem.h b/frc971/control_loops/profiled_subsystem.h
index 45ef912..031795a 100644
--- a/frc971/control_loops/profiled_subsystem.h
+++ b/frc971/control_loops/profiled_subsystem.h
@@ -172,11 +172,12 @@
const ::frc971::constants::Range &range() const { return range_; }
- private:
+ protected:
// Limits the provided goal to the soft limits. Prints "name" when it fails
// to aid debugging.
- void CapGoal(const char *name, Eigen::Matrix<double, 3, 1> *goal);
+ virtual void CapGoal(const char *name, Eigen::Matrix<double, 3, 1> *goal);
+ private:
void UpdateOffset(double offset);
aos::util::TrapezoidProfile profile_;
diff --git a/frc971/control_loops/profiled_subsystem.q b/frc971/control_loops/profiled_subsystem.q
index 2bc1879..f89da14 100644
--- a/frc971/control_loops/profiled_subsystem.q
+++ b/frc971/control_loops/profiled_subsystem.q
@@ -77,3 +77,41 @@
// State of the estimator.
.frc971.AbsoluteEstimatorState estimator_state;
};
+
+struct IndexProfiledJointStatus {
+ // Is the subsystem zeroed?
+ bool zeroed;
+
+ // The state of the subsystem, if applicable. -1 otherwise.
+ int32_t state;
+
+ // If true, we have aborted.
+ bool estopped;
+
+ // Position of the joint.
+ float position;
+ // Velocity of the joint in units/second.
+ float velocity;
+ // Profiled goal position of the joint.
+ float goal_position;
+ // Profiled goal velocity of the joint in units/second.
+ float goal_velocity;
+ // Unprofiled goal position from absoulte zero of the joint.
+ float unprofiled_goal_position;
+ // Unprofiled goal velocity of the joint in units/second.
+ float unprofiled_goal_velocity;
+
+ // The estimated voltage error.
+ float voltage_error;
+
+ // The calculated velocity with delta x/delta t
+ float calculated_velocity;
+
+ // Components of the control loop output
+ float position_power;
+ float velocity_power;
+ float feedforwards_power;
+
+ // State of the estimator.
+ .frc971.IndexEstimatorState estimator_state;
+};
diff --git a/frc971/zeroing/zeroing.h b/frc971/zeroing/zeroing.h
index 62d346e..ac2e49e 100644
--- a/frc971/zeroing/zeroing.h
+++ b/frc971/zeroing/zeroing.h
@@ -196,7 +196,7 @@
class PulseIndexZeroingEstimator : public ZeroingEstimator {
public:
using Position = IndexPosition;
- using ZeroingConstants = constants::PotAndIndexPulseZeroingConstants;
+ using ZeroingConstants = constants::EncoderPlusIndexZeroingConstants;
using State = IndexEstimatorState;
PulseIndexZeroingEstimator(
@@ -210,6 +210,9 @@
bool zeroed() const override { return zeroed_; }
+ // It's as ready as it'll ever be...
+ bool offset_ready() const { return true; }
+
double offset() const override { return offset_; }
bool error() const override { return error_; }