-
Notifications
You must be signed in to change notification settings - Fork 611
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C++ command-based examples use both Command*
and CommandPtr
for GetAutonomousCommand
#5921
Comments
This is a leftover from before CommandPtr was a thing (and possibly even from old commands).
That's been brought up before; there are multiple options:
I think we have some docs in the C++ Commands page, but improving it and/or putting it somewhere more obvious is never a bad idea. |
To clarify, the action items I see from this issue are:
Using concepts for command types should also be done, but I see that as deriving more from #5789 than from this issue. |
Is there any plan as to where this may be documented? Is it going to be one long comment on every single GetAutonomousCommand() or will there be a link to a new page(or an addition to an old one) on the FRC Docs? Or something else entirely, though I am not sure of many other options. |
The C++ Commands Technical Discussion page on frc-docs, though it might need a refactor/split/rework (it currently has a lot of historic information that is relevant to command classes and less so to CommandPtr). |
I extracted the remaining documentation part to wpilibsuite/frc-docs#2438; closing. |
The examples show
GetAutonomousCommand
returning bothCommandPtr
andCommand*
in various places.In some examples,
GetAutonomousCommand
constructs and returns aCommand*
constructed with thenew
operator, leaking memory.In others, it returns pointers to commands constructed inside
RobotContainer
(which obviously can't be accomplished withCommandPtr
due to ownership constraints- functions that returnCommandPtr
must construct a new command each time))
Additionally,
SendableChooser
must be used withCommand*
.It seems like there's not one way that will work for all cases.
I'm not sure what the best solution is here. Perhaps we should keep the examples as-is, and better document the differences between
CommandPtr
andCommand*
?The text was updated successfully, but these errors were encountered: