public ControlMethodSelector() {
   controlMethod = new SendableChooser();
   controlMethod.addDefault("Tank Control", tankControl);
   controlMethod.addObject("Stick Control", stickControl);
   controlMethod.addObject("Clayton Control", claytonControl);
   SmartDashboard.putData("Control method", controlMethod);
 }
示例#2
0
  /**
   * This function is run when the robot is first started up and should be used for any
   * initialization code.
   */
  public void robotInit() {
    chooser = new SendableChooser();
    chooser.addDefault("Default Auto", defaultAuto);
    chooser.addObject("My Auto", customAuto);
    SmartDashboard.putData("Auto choices", chooser);

    controlMethod = new SendableChooser();
    controlMethod.addDefault("Tank Control", tankControl);
    controlMethod.addObject("Stick Control", stickControl);
    controlMethod.addObject("Clayton Control", claytonControl);
    SmartDashboard.putData("Control method", controlMethod);

    rightMotor = new CANTalon(RIGHT_INDEX);
    rightSlave = new CANTalon(RIGHT_INDEX + 1);
    rightSlave.changeControlMode(CANTalon.TalonControlMode.Follower);
    rightSlave.set(RIGHT_INDEX);
    rightMotor.setInverted(true);

    leftMotor = new CANTalon(LEFT_INDEX);
    leftSlave = new CANTalon(LEFT_INDEX + 1);
    leftSlave.changeControlMode(CANTalon.TalonControlMode.Follower);
    leftSlave.set(LEFT_INDEX);

    intakeMotor = new CANTalon(INTAKE_INDEX);
    // Arm motor is currently disabled
    // armMotor = new CANTalon(ARM_INDEX);

    compressor = new Compressor(0);
    compressor.setClosedLoopControl(true);

    intakePneumatic = new DoubleSolenoid(1, 2);
    intakePneumatic.set(DoubleSolenoid.Value.kOff);

    gamepad = new Gamepad(0);
  }
示例#3
0
  public void setupAutonomous() {
    autoChooser = new SendableChooser();
    // autoChooser.addDefault("Default: Drive Into Auto Zone", new AutoCGDriveStraightOneSecond());

    autoChooser.addObject("Strafe Right Into Auto Zone", new AutoCGStrafeRight());
    autoChooser.addObject("Strafe Left Into Auto Zone", new AutoCGStrafeLeft());
    autoChooser.addDefault("Push Tote Forward", new AutoCGToteSetDriveForwardHook());
    autoChooser.addObject("Lowers Arm - Does NOT move", new AutoCGDoNothing());
    autoChooser.addObject("Picks Up Container And Drives Backwards", new AutoCGContainerPickup());
    autoChooser.addObject("Picks Up Container And Does Not Drive", new AutoCGPickUpContainer());
    SmartDashboard.putData("Autonomous Mode Chooser", autoChooser);
  }
  public void readScripts() {
    try {
      reader = new BufferedReader(new FileReader(filename));

      String line;
      String scriptName = null;
      int comma1, comma2;
      while ((line = reader.readLine()) != null) {
        //                System.out.println(line);
        if (line.toUpperCase().startsWith("SCRIPT_NAME,")) {
          comma1 = line.indexOf(",");
          comma2 = line.substring(comma1 + 1).indexOf(",") + comma1 + 1;
          scriptName = line.substring(comma1 + 1, comma2).toUpperCase().trim();
          System.out.println("Found Script: " + scriptName);
          autoChooser.addObject(scriptName, scriptName);
        } else if (line.toUpperCase().startsWith("END_OF_SPREAD_SHEET,")) {
          //                        System.out.println("End of Spreadsheet");
          break;
        }
      }
      SmartDashboard.putData("Autonomous mode", autoChooser);

    } catch (IOException ex) {
      ex.printStackTrace();
    } finally {
      try {
        reader.close();
      } catch (IOException ex) {
        ex.printStackTrace();
      }
      currentCommandGroup = null;
    }
    currentCommandGroup = null;
  }
