We have a track and search command for our turret to use the limelight to track the target and if it loses the target to swing back and forth until it finds the target.
When we climb we will need to send our turret to 0 position and keep it there.
I currently have track and search set to the default command for our turret subsystem. I am trying to figure out the easiest way to stop this command when we are ready to climb so we can send the turret to position 0 and keep it there… Currently the turret would go into search mode in the hanger zone and start swinging between stops trying to find the target.
I have also considered the fact that we might want the ability to interrupt the default command in a match in case something goes wrong.
Would creating a command to send the turret to position 0 that just returned false (hence never ending). Then mapping that command to a button and using toggle when pressed so that it would start the command on the first press thus interrupting the default command and then if needed on a second button press it would stop the Position 0 command and resume the default command. Would this work… or is there a better way to do this?
Also I would be creating a command just to run a single method in the turret subsystem which is extra code, but I believe that using a Lambda would just run that method and then resume the default command… or am I wrong there?
You can stop the default command by simply scheduling another command that requires the subsystem. The command you schedule need not do anything - it just needs to declare the subsystem as a requirement.
Ok so creating its own command to send turret to 0 and returning false… and calling that is the simplest method… Guess I was overthinking this one thinking there was a better way
You could also write you turret’s default command to handle state changes like this and then have a couple of helper instant commands to update state. Our turret tracking command does this. There’s a trackingOn property of our turret subsystem and the TurretTrack command will only track if that is on…if it is off, the turret goes to zero.