From 7e65352246515fa4c8d45b9dfd4c21e6103be93c Mon Sep 17 00:00:00 2001 From: OlivierDubois Date: Mon, 28 Oct 2024 19:17:34 -0400 Subject: [PATCH] =?UTF-8?q?limelight=20d=C3=A9but?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/frc/robot/Subsystems/Limelight.java | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/main/java/frc/robot/Subsystems/Limelight.java diff --git a/src/main/java/frc/robot/Subsystems/Limelight.java b/src/main/java/frc/robot/Subsystems/Limelight.java new file mode 100644 index 0000000..afeb914 --- /dev/null +++ b/src/main/java/frc/robot/Subsystems/Limelight.java @@ -0,0 +1,28 @@ +// 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.Subsystems; + +import edu.wpi.first.wpilibj2.command.SubsystemBase; +import edu.wpi.first.networktables.NetworkTable; +import edu.wpi.first.networktables.NetworkTableEntry; +import edu.wpi.first.networktables.NetworkTableInstance; +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"); + +//read values periodically +double x = tx.getDouble(0.0); +double y = ty.getDouble(0.0); +double area = ta.getDouble(0.0); + /** Creates a new Limelight. */ + public Limelight() {} + + @Override + public void periodic() { + // This method will be called once per scheduler run + } +}