How to trigger a mechanism when a certain setpoint is reached?

How can I make a mechanism trigger when another reaches a certain setpoint?
I want to make an index that activates when the intake reaches a certain setpoint, yet I don’t know how to do it.

Look into command based programming.
You can make a command for the first mechanism and have it finish when the point is reached. After that you can use .andThen to start a second command.

The second command will not run until the first is finished.

Here is another resource that shows how to create and use command based programs with examples.

https://www.frczero.org/programming/command-based-programming/

1 Like

The information here is…not correct.

A command is a file that contains a set of instructions that can be called by the scheduler.

A command isn’t a file, for starters.

I’m pretty sure this was written by GPT.

1 Like

Don’t use this. It really doesn’t give good advice, or modern solutions.

If you don’t know what command-based is, then this is a great resource.

Then once you have an understanding (with pictures!) of command-based, then the FRC docs linked above that talk about command compositions will hopefully make some sense.

3 Likes

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