[commands] C++ unique_ptr migration (#4319)

Add a CommandPtr with an internal unique_ptr to enable not needing to move the underlying classes, which is error-prone due to the potential for lambda captures.
This commit is contained in:
Starlight220
2022-10-06 01:19:28 +03:00
committed by GitHub
parent 3b81cf6c35
commit 60e29627c0
18 changed files with 644 additions and 133 deletions

View File

@@ -47,5 +47,5 @@ void RobotContainer::ConfigureButtonBindings() {
frc2::Command* RobotContainer::GetAutonomousCommand() {
// Runs the chosen command in autonomous
return &m_autonomousCommand;
return m_autonomousCommand.get();
}

View File

@@ -45,7 +45,7 @@ class RobotContainer {
ShooterSubsystem m_shooter;
// A simple autonomous routine that shoots the loaded frisbees
frc2::SequentialCommandGroup m_autonomousCommand =
frc2::CommandPtr m_autonomousCommand =
frc2::SequentialCommandGroup{
// Start the command by spinning up the shooter...
frc2::InstantCommand([this] { m_shooter.Enable(); }, {&m_shooter}),