Can't switch between commands that use axis inputs

We are trying to get a motor spinning forward (with the left trigger axis), the same motor spinning reverse (using the right trigger axis), and using a different motor we need to move an arm up/down (using left Y axis).

We have written a commands to spin the first motor and another command to run the arm. Each command works great when they are the default command in the subsystem. I’m assuming the default command doesn’t end so the other command can run. We don’t have the problem switching between commands when using buttons, but can’t get it to work when using axis.

Any help would be appreciated. We are using command based Java.

How are you triggering the commands?

Attached is a snipping of the subsystem and one of the commands.

So the way commands typically work with FRC is the default command is only run when other commands arent being triggered, aka if a command that uses the subsystem isnt being run the subsystem will run whatever its default command is in place of an actual command. Do you have your code in a public repo by any chance so i can take a closer look?

You can combine this into one command. Just add or subtract the axis values and set the motor the result.

That worked! Thank you…still would like to know how to end a command when axis’s like joystick triggers or joystick “thumb” axis are not being used.

1 Like

You could have a button the switches to a command the ignores the axis’s and/or just sets the motor to zero.

Edit: Or a command that does nothing.

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