Get data with Java

Step1:

Import networktables library

import edu.wpi.first.wpilibj.networktables.NetworkTable; 

Step2:

Sycavision keeps the values of the detected object in the sycavision tables. Therefore, we access the sycavision tables

public static NetworkTable sycavision = NetworkTable.getTable("sycavision"); 

Step3:

We need to draw our values from sycavision tables. See the Detecting shapes/colors tab for variable names.

double sycavision.getNumber("xloc", 0.0)
double sycavision.getNumber("yloc", 0.0)
double sycavision.getNumber("rloc", 0.0)

Example Code:


package frc.robot;


import edu.wpi.first.wpilibj.networktables.NetworkTable;



public class Robot extends TimedRobot {

  public static NetworkTable sycavision = NetworkTable.getTable("sycavision"); // vision adında table çekilioyr

  @Override
  public void robotInit() {
  }

  @Override
  public void autonomousInit() {

  }

  @Override
  public void autonomousPeriodic() {

  }


  @Override
  public void teleopInit() {
  }


  @Override
  public void teleopPeriodic() {
    double sycavision.getNumber("xloc", 0.0)
    double sycavision.getNumber("yloc", 0.0)
    double sycavision.getNumber("rloc", 0.0)

  }

  @Override
  public void testPeriodic() {
  }
}

Last updated

Was this helpful?