示例#5
0
  /**
   * This function is run when the robot is first started up and should be used for any
   * initialization code.
   */
  public void robotInit() {
    RobotMap.init();

    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS
    chassisrotate = new Chassisrotate();
    vision = new Vision();
    chassis = new Chassis();
    elevator = new Elevator();
    shooter = new Shooter();
    pickupBelt = new PickupBelt();
    pickupShaft = new PickupShaft();
    climber = new Climber();
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=CONSTRUCTORS

    autoChooser = new SendableChooser();
    autoChooser.addDefault("Autonomous Position 1", new AutonomousCommand1());
    autoChooser.addObject("Autonomous Position 2", new AutonomousCommand2());
    SmartDashboard.putData("Autonomous Mode Chooser", autoChooser);

    // This MUST be here. If the OI creates Commands (which it very likely
    // will), constructing it during the construction of CommandBase (from
    // which commands extend), subsystems are not guaranteed to be
    // yet. Thus, their requires() statements may grab null pointers. Bad
    // news. Don't move it.
    oi = new OI();

    SmartDashboard.putData(Robot.chassis);

    // instantiate the command used for the autonomous period
    // BEGIN AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
    autonomousCommand = new AutonomousCommand1();
    // END AUTOGENERATED CODE, SOURCE=ROBOTBUILDER ID=AUTONOMOUS
  }
示例#6
0
  /**
   * This function is run when the robot is first started up and should be used for any
   * initialization code.
   */
  public void robotInit() {
    // SmartDashboard stuff
    chooser = new SendableChooser();
    chooser.addObject("Touch", touch);
    chooser.addObject("Lowbar Cross", lowBarCross);
    chooser.addObject("Rockwall Cross", rockWallCross);
    chooser.addObject("Rough Terrain Cross", roughTerrainCross);
    SmartDashboard.putData("Auto Choices", chooser);

    // Initializes joysticks
    joystickLeft = new Joystick(0);
    joystickRight = new Joystick(1);
    joystickShooting = new Joystick(2);

    // Duel camera class
    cameraFeeds = new CameraFeeds(joystickShooting);

    // Sets up classes
    tankDrive = new Drive(joystickLeft, joystickRight);
    driveShift = new Shifting(joystickShooting);
    shooter = new Shooter(joystickShooting);
    arm = new Arm(joystickShooting);
  }
示例#7
0
 /**
  * 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("Auto1RightLow", new Auto1RightLow()); /*-Default-*/
   chooser.addObject("Auto1RightHigh", new Auto1RightHigh());
   chooser.addObject("Auto2RightLow", new Auto2RightLow());
   chooser.addObject("Auto3MidHigh", new Auto3MidHigh());
   chooser.addObject("Auto4MidHigh", new Auto4MidHigh());
   chooser.addObject("Auto5LeftLow", new Auto5LeftLow());
   chooser.addObject("Auto5MidHigh", new Auto5MidHigh());
   chooser.addObject("AutoCross", new AutoCross());
   chooser.addObject("AutoGenericRightLow", new AutoGenericRightLow());
   chooser.addObject("AutoGenericLeftLow", new AutoGenericLeftLow());
   //      chooser.addObject("My Auto", new MyAutoCommand());
   SmartDashboard.putData("Auto mode", chooser);
   CameraServer.getInstance().startAutomaticCapture("cam2");
 }
  private IRIAutonChooser() {

    start = new SendableChooser();
    start.addObject("Low Bar (1)", Start.POS_1);
    start.addObject("Position 2", Start.POS_2);
    start.addDefault("Position 3", Start.POS_3);
    start.addObject("Position 4", Start.POS_4);
    start.addObject("Secret Passage (5)", Start.POS_5);

    cross = new SendableChooser();
    cross.addObject("A: Cheval De Frise (Left Return)", Cross.CHEVAL_DE_FRISE_A);
    cross.addObject("A: Cheval De Frise (Right Return)", Cross.CHEVAL_DE_FRISE_B);
    cross.addObject("B: Moat", Cross.MOAT);
    cross.addObject("B: Ramparts", Cross.RAMPARTS);
    cross.addObject("D: Rock Wall", Cross.ROCK_WALL);
    cross.addDefault("D: Rough Terrain", Cross.ROUGH_TERRAIN);
    cross.addObject("Low Bar", Cross.LOW_BAR);

    chevalReturn = new SendableChooser();
    chevalReturn.addObject("Low Bar", Cross.LOW_BAR);
    chevalReturn.addObject("B: Moat", Cross.MOAT);
    chevalReturn.addObject("B: Ramparts", Cross.RAMPARTS);
    chevalReturn.addObject("C: Sally Port", Cross.SALLY_PORT);
    chevalReturn.addObject("C: Drawbridge", Cross.DRAWBRIDGE);
    chevalReturn.addObject("D: Rock Wall", Cross.ROCK_WALL);
    chevalReturn.addDefault("D: Rough Terrain", Cross.ROUGH_TERRAIN);

    post = new SendableChooser();
    post.addDefault("Straighten", Post.STRAIGHTEN);
    post.addObject("Go Back", Post.GO_BACK);
    post.addObject("Attempt Two Ball", Post.TWO_BALL);
  }
