2024-02-07 19:37:35 -05:00

57 lines
1.5 KiB
Java

// Copyright (c) FIRST and other WPILib contributors.
// Open Source Software; you can modify and/or share it under the terms of
// the WPILib BSD license file in the root directory of this project.
package frc.robot.subsystem;
import edu.wpi.first.wpilibj.smartdashboard.SmartDashboard;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableEntry;
import edu.wpi.first.networktables.NetworkTableInstance;
import edu.wpi.first.wpilibj2.command.SubsystemBase;
public class Limelight extends SubsystemBase {
NetworkTable table = NetworkTableInstance.getDefault().getTable("limelight");
NetworkTableEntry tx = table.getEntry("tx");
NetworkTableEntry ty = table.getEntry("ty");
NetworkTableEntry ta = table.getEntry("ta");
NetworkTableEntry pipeline = table.getEntry("pipeline");
NetworkTableEntry tv = table.getEntry("tv");
NetworkTableEntry camMode = table.getEntry("camMode");
NetworkTableEntry tid = table.getEntry("tid");
/** Creates a new Limelight. */
public Limelight() {
}
public double getx(){
return tx.getDouble(0);
}
public double gety(){
return ty.getDouble(0);
}
/* public double geta() {
return ta.getDouble(0);
}*/
public boolean getv(){
return tv.getBoolean(false);
}
public void setpipeline(){
pipeline.setNumber(0);
}
public void setcamMode(){
camMode.setNumber(0);
}
public double getTid(){
return tid.getDouble(0);
}
@Override
public void periodic() {
// This method will be called once per scheduler run
}
}