How does wpilib framework handle .andThen

We have the following command in a ParallelRaceGroup

new WaitUntilStable(m_limelight::getDistance, 0.01, 10).withTimeout(1).andThen(m_limelight::snapshotDistance)

So m_limelight is extend from CommandBase.

Once the command is running, each loop of the wpilib framework will call the following…

Execute
Is Finished
(if finished returns true) End

My question is will the “.andThen” execute in the immediately after End, or will it wait until the next 20ms cycle?

Thanks

andThen forms a sequential command group. When the previous command ends, end will be called, then the next command will be initialized in the same loop. The next commands execute won’t be called until the next cycle.

https://first.wpi.edu/wpilib/allwpilib/docs/release/java/src-html/edu/wpi/first/wpilibj2/command/SequentialCommandGroup.html#line.59

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