mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
[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:
@@ -47,5 +47,5 @@ void RobotContainer::ConfigureButtonBindings() {
|
||||
|
||||
frc2::Command* RobotContainer::GetAutonomousCommand() {
|
||||
// Runs the chosen command in autonomous
|
||||
return &m_autonomousCommand;
|
||||
return m_autonomousCommand.get();
|
||||
}
|
||||
|
||||
@@ -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}),
|
||||
|
||||
Reference in New Issue
Block a user