Java 类edu.wpi.first.wpilibj.tables.TableKeyNotDefinedException 实例源码

项目:Frc2016FirstStronghold    文件:HalDashboard.java   
public static boolean getBoolean(String key, boolean defaultValue)
{
    boolean value;

    try
    {
        value = getBoolean(key);
    }
    catch (TableKeyNotDefinedException e)
    {
        putBoolean(key, defaultValue);
        value = defaultValue;
    }

    return value;
}
项目:Frc2016FirstStronghold    文件:HalDashboard.java   
public static double getNumber(String key, double defaultValue)
{
    double value;

    try
    {
        value = getNumber(key);
    }
    catch (TableKeyNotDefinedException e)
    {
        putNumber(key, defaultValue);
        value = defaultValue;
    }

    return value;
}
项目:Frc2016FirstStronghold    文件:HalDashboard.java   
public static String getString(String key, String defaultValue)
{
    String value;

    try
    {
        value = getString(key);
    }
    catch (TableKeyNotDefinedException e)
    {
        putString(key, defaultValue);
        value = defaultValue;
    }

    return value;
}
项目:NR-2014-CMD    文件:CheckHotGoalCommand.java   
protected void execute() 
{
    try
    {
        if(SmartDashboard.getNumber("isHot") == 1 && (SmartDashboard.getNumber("isVisible") == 1))
        {
            new AutonomousPunchCommand(0).start();
        }
        else
        {
           new AutonomousPunchCommand(4).start();
        }
    }
    catch(TableKeyNotDefinedException t)
    {
        System.err.println("ERROR DURING AUTONOMOUS HOT GOAL CHECK");
        new AutonomousPunchCommand(0).start();
    }
}
项目:Woodchuck-2013    文件:Vision.java   
/**
 * Finds the distance away the goal is from the robot.
 * @return Distance from the goal
 */
public double getDistance()
{
    double distance = 0;

    try
    {
        //distance = table.getNumber("Distance");
    }
    catch (TableKeyNotDefinedException e)
    {
        Logger.log(e);
    }

    return distance;
}
项目:Woodchuck-2013    文件:Vision.java   
/**
 * Find the angle that the robot is from the goal.
 * Zero degrees means the robot is perfectly centered with the goal.
 * @return Angle from the goal
 */
public double getAngle()
{
    double angle = 0;

    try
    {
        //angle = table.getNumber("Angle");
    }
    catch (TableKeyNotDefinedException e)
    {
        Logger.log(e);
    }

    return angle;
}
项目:desiree    文件:Tilter.java   
/**
 * Uses Smart Dashboard to update PID values.
 */
public void updatePID() {
    double pVal;
    double iVal;
    double dVal;
    try {
        pVal = SmartDashboard.getNumber("Tilter P");
        iVal = SmartDashboard.getNumber("Tilter I");
        dVal = SmartDashboard.getNumber("Tilter D");
        controller.setPID(pVal, iVal, dVal);
    } catch (TableKeyNotDefinedException e) {
        SmartDashboard.putNumber("Tilter P", 0.0);
        SmartDashboard.putNumber("Tilter I", 0.0);
        SmartDashboard.putNumber("Tilter D", 0.0);
    }
}
项目:2016-Robot-Final    文件:AimWithVision.java   
protected boolean updateVision() {
boolean reslt = false;
// Get the values we need from current vision results
try {
    final NumberArray targetNum = new NumberArray();
    ntserver.retrieveValue("BLOBS", targetNum);
    if (targetNum.size() > 0) {
    double blobx = targetNum.get(0);
    double bloby = targetNum.get(1);

    // Compute firing angle
    double baseCameraAngle = Robot.arm.getRawEncoder();
    double targetInclineAngle = baseCameraAngle + vFoV * (bloby - ImageH / 2) * ImageH;

    double cameraHeight = CameraPivotHeight + CameraArmLength * Math.sin(Math.toRadians(baseCameraAngle));
    double towerRange = (TargetHeight - cameraHeight) / Math.tan(Math.toRadians(targetInclineAngle));

    double firingAngle = Math.toDegrees(Math.atan(Vfire2 / (G * towerRange) - Math.sqrt(
        Vfire2 * (Vfire2 - 2.0 * G * (TargetHeight - cameraHeight)) / (G * G * towerRange * towerRange)
            - 1)));
    Elevate(firingAngle);

    // Compute turn angle
    double targetTurnAngle = FoV * (blobx - ImageW / 2) * ImageW;
    Turn(targetTurnAngle);

    reslt = true;
    }
} catch (TableKeyNotDefinedException exp) {
}
return reslt;
   }
