Can someone explain to me how i program my limelight to interact with my launcher and drive train? Sorry i don’t know what i’m talking about. I’ll post my code that i have so far down below.
/----------------------------------------------------------------------------/
/* Copyright © 2018-2019 FIRST. All Rights Reserved. */
/* Open Source Software - may be modified and shared by FRC teams. The code */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project. */
/----------------------------------------------------------------------------/
package frc.robot.Sensors;
import edu.wpi.first.networktables.NetworkTable;
import edu.wpi.first.networktables.NetworkTableInstance;
/**
- Add your docs here.
*/
public class Limelight implements INetworkTablesTrackingCamera {
private final NetworkTable table;
public Limelight() {
table = NetworkTableInstance.getDefault().getTable("limelight");
}
public double getX() {
return table.getEntry("tx").getDouble(0);
}
public double getY() {
return table.getEntry("ty").getDouble(0);
}
public boolean isValid() {
return table.getEntry("tv").getDouble(0) == 1;
}
public void setDriverMode(boolean driverMode) {
if (driverMode) {
table.getEntry("camMode").setDouble(1.0);
} else {
table.getEntry("camMode").setDouble(0.0);
}
}
public void setPipeline(int pipeline) {
table.getEntry("pipeline").setDouble(pipeline);
}
}