Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   Command Based Programming (http://www.chiefdelphi.com/forums/showthread.php?t=133070)

nathanzentner08 17-01-2015 16:21

Command Based Programming
 
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

Re: Command Based Programming
 
Could you post your code?

Alex Brinister

BradAMiller 17-01-2015 17:56

Re: Command Based Programming
 
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:
Code:

    public void teleopPeriodic() {
        Scheduler.getInstance().run();
    }

That's what actually causes the commands to run each iteration.

BLUEBELL 17-01-2015 19:02

Re: Command Based Programming
 
Would I need to do that with the iterative robot code?

Fauge7 17-01-2015 19:03

Re: Command Based Programming
 
stick to command based its much easier to manage.

BLUEBELL 17-01-2015 19:08

Re: Command Based Programming
 
But if I was going to use iterative would I need the
Code:

Scheduler.getInstance().run();

Ben Wolsieffer 17-01-2015 19:12

Re: Command Based Programming
 
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.


All times are GMT -5. The time now is 03:41.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi