Antoine PerreaultE 1b6663c977 Limelight
2024-02-06 19:57:49 -05:00

53 lines
1.6 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;
import frc.robot.LimelightHelpers;
public class Limelight extends SubsystemBase {
/** Creates a new Limelight. */
public Limelight() {
NetworkTable table = NetworkTableInstance.getDefault().getTable("limelight");
NetworkTableInstance.getDefault().getTable("limelight").getEntry("Tv").getDouble(0);
NetworkTableInstance.getDefault().getTable("limelight").getEntry("getpipe").getDouble(1);
NetworkTableInstance.getDefault().getTable("limelight").getEntry("").getDoubleArray(new double[6]);
NetworkTableEntry tx = table.getEntry("tx");
NetworkTableEntry ty = table.getEntry("ty");
NetworkTableEntry ta = table.getEntry("ta");
NetworkTableEntry botpose = table.getEntry("pose");
NetworkTableEntry getpipe = table.getEntry(getName());
double x = tx.getDouble(0.0);
double y = ty.getDouble(0.0);
double area = ta.getDouble(0.0);
double pose = botpose.getDouble(area);
SmartDashboard.putNumber("LimelightX", x);
SmartDashboard.putNumber("LimelightY", y);
SmartDashboard.putNumber("LimelightArea", area);
}
@Override
public void periodic() {
// This method will be called once per scheduler run
}
}