|
Re: Accessing Joystick Axes in Command-Based Robot
OK, I think you're almost there... One more tiny leap.
Try:
Creating a command.
Inside the execute function, get the value from the axis on the joystick.
Link the command you made to a button in the OI class.
If you want to require two buttons be pressed, just have one button kick off the command, then inside the command, check the state of the second button before you affect your outputs (motors/solenoids).
Our team usually creates "driveWithJoystick" commands for all our subsystems. We set these commands as the default commands for the subsystems, so they aren't executed on the press of a button, they are always running. Then we make commands that are more automated/complex. Those get linked to buttons. If the automatic commands aren't working, the option to control things manually is still available.
Command base is different, but I think once you get used to it, you'll like it.
If that's not clear enough, let me know and I'll try to provide some sudo code.
|