Skip to content

Commit

Permalink
Build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kGoel647 committed Oct 13, 2024
1 parent 90a3b28 commit d39be06
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 23 deletions.
9 changes: 5 additions & 4 deletions src/frc846/include/frc846/control/control_ctre.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ class TalonFXController : public BaseESC<X> {
auto vcomp =
auton ? config_helper_.getMotorConfig().auton_voltage_compensation
: config_helper_.getMotorConfig().voltage_compensation;
voltageConfs.WithPeakForwardVoltage(vcomp.to<double>())
.WithPeakReverseVoltage(-vcomp.to<double>());
voltageConfs.WithPeakForwardVoltage(vcomp.template to<double>())
.WithPeakReverseVoltage(-vcomp.template to<double>());

deviceConfigs.WithVoltage(voltageConfs);

Expand Down Expand Up @@ -194,9 +194,10 @@ class TalonFXController : public BaseESC<X> {
ctre::configs::CurrentLimitsConfigs currentConfs;
currentConfs.WithSupplyCurrentLimitEnable(true);
currentConfs.WithSupplyCurrentLimit(
motor_config.current_limiting.target_threshold.to<double>());
motor_config.current_limiting.target_threshold.template to<double>());
currentConfs.WithSupplyTimeThreshold(
motor_config.current_limiting.peak_time_threshold.to<double>());
motor_config.current_limiting.peak_time_threshold
.template to<double>());

deviceConfigs.WithCurrentLimits(currentConfs);

Expand Down
19 changes: 10 additions & 9 deletions src/frc846/include/frc846/control/control_rev.h
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ class REVSparkController : public BaseESC<X> {
if (esc_) {
this->CheckOK(esc_->EnableVoltageCompensation(
auton ? config_helper_.getMotorConfig()
.auton_voltage_compensation.to<double>()
.auton_voltage_compensation.template to<double>()
: config_helper_.getMotorConfig()
.voltage_compensation
.to<double>())); // switching between
// autonomous and teleop
// presets for voltage
// compensation
.template to<double>())); // switching between
// autonomous and teleop
// presets for voltage
// compensation
}
}

Expand Down Expand Up @@ -218,7 +218,7 @@ class REVSparkController : public BaseESC<X> {

this->Q(parent_, [&]() {
return CheckOK(esc_->EnableVoltageCompensation(
motor_config.auton_voltage_compensation.to<double>()));
motor_config.auton_voltage_compensation.template to<double>()));
}); // voltage compensation sets the maximum voltage
// that the controller will output. 10-12V is good
// for consistency during autonomous, but the
Expand All @@ -240,18 +240,19 @@ class REVSparkController : public BaseESC<X> {
if (motor_config.withRampRate) {
this->Q(parent_, [&]() {
return CheckOK(esc_->SetOpenLoopRampRate(
motor_config.rampTime.to<
motor_config.rampTime.template to<
double>())) // if our can bus isn't overloaded, we
// should use custom motion profiles instead

&& CheckOK(esc_->SetClosedLoopRampRate(
motor_config.rampTime.to<double>()));
motor_config.rampTime.template to<double>()));
});
}

this->Q(parent_, [&]() {
return CheckOK(esc_->SetSmartCurrentLimit(
motor_config.current_limiting.target_threshold.to<double>()));
motor_config.current_limiting.target_threshold
.template to<double>()));
}); // REV current limit uses PID to control
// current if it exceeds output. Reactive
// system. Happens on board controller at high
Expand Down
15 changes: 5 additions & 10 deletions src/y2024/include/field.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,22 @@
// Field has blue alliance far right corner as origin
struct field {
struct points {
static frc846::util::Position Origin() {
return frc846::util::Position(
frc846::util::Vector2D<units::foot_t>(0_in, 0_in), 0_deg);
};
static frc846::util::Position Origin() { return {{0_in, 0_in}, 0_deg}; };

static frc846::util::Vector2D<units::foot_t> kSpeaker(bool flip = false) {
if (!flip) {
return frc846::util::Vector2D<units::foot_t>(217.5_in, -4_in);
return {217.5_in, -4_in};
} else {
return frc846::util::Vector2D<units::foot_t>(217.5_in, 655.8_in);
return {217.5_in, 655.8_in};
}
}

static frc846::util::Position kAmpNoFlip() {
return frc846::util::Position(
frc846::util::Vector2D<units::foot_t>(0_in, 0_in), 90_deg);
return {{0_in, 0_in}, 90_deg};
}

static frc846::util::Position kPreAmpNoFlip() {
return frc846::util::Position(
frc846::util::Vector2D<units::foot_t>(-2_ft, 0_in), 90_deg);
return {{-2_ft, 0_in}, 90_deg};
}

// TESTING
Expand Down

0 comments on commit d39be06

Please sign in to comment.