项目:2016-Robot    文件:AimWithVision.java   
protected boolean updateVision() {
boolean reslt = false;
// Get the values we need from current vision results
try {
    final NumberArray targetNum = new NumberArray();
    ntserver.retrieveValue("BLOBS", targetNum);
    if (targetNum.size() > 0) {
    double blobx = targetNum.get(0);
    double bloby = targetNum.get(1);

    // Compute firing angle
    double baseCameraAngle = Robot.arm.getRawEncoder();
    double targetInclineAngle = baseCameraAngle + vFoV * (bloby - ImageH / 2) * ImageH;

    double cameraHeight = CameraPivotHeight + CameraArmLength * Math.sin(Math.toRadians(baseCameraAngle));
    double towerRange = (TargetHeight - cameraHeight) / Math.tan(Math.toRadians(targetInclineAngle));

    double firingAngle = Math.toDegrees(Math.atan(Vfire2 / (G * towerRange) - Math.sqrt(
        Vfire2 * (Vfire2 - 2.0 * G * (TargetHeight - cameraHeight)) / (G * G * towerRange * towerRange)
            - 1)));
    Elevate(firingAngle);

    // Compute turn angle
    double targetTurnAngle = FoV * (blobx - ImageW / 2) * ImageW;
    Turn(targetTurnAngle);

    reslt = true;
    }
} catch (TableKeyNotDefinedException exp) {
}
return reslt;
   }
