Go to Post Mind you... if your ball kicker has as much energy stored up as a trackball launcher, you ought to be able to kick balls up into the stands. - dtengineering [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #9   Spotlight this post!  
Unread 01-31-2016, 09:05 AM
ckirschner ckirschner is offline
Registered User
FRC #0869
 
Join Date: Jan 2016
Location: New Jersey
Posts: 9
ckirschner is an unknown quantity at this point
Re: Using joystick buttons with Command based programming

Quote:
Originally Posted by Guy997 View Post
You might want to have Commandbase.init() in your robotInit.

Like so:
Code:
 public void robotInit() {
		oi = new OI();
        // instantiate the command used for the autonomous period
        CommandBase.init();
That's a snippet from our code.

I'm not positive that's the issue, but it might be a problem.


Quote:
Originally Posted by MaGiC_PiKaChU View Post
in robotInit, you have to initialise your subsystems before your OI. Else you will try to build commands that use methods from non-existing subsystems

Okay that makes sense then. I will check that out today. However one question I have about that (I apologize I'm not actually a programmer, just appointed to this position as the best candidate to figure out programming the robot )

If you look in my code I created the driveTrain class in the Robot class but not in robotInit and the drive train works. So is that sufficient? And if so, or if not, what exactly is robotInit doing that the declaration inside the Robot class isn't?

Code:
public class Robot extends IterativeRobot {

	public static final ExampleSubsystem exampleSubsystem = new ExampleSubsystem();
	public static final driveTrain DriveTrain = new driveTrain();
	public static final driveWithJoysticks driveWithJoysticks = new driveWithJoysticks();
	public static final camera cameraSystem = new camera();
	
	
	public static OI oi;

    Command autonomousCommand;
    SendableChooser chooser;

    /**
     * This function is run when the robot is first started up and should be
     * used for any initialization code.
     */
    public void robotInit() {
		oi = new OI();
        //chooser = new SendableChooser();
        //chooser.addDefault("Default Auto", new ExampleCommand());
//        chooser.addObject("My Auto", new MyAutoCommand());
        //SmartDashboard.putData("Auto mode", chooser);
    }
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 08:25 AM.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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