示例#9
0
  // * This function is run when the robot is first started up and should be
  // * used for any initialization code.
  // *
  public void robotInit() {
    // Initialize all subsystems.
    pdp = new PDP();
    drivetrain = new Drivetrain();
    elevator = new Elevator();
    toteContact = new ToteContactSensor();
    lights = new FunLights();
    vl = new VisionLights();

    camera = new Camera();
    new Thread(camera).start();

    oi = new OI();

    autonomousChooser.addDefault("No Autonomous", new AutonomousNone());
    autonomousChooser.addObject("Left Yellow Tote", new AutonomousLeft());
    autonomousChooser.addObject("Pull Bins Down", new AutoDriveNoLift());

    SmartDashboard.putData("Autonomous Mode", autonomousChooser);

    ledChooser.addObject("Off", new SetLEDColors(0));
    ledChooser.addObject("White", new SetLEDColors(1));
    ledChooser.addObject("Red", new SetLEDColors(2));
    ledChooser.addObject("Blue", new SetLEDColors(3));
    ledChooser.addDefault("Green", new SetLEDColors(4));
    ledChooser.addObject("Yellow", new SetLEDColors(5));
    ledChooser.addObject("Cyan", new SetLEDColors(6));
    ledChooser.addObject("Magenta", new SetLEDColors(7));
    ledChooser.addObject("Elevator", null);

    SmartDashboard.putData("LED Color", ledChooser);

    vlChooser.addDefault("Cam LEDs Off", new SetVisionLights(0));
    vlChooser.addObject("Cam LEDs On", new SetVisionLights(1));

    SmartDashboard.putData("Vision Lights", vlChooser);

    // Show what command the subsystem is running on the SmartDashboard.
    SmartDashboard.putData(drivetrain);
    SmartDashboard.putData(elevator);
    SmartDashboard.putData(toteContact);
    SmartDashboard.putData(lights);
  }
示例#10
0
 private void setupChooser() {
   SmartDashboard.putNumber("Left-Distance", DriveToAutoZone.left);
   SmartDashboard.putNumber("Other-Distance", DriveToAutoZone.notLeft);
   chooser2 = new SendableChooser();
   chooser2.addObject("Left", location.left);
   chooser2.addObject("Right", location.right);
   chooser2.addObject("Center", location.center);
   SmartDashboard.putData("Chooser2", chooser2);
   chooser = new SendableChooser();
   chooser.addObject("Triple Play", new AutoTriplePlay());
   // chooser.addObject("Deliver Coop Crate", new AutoDeliverCoopCrate());
   chooser.addObject("Bring Crate", new AutoBringCrate());
   chooser.addObject("Bring Bin", new AutoBringBin());
   chooser.addObject("Bring Both", new AutoBringBoth());
   chooser.addObject("Drive To Auto Zone", new AutoDriveToAutoZone());
   chooser.addObject("Dance", new AutoDance());
   chooser.addObject("Stack Totes", new AutoStackLandfill());
   chooser.addObject("Get Bin (from landfill)", new AutoGetBin());
   Robot.print("setting up chooser...");
   SmartDashboard.putData("Chooser", chooser);
 }