Add a WriteVoltage function in falcon
Signed-off-by: Maxwell Henderson <mxwhenderson@gmail.com>
Change-Id: I8640913ad99a9ecafdd13b3055a91bebee721cc9
diff --git a/frc971/wpilib/falcon.h b/frc971/wpilib/falcon.h
index 6ea8735..804c7a0 100644
--- a/frc971/wpilib/falcon.h
+++ b/frc971/wpilib/falcon.h
@@ -42,6 +42,8 @@
void WriteConfigs();
ctre::phoenix::StatusCode WriteCurrent(double current, double max_voltage);
+ ctre::phoenix::StatusCode WriteVoltage(double voltage);
+
ctre::phoenix6::hardware::TalonFX *talon() { return &talon_; }
// The position of the Falcon output shaft is multiplied by gear_ratio
@@ -79,6 +81,10 @@
supply_current_limit_ = supply_current_limit;
}
+ static double SafeSpeed(double voltage) {
+ return (::aos::Clip(voltage, -kMaxBringupPower, kMaxBringupPower) / 12.0);
+ }
+
private:
ctre::phoenix6::hardware::TalonFX talon_;
int device_id_;