View Single Post
  #3   Spotlight this post!  
Unread 03-18-2016, 01:50 PM
RSNovi RSNovi is offline
Registered User
FRC #6081
 
Join Date: Jan 2016
Location: Grass Lake
Posts: 12
RSNovi is an unknown quantity at this point
Re: Access the Auto List on Driver Station in Java

Quote:
Originally Posted by mikets View Post
It doesn't matter. The selection actually sticks meaning even for the next match if you don't select anything else, the previous selection is still in effect until you select something different.
Thank you for sharing your code with me. It is pretty similar to what we have, although yours is more elegant and we put all the code in Robot.java. For some reason we are getting sporadic results. I was thinking that we needed to make sure we toggled the buttons after the robot was connected to the competition system. It was working fine during our normal testing, but something is different when we connect to the competition system. We ended just hard coding the auto choice at our last competition which made it always work, but there were times we needed to change it.

If you get a chance please let me know if you see anything
public void robotInit() {
RobotMap.init();
// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
driveTrain = new DriveTrain();
ballArm = new BallArm();
pneumaticArm = new PneumaticArm();

// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS

autoChooser = new SendableChooser();
autoChooser.addDefault("Do Nothing 15 sec", new DoNothing(15));
autoChooser.addObject("Front of low bar", new AutoFrontOfLowBarGroup());
autoChooser.addObject("BW Front of low bar", new AutoFrontOfLowBarBackwardGroup());
autoChooser.addObject("Drive straight forward", new AutoDriveStraightForwardGroup());
autoChooser.addObject("Turn right in front of low bar", new AutoTurnRightLowBar());
autoChooser.addObject("Custom mode", new AutoCustomGroup());
SmartDashboard.putData("Autonomous mode chooser", autoChooser);


SmartDashboard.putData(Scheduler.getInstance());
RobotMap.pneumaticArmCompressor.setClosedLoopContr ol(true);

//autonomousCommand = new DoNothing();

// OI must be constructed after subsystems. If the OI creates Commands
//(which it very likely will), subsystems are not guaranteed to be
// constructed yet. Thus, their requires() statements may grab null
// pointers. Bad news. Don't move it.
oi = new OI();

// instantiate the command used for the autonomous period

// BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS


// END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
// autonomousCommand = new LookBothWays();

new DisplayDashboard();

}

/**
* This function is called when the disabled button is hit.
* You can use it to reset subsystems before shutting down.
*/
public void disabledInit(){

}

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

public void autonomousInit() {
// schedule the autonomous command (example)
autonomousCommand = (Command) autoChooser.getSelected();
if (autonomousCommand !=null) autonomousCommand.start();
SmartDashboard.putData(Scheduler.getInstance());
}

/**
* This function is called periodically during autonomous
*/
public void autonomousPeriodic()
{
SmartDashboard.putData(Scheduler.getInstance());
Scheduler.getInstance().run();

}
Reply With Quote