Exemplo n.º 1
0
  public void testValue() {
    if (oi.getLJoystick().getTrigger()) {

      boolean distcheck = NetworkTable.getTable("camera").containsKey("distance");
      NetworkTable.getTable("rob").putNumber("x", 8008135);
      System.out.println(distcheck);
      if (distcheck) {
        distance = NetworkTable.getTable("camera").getNumber("distance");
      }
      System.out.println("Distance:" + " " + distance);
    }
  }
Exemplo n.º 2
0
  protected void initialize() {
    System.out.println("Target sorting initialized.");
    System.out.println("Initiating sort");
    OI.getMdu().update();
    validTargets = 0;

    for (int i = 1; i <= 4; i++) {

      X_values[(i - 1)] = MetaTCPVariables.dataMessage[((i * 2) - 1)];
    }

    for (int i = 1; i <= 4; i++) {

      Y_values[(i - 1)] = MetaTCPVariables.dataMessage[(i * 2)];
    }

    if ((X_values[0] > 0) || (Y_values[0] > 0)) {

      targetArray[validTargets][0] = truncate(X_values[validTargets]);
      targetArray[validTargets][1] = truncate(Y_values[validTargets]);
      validTargets++;
    }
    if ((X_values[1] > 0) || (Y_values[1] > 0)) {

      targetArray[validTargets][0] = truncate(X_values[validTargets]);
      targetArray[validTargets][1] = truncate(Y_values[validTargets]);
      validTargets++;
    }
    if ((X_values[2] > 0) || (Y_values[2] > 0)) {

      targetArray[validTargets][0] = truncate(X_values[validTargets]);
      targetArray[validTargets][1] = truncate(Y_values[validTargets]);
      validTargets++;
    }
    if ((X_values[3] > 0) || (Y_values[3] > 0)) {

      targetArray[validTargets][0] = truncate(X_values[validTargets]);
      targetArray[validTargets][1] = truncate(Y_values[validTargets]);
      validTargets++;
    }

    if (MetaTCPVariables.dataMessage[0] < 5300)
      RobotMap.range = truncate(MetaTCPVariables.dataMessage[0]);
    else RobotMap.range = 0;

    sortTargets();
  }
Exemplo n.º 3
0
 // Called repeatedly when this Command is scheduled to run
 protected void execute() {
   m_shooter.buttons(OI.getInstance().getJoystickButton23().get());
   m_shooter.shoot();
 }