mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
[commands] Fix C++ SysIdRoutine crashing when passed nullptr or {} (#6508)
Flattens parameter from a `std::optional<std::function<...>>` to just a `std::function<...>`. This is a breaking change but a trivial one for teams to fix.
This commit is contained in:
@@ -39,8 +39,7 @@ class Drive : public frc2::SubsystemBase {
|
||||
constants::drive::kRightEncoderReversed};
|
||||
|
||||
frc2::sysid::SysIdRoutine m_sysIdRoutine{
|
||||
frc2::sysid::Config{std::nullopt, std::nullopt, std::nullopt,
|
||||
std::nullopt},
|
||||
frc2::sysid::Config{std::nullopt, std::nullopt, std::nullopt, nullptr},
|
||||
frc2::sysid::Mechanism{
|
||||
[this](units::volt_t driveVoltage) {
|
||||
m_leftMotor.SetVoltage(driveVoltage);
|
||||
|
||||
@@ -33,8 +33,7 @@ class Shooter : public frc2::SubsystemBase {
|
||||
constants::shooter::kEncoderReversed};
|
||||
|
||||
frc2::sysid::SysIdRoutine m_sysIdRoutine{
|
||||
frc2::sysid::Config{std::nullopt, std::nullopt, std::nullopt,
|
||||
std::nullopt},
|
||||
frc2::sysid::Config{std::nullopt, std::nullopt, std::nullopt, nullptr},
|
||||
frc2::sysid::Mechanism{
|
||||
[this](units::volt_t driveVoltage) {
|
||||
m_shooterMotor.SetVoltage(driveVoltage);
|
||||
|
||||
Reference in New Issue
Block a user