Add pivot joint functionality
Signed-off-by: Charlie Huang <charliehuang09@gmail.com>
Change-Id: Ib40d4ce1a4c91f1b0e75b3548fe43c9218433634
diff --git a/y2023_bot3/constants.h b/y2023_bot3/constants.h
index fb3089e..a365349 100644
--- a/y2023_bot3/constants.h
+++ b/y2023_bot3/constants.h
@@ -62,19 +62,19 @@
control_loops::drivetrain::kWheelRadius;
}
- struct PotAndAbsEncoderConstants {
- ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemParams<
- ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator>
- subsystem_params;
- double potentiometer_offset;
- };
-
// Pivot Joint (placeholders)
static constexpr double kPivotJointEncoderCountsPerRevolution() {
return 4096.0;
}
- static constexpr double kPivotJointEncoderRatio() { return 1.0; }
+ static constexpr double kPivotJointEncoderRatio() { return (18.0 / 48.0); }
+
+ static constexpr double kPivotJointPotRatio() { return (18.0 / 48.0); }
+
+ static constexpr double kPivotJointPotRadiansPerVolt() {
+ return kPivotJointPotRatio() * (3.0 /*turns*/ / 5.0 /*volts*/) *
+ (2 * M_PI /*radians*/);
+ }
static constexpr double kMaxPivotJointEncoderPulsesPerSecond() {
return control_loops::superstructure::pivot_joint::kFreeSpeed /
@@ -92,6 +92,13 @@
};
}
+ struct PotAndAbsEncoderConstants {
+ ::frc971::control_loops::StaticZeroingSingleDOFProfiledSubsystemParams<
+ ::frc971::zeroing::PotAndAbsoluteEncoderZeroingEstimator>
+ subsystem_params;
+ double potentiometer_offset;
+ };
+
PotAndAbsEncoderConstants pivot_joint;
bool pivot_joint_flipped;