Auto selection with sendable choosers in C++

We’ve been having some issues with creating a sendable chooser for autos in C++.

We’ve tried two methods, the first being a frc::SendableChooser<frc2::CommandPtr*> which works, but in the return statement of frc2::CommandPtr RobotContainer::GetAutonomousCommand(), we can’t find a way to deference m_chooser.GetSelected() as that is a pointer to a commandptr, not just a commandptr.

The other was an frc::SendableChooser<frc2::Command*> which lead to us being unable to convert the Command* to a CommandPtr. We’d like some advice as to how to properly do a sendable chooser (preferably avoiding frc2::Command*, as we’ve heard they are not recommended.)

For a working example, see Scrappy/src/main/cpp/RobotContainer.cpp at master · Jagwires7443/Scrappy · GitHub.

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.