Get NetworkTables Working

This commit is contained in:
Abhi Sachi
2023-02-04 15:38:37 -07:00
parent 2a965dedae
commit ab5cb82bc5
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -7,6 +7,11 @@
package frc4388.robot; package frc4388.robot;
import frc4388.robot.subsystems.Vision;
import java.util.Arrays;
import edu.wpi.first.wpilibj.TimedRobot; import edu.wpi.first.wpilibj.TimedRobot;
import edu.wpi.first.wpilibj2.command.Command; import edu.wpi.first.wpilibj2.command.Command;
import edu.wpi.first.wpilibj2.command.CommandScheduler; import edu.wpi.first.wpilibj2.command.CommandScheduler;
@@ -24,7 +29,7 @@ public class Robot extends TimedRobot {
private RobotTime m_robotTime = RobotTime.getInstance(); private RobotTime m_robotTime = RobotTime.getInstance();
private RobotContainer m_robotContainer; private RobotContainer m_robotContainer;
private Vision Vision = new Vision();
/** /**
* This function is run when the robot is first started up and should be * This function is run when the robot is first started up and should be
@@ -35,6 +40,7 @@ public class Robot extends TimedRobot {
// Instantiate our RobotContainer. This will perform all our button bindings, and put our // Instantiate our RobotContainer. This will perform all our button bindings, and put our
// autonomous chooser on the dashboard. // autonomous chooser on the dashboard.
m_robotContainer = new RobotContainer(); m_robotContainer = new RobotContainer();
} }
/** /**
@@ -53,6 +59,7 @@ public class Robot extends TimedRobot {
// and running subsystem periodic() methods. This must be called from the robot's periodic // and running subsystem periodic() methods. This must be called from the robot's periodic
// block in order for anything in the Command-based framework to work. // block in order for anything in the Command-based framework to work.
CommandScheduler.getInstance().run(); CommandScheduler.getInstance().run();
System.out.println(Arrays.toString(Vision.getAprilTags()));
} }
/** /**
@@ -24,7 +24,7 @@ public class Vision {
public AprilTag[] getAprilTags() { public AprilTag[] getAprilTags() {
if (!m_isTags.getBoolean(false)) return new AprilTag[0]; if (!m_isTags.getBoolean(false)) return new AprilTag[0];
double xarr[] = m_xPoses.getDoubleArray(new double[] {}); double xarr[] = m_xPoses.getDoubleArray(new double[] {});
double yarr[] = m_yPoses.getDoubleArray(new double[] {}); double yarr[] = m_yPoses.getDoubleArray(new double[] {});
double zarr[] = m_zPoses.getDoubleArray(new double[] {}); double zarr[] = m_zPoses.getDoubleArray(new double[] {});