getValue is undefined for limelight

public boolean isTarget(){
return getValue(“tv”).getDouble(0.0) == 1;
}

public double getTx(){
  return getValue("tx").getDouble(0.0);
}

public double getTy(){
  return getValue("ty").getDouble(0.0);
}

public double getTa(){
  return getValue("ty").getDouble(0.0);
}

public void setLedMode(int ledMode){
  getValue("ledMode").setNumber(ledMode);
}

public void setCameraMode(int cameraMode) {
  getValue("camMode").setNumber(cameraMode);
}

public void setPipeline(int number) {
  getValue("pipeline").setNumber(number);
}

for some reason my code gives errors to “giveValue” can someone explain to me what is the problem here

You need to get the values from the network table

  /*
   * Vertical Offset From Crosshair To Target (-20.5 degrees to 20.5 degrees)
   */
  public double getVerticalTargetOffset() {
    return NetworkTableInstance.getDefault().getTable("limelight").getEntry("ty").getDouble(0.0);
  }

  /*
   * Horizontal Offset From Crosshair To Target (-27 degrees to 27 degrees)
   */
  public double getHorizontalTargetOffset() {
    return NetworkTableInstance.getDefault().getTable("limelight").getEntry("tx").getDouble(0.0);
  }

  /*
   * Whether the limelight has any valid targets (0 or 1)
   */
  public boolean hasValidTarget() {
    return NetworkTableInstance.getDefault().getTable("limelight").getEntry("tv").getDouble(0.0) > 0;
  }

  /*
   * Target Area (0% of image to 100% of image)
   */
  public double getTargetArea() {
    return NetworkTableInstance.getDefault().getTable("limelight").getEntry("ta").getDouble(0.0);
  }
1 Like