public Boolean getBoolean(String key) {
   try {
     return Boolean.valueOf(SmartDashboard.getBoolean(key));
   } catch (TableKeyNotDefinedException e) {
     return null;
   }
 }
  // Called repeatedly when this Command is scheduled to run
  protected void execute() {
    try {
      cameraFunctioning = SmartDashboard.getBoolean("CameraFunctioning");
    } catch (Exception e) {

    }
  }
  public void update(GoalAlign alignment) {
    double shooterPower;
    if (SmartDashboard.getBoolean("Flywheel Testing Mode") == false) {
      shooterPower = 1;
    } else {
      shooterPower = SmartDashboard.getNumber("Flywheel Testing Power");
    }
    if (gamePad.buttons.BUTTON_A.isOn()) {
      // shoot(DistanceSensorData);
      // shooter.getMotor().getSpark().set(1);
      // shooter.shoot(100);s
      // shooter.setPower(getPowerFromDistance(alignment.imageHeight, alignment.centerY,
      // alignment.height));
      shooter.setPower(shooterPower);

    } else if (!gamePad.buttons.BUTTON_A.isOn()) {
      shooter.setPower(0);
    }

    SmartDashboard.putBoolean("Shooting", gamePad.buttons.BUTTON_A.isOn());
  }
 public AutoState getState(IRobot robot) {
   int chooser = (int) SmartDashboard.getNumber("Autonomous", 1);
   boolean backwards = SmartDashboard.getBoolean("Autonomous Backwards", false);
   AutoState chain = new NothingAutonomous();
   switch (chooser) {
       // TODO: Refine and test the state chains.
     case 1:
       if (backwards) {
         chain
             .addNext(new ForwardAutonomous(1000, -speed))
             .addNext(new AngleAutonomous(180.0, 0.0, robot.getSensorData().getGyro()));
       } else {
         chain.addNext(new ForwardAutonomous(1000, speed));
       }
       // FieldPosition.Left
       chain
           .addNext(new AngleAutonomous(90.0, 0.0, robot.getSensorData().getGyro()))
           // TODO: Determine if positive means clockwise.
           .addNext(null);
       // TODO: Replace with an Autonomous that drives forward until it reaches the goal.
     case 2:
       if (backwards) {
         chain
             .addNext(new ForwardAutonomous(1000, -speed))
             .addNext(new AngleAutonomous(180.0, 0.0, robot.getSensorData().getGyro()));
       } else {
         chain.addNext(new ForwardAutonomous(1000, speed));
       }
       // FieldPosition.Left
       chain
           .addNext(new AngleAutonomous(90.0, 0.0, robot.getSensorData().getGyro()))
           .addNext(null);
     case 3:
       if (backwards) {
         chain
             .addNext(new ForwardAutonomous(1000, -speed))
             .addNext(new AngleAutonomous(180.0, 0.0, robot.getSensorData().getGyro()));
       } else {
         chain.addNext(new ForwardAutonomous(1000, speed));
       }
       // FieldPosition.Left
       chain
           .addNext(new AngleAutonomous(90.0, 0.0, robot.getSensorData().getGyro()))
           .addNext(null);
     case 4:
       // This is right in front of the tower. What is our procedure for this?
       if (backwards) {
         chain
             .addNext(new ForwardAutonomous(1000, -speed))
             .addNext(new AngleAutonomous(180.0, 0.0, robot.getSensorData().getGyro()));
       } else {
         chain.addNext(new ForwardAutonomous(1000, speed));
       }
       // FieldPosition.Right
       chain
           .addNext(new AngleAutonomous(-90.0, 0.0, robot.getSensorData().getGyro()))
           .addNext(null);
     case 5:
       if (backwards) {
         chain
             .addNext(new ForwardAutonomous(1000, -speed))
             .addNext(new AngleAutonomous(180.0, 0.0, robot.getSensorData().getGyro()));
       } else {
         chain.addNext(new ForwardAutonomous(1000, speed));
       }
       // FieldPosition.Right
       chain
           .addNext(new AngleAutonomous(-90.0, 0.0, robot.getSensorData().getGyro()))
           .addNext(null);
     default:
       // Just nothing
   }
   return chain;
 }
Exemplo n.º 5
0
 // returns a boolean at the position of the key
 public boolean getBoolean(String key) {
   return board.getBoolean(key);
 }