Refer back to #2 if you need a refresher on why this code is awful. TL;DR: if you try to do anything else while DriveForwardTimed is running, it won't work, because the while loop in initialize() prevents the command-based framework from multitasking, which is the whole point.
You literally don't even need to put timeout logic in your commands; it would probably be easier just to have a DriveForward command that never ends (but doesn't block either!!) and then use that withTimeout() decorator on instances of DriveForward. So, like, the one line I could find where you're instantiating DriveForwardTimed
driveForwardTimed = new DriveForward(driveTrain).withTimeout(Constants.DriveTrain.DRIVE_FORWARD_TIME);
This isn't a super pressing issue at the moment because (afaik) you never try to multitask with DriveForwardTimed but it could lead to some nasty issues if you ever try to.
https://github.com/FRC5892/2021-Infinite-Recharge-2.0/blob/727d4510f3a098cd120b105c9afb0785f5f91b08/src/main/java/frc/robot/commands/DriveForwardTimed.java#L25-L33
Refer back to #2 if you need a refresher on why this code is awful. TL;DR: if you try to do anything else while
DriveForwardTimed
is running, it won't work, because thewhile
loop ininitialize()
prevents the command-based framework from multitasking, which is the whole point.You literally don't even need to put timeout logic in your commands; it would probably be easier just to have a
DriveForward
command that never ends (but doesn't block either!!) and then use thatwithTimeout()
decorator on instances ofDriveForward
. So, like, the one line I could find where you're instantiatingDriveForwardTimed
https://github.com/FRC5892/2021-Infinite-Recharge-2.0/blob/727d4510f3a098cd120b105c9afb0785f5f91b08/src/main/java/frc/robot/RobotContainer.java#L85
would become something like
This isn't a super pressing issue at the moment because (afaik) you never try to multitask with
DriveForwardTimed
but it could lead to some nasty issues if you ever try to.