Log in

View Full Version : Command Based Programming


nathanzentner08
17-01-2015, 16:21
Im assuming that the command based programming is more even based programming. Create a command, associate it to a JoystickButton and when the button is clicked, the command is run.

I have put printlns in all methods, and am clicking the joystickbutton but nothing is printing.

I have even ran the start on the command, but it is not getting into the execute, or initialize for that matter.

I have also added it to a group and started the group, but nothing.

Ideas?

AlexBrinister
17-01-2015, 17:44
Could you post your code?

Alex Brinister

BradAMiller
17-01-2015, 17:56
If you wrote the code by hand (rather than RobotBuilder generated) make sure that you are calling Scheduler.run() in the TeleopPeriodic method like this:
public void teleopPeriodic() {
Scheduler.getInstance().run();
}
That's what actually causes the commands to run each iteration.

BLUEBELL
17-01-2015, 19:02
Would I need to do that with the iterative robot code?

Fauge7
17-01-2015, 19:03
stick to command based its much easier to manage.

BLUEBELL
17-01-2015, 19:08
But if I was going to use iterative would I need the Scheduler.getInstance().run();

Ben Wolsieffer
17-01-2015, 19:12
Command based programming is based off of iterative. Instead of putting your code in the xxxPeriodic() methods, you call "Scheduler.getInstance().run();" in them and put your code in commands.

Look at the command based example to see how this is supposed to be done.