Hey guy Plz test my code to see if it works. plz give me simple feedback(if possible) of what I can fix or how to make my better. I am new to programming vision subsystem code so all help is appreciated.
package frc.robot.subsystems;
import edu.wpi.first.wpilibj.command.Subsystem;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableInstance;
public class VisionSubsystem extends Subsystem {
NetworkTable nTable;
private double yaw;
private double pitch;
private double area;
private boolean is_valid;
public VisionSubsystem(){
nTable=NetworkTableInstance.getDefault().getTable("chameleon-vision").getSubTable("USB Camera-B4.09.24.1");
yaw = nTable.getEntry("yaw").getDouble(0);
pitch = nTable.getEntry("pitch").getDouble(0);
area = nTable.getEntry("area").getDouble(0);
is_valid = nTable.getEntry("is_valid").getBoolean(false);
}
public void initDefaultCommand() {
setDefaultCommand(new MySpecialCommand());
}
public void periodic() {
System.out.println(yaw);
}
public double getYaw(){
yaw = nTable.getEntry("yaw").getDouble(0);
return yaw;
}
public double getPitch(){
pitch = nTable.getEntry("pitch").getDouble(0);
return pitch;
}
public double getArea(){
area = nTable.getEntry("area").getDouble(0);
return area;
}
public boolean isValid(){
is_valid = nTable.getEntry("is_valid").getBoolean(false);
return is_valid;
}
}