-
Notifications
You must be signed in to change notification settings - Fork 130
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
Add an Either Command to the pathplanner events #609
Comments
id love to see this! i came across conditional commands which could help https://github.wpilib.org/allwpilib/docs/release/java/edu/wpi/first/wpilibj2/command/ConditionalCommand.html |
After thinking about this for a bit, a hack that you could kinda run would be using a sequential command group inside of a race command group with one other command. The other command could be something like "hasPiece", and when the command starts, it could immediately check if there is a piece, and either end immediately if there is no piece, or continue forever if there is one. This has the effect of the items in the sequential command group only running if there is a piece. You could then make a "!hasPiece" that does the opposite and put that in a race sequence immediately after. This would give you an equivalent to the Either. Since very very few teams would ever use this, and adding the ability to register boolean suppliers is a huge undertaking, I think that this solution would work for now, and we're probably gonna try and see if this works. |
This is an example of the sort of composition @NickAnastasoff: (You would put the "hasPiece" and "!hasPiece" commands in the empty NamedCommand spots.) |
I think at this point it would make more sense to just create the autos in code with the PathPlanner.fromPathFile function, although that is a cool way to do it! |
Something that my team is working on is conditional pathing based on whether we have a game piece in the robot. We are currently making named commands that follow one sequence of paths if we have a piece and a different set if we do not see a piece. This saves time not having to go back.
A solution to this would be including an "either" group in addition to the current "sequential", "parallel", etc. groups. This could allow for much more dynamic branching in auto. Boolean suppliers could be registered with the named commands static class as well.
The text was updated successfully, but these errors were encountered: