What is the Correct Syntax for the last stop point command so that it requires the Drive Subsystem? #278
WarrenReynolds
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is the scenario. C++. Your auto path has finished and you want to run the last stop point command that takes control of the drive subsystem to do the auto balancing.
A marker or stop point command can't require the drive subsystem (by design), so you need to branch out of the fullauto command by launch a dummy command that schedules an external command that does require the subsystem. This will interrupt the path following command, but this doesn't matter as it has finished anyway.
I tried to do this with a runonce lambda on a ScheduleCommand statement, but I couldn't get it to work. Does anyone have the correct syntax for how this should be done (ie how to add it to the event map)? I managed to get it working by creating an old school dummy command that held an instance of the autobalance command. Then, in the init method of the dummy command I called the ->schedule() method on the autobalance command. This end dummy command doesn't require the drive subsystem, so Pathplanner is happy to run it, but the command it holds does require the drive subsystem, so it grabs the drive subsystem, interrupts the pathfollowing fullauto command and then autobalances and applies the brakes.
I got it to work, but I'm sure this could be done with a one liner if anyone know the correct syntax.
Beta Was this translation helpful? Give feedback.
All reactions