项目:FRCStronghold2016    文件:VisionSeek.java   
private void updateCameraError() {
    if (SmartDashboard.getNumber("BLOB_COUNT") > 0) {
        try {
            azSteer = SmartDashboard.getNumber("Az_Steer");
            azSteer += CAMERA_OFFSET;
            targetAngle = azSteer + Robot.sensors.getContinuousAngle();
            gyroSource.setTargetAngle(targetAngle);
        } catch (TableKeyNotDefinedException ex) {
            DriverStation.reportError(ex.getClass().getCanonicalName() + ": " + ex.getMessage() + "\n", true);
            cancel();
        }
    }
}
项目:GRIP    文件:MockNetworkTable.java   
@Override
public Object getValue(String key) throws TableKeyNotDefinedException {
  MockNetworkTable relevant = tableForKey(key);
  String name = realKey(key);
  if (relevant.containsKey(name)) {
    return relevant.entries.get(name);
  } else {
    throw new TableKeyNotDefinedException(key);
  }
}
项目:GRIP    文件:MockNetworkTable.java   
@Override
public Object getValue(String key, Object defaultValue) {
  MockNetworkTable relevant = tableForKey(key);
  String name = realKey(key);
  if (relevant.containsKey(name)) {
    return relevant.entries.getOrDefault(name, defaultValue);
  } else {
    throw new TableKeyNotDefinedException(key);
  }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistance() {
    try {
        double distance = laptop.getNumber("Distance");
        return distance;
    } catch (TableKeyNotDefinedException ex) {
        return -1.;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistanceWall() {

        try {
            double distancewall = laptop.getNumber("DistanceToWall");
            return distancewall;
        } catch (TableKeyNotDefinedException ex) {
            return -1;
        }
    }
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getBlobCount() {
    try {
        double blobcount = laptop.getNumber("BLOB_COUNT");
      //  System.out.println(blobcount);
        return blobcount;
    }
    catch (TableKeyNotDefinedException ex) {
        return -1;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistance() {
    try {
        double distance = laptop.getNumber("Distance");
        return distance;
    } catch (TableKeyNotDefinedException ex) {
        return -1.;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistanceWall() {

        try {
            double distancewall = laptop.getNumber("DistanceToWall");
            return distancewall;
        } catch (TableKeyNotDefinedException ex) {
            return -1;
        }
    }
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getBlobCount() {
    try {
        double blobcount = laptop.getNumber("BLOB_COUNT");
      //  System.out.println(blobcount);
        return blobcount;
    }
    catch (TableKeyNotDefinedException ex) {
        return -1;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistance() {
    try {
        double distance = laptop.getNumber("Distance");
        return distance;
    } catch (TableKeyNotDefinedException ex) {
        return -1.;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistanceWall() {

        try {
            double distancewall = laptop.getNumber("DistanceToWall");
            return distancewall;
        } catch (TableKeyNotDefinedException ex) {
            return -1;
        }
    }
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getBlobCount() {
    try {
        double blobcount = laptop.getNumber("BLOB_COUNT");
      //  System.out.println(blobcount);
        return blobcount;
    }
    catch (TableKeyNotDefinedException ex) {
        return -1;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistance() {
    try {
        double distance = laptop.getNumber("Distance");
        return distance;
    } catch (TableKeyNotDefinedException ex) {
        return -1.;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistanceWall() {

        try {
            double distancewall = laptop.getNumber("DistanceToWall");
            return distancewall;
        } catch (TableKeyNotDefinedException ex) {
            return -1;
        }
    }
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getBlobCount() {
    try {
        double blobcount = laptop.getNumber("BLOB_COUNT");
      //  System.out.println(blobcount);
        return blobcount;
    }
    catch (TableKeyNotDefinedException ex) {
        return -1;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistance() {
    try {
        double distance = laptop.getNumber("Distance");
        return distance;
    } catch (TableKeyNotDefinedException ex) {
        return -1.;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistanceWall() {

        try {
            double distancewall = laptop.getNumber("DistanceToWall");
            return distancewall;
        } catch (TableKeyNotDefinedException ex) {
            return -1;
        }
    }
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getBlobCount() {
    try {
        double blobcount = laptop.getNumber("BLOB_COUNT");
      //  System.out.println(blobcount);
        return blobcount;
    }
    catch (TableKeyNotDefinedException ex) {
        return -1;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistance() {
    try {
        double distance = laptop.getNumber("Distance");
        return distance;
    } catch (TableKeyNotDefinedException ex) {
        return -1.;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistanceWall() {

        try {
            double distancewall = laptop.getNumber("DistanceToWall");
            return distancewall;
        } catch (TableKeyNotDefinedException ex) {
            return -1;
        }
    }
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getBlobCount() {
    try {
        double blobcount = laptop.getNumber("BLOB_COUNT");
      //  System.out.println(blobcount);
        return blobcount;
    }
    catch (TableKeyNotDefinedException ex) {
        return -1;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistance() {
    try {
        double distance = laptop.getNumber("Distance");
        return distance;
    } catch (TableKeyNotDefinedException ex) {
        return -1.;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistanceWall() {

        try {
            double distancewall = laptop.getNumber("DistanceToWall");
            return distancewall;
        } catch (TableKeyNotDefinedException ex) {
            return -1;
        }
    }
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getBlobCount() {
    try {
        double blobcount = laptop.getNumber("BlOB_COUNT");
        return blobcount;
    }
    catch (TableKeyNotDefinedException ex) {
        return -1;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistance() {
    try {
        double distance = laptop.getNumber("Distance");
        return distance;
    } catch (TableKeyNotDefinedException ex) {
        return -1.;
    }

}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistanceWall() {

    try {
        double distancewall = laptop.getNumber("DistanceToWall");
        return distancewall;
    } catch (TableKeyNotDefinedException ex)  {
        return -1;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistance() {
    try {
        double distance = laptop.getNumber("Distance");
        return distance;
    } catch (TableKeyNotDefinedException ex) {
        return -1.;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistanceWall() {

        try {
            double distancewall = laptop.getNumber("DistanceToWall");
            return distancewall;
        } catch (TableKeyNotDefinedException ex) {
            return -1;
        }
    }
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getBlobCount() {
    try {
        double blobcount = laptop.getNumber("BlOB_COUNT");
        return blobcount;
    }
    catch (TableKeyNotDefinedException ex) {
        return -1;
    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistance() {
    try {
        double distance = laptop.getNumber("Distance");
        return distance;
    } catch (TableKeyNotDefinedException ex) {
        return -1.;

    }
}
项目:2014-Krugelfang    文件:Driverstation.java   
public static double getDistanceWall() {
    try {
        double distancewall = laptop.getNumber("DistanceToWall");
        return distancewall;
    } catch (TableKeyNotDefinedException ex) {
        return -1;
    }
}