Programming help

Hi, our programming team is trying to run a motor for 1 second when a command is finished, we suppose that the code has to be wrote in the end function of the command.

Thanks…

Could you elaborate any more? Any code we can see? But yes. If you want to do something at the end of a command, you would put it at the end of the command.

The end function is good when you need to run code the takes no time at all. However, you want to run more code over a period of time, so I recommend creating another command and either scheduling it in the end function or scheduling your base command with andThen(otherCommand).

1 Like

Depending on the circumstances of use, a ParallelRaceGroup could be used, composing a WaitCommand and the command the OP desires to run for a given duration. This group could run from a SequentialCommandGroup including your first command and the racegroup to run your motor or could be scheduled in the end() method of your first command.

1 Like

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