package org.usfirst.frc.team1778.robot;
import Systems.DriveTrain;
import edu.wpi.first.wpilibj.IterativeRobot;
import edu.wpi.first.wpilibj.smartdashboard.SendableChooser;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import org.usfirst.frc.team1778.robot.Controller;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the IterativeRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class Robot extends IterativeRobot {
protected Controller Controller;
final String defaultAuto = "Default";
final String customAuto = "My Auto";
String autoSelected;
SendableChooser chooser;
Controller controller = new Controller();
/**
* This function is run when the robot is first started up and should be
* used for any initialization code.
*/
public void robotInit() {
//This is the driver control class. All buttons an joysticks are here.
Controller = new Controller();
//The Autonomous mode chooser in smart dashboard
chooser = new SendableChooser();
chooser.addDefault("Default Auto", defaultAuto);
chooser.addObject("My Auto", customAuto);
SmartDashboard.putData("Auto choices", chooser);
DriveTrain DriveTrain = new DriveTrain(8,3);
}
/**
* This autonomous (along with the chooser code above) shows how to select between different autonomous modes
* using the dashboard. The sendable chooser code works with the Java SmartDashboard. If you prefer the LabVIEW
* Dashboard, remove all of the chooser code and uncomment the getString line to get the auto name from the text box
* below the Gyro
*
* You can add additional auto modes by adding additional comparisons to the switch structure below with additional strings.
* If using the SendableChooser make sure to add them to the chooser code above as well.
*/
public void autonomousInit() {
autoSelected = (String) chooser.getSelected();
// autoSelected = SmartDashboard.getString("Auto Selector", defaultAuto);
System.out.println("Auto selected: " + autoSelected);
}
public void autonomousPeriodic() {
switch(autoSelected) {
case customAuto:
//Put custom auto code here
break;
case defaultAuto:
default:
//Put default auto code here
break;
}
}
public void teleopInit(){
}
public void teleopPeriodic() {
DriveControl drive = new DriveControl();
// drive command for all controllers
drive.calculateDrive(org.usfirst.frc.team1778.robot.Controller.Driver_Throttle(), org.usfirst.frc.team1778.robot.Controller.Driver_Steering(),
org.usfirst.frc.team1778.robot.Controller.Driver_isQuickTurn(), false);
}
public void testPeriodic() {
}
}