limelight

This commit is contained in:
2026-03-30 05:04:22 +02:00
parent 5c626f33e3
commit f7e88619e9
3 changed files with 64 additions and 32 deletions

View File

@@ -52,7 +52,22 @@ NetworkTable table = NetworkTableInstance.getDefault().getTable("limelight-tag")
}
public double Calcule(double x1, double x2, double y1, double y2, double angle)
{
return Math.atan((x2 - x1) / (y2 - y1)) * (180 / Math.PI) - angle;
if(x1 > x2){
if(y1 > y2){
return Math.atan(90-((x2 - x1) / (y2 - y1))) * (180 / Math.PI) - angle;
}
else{
return Math.atan((x2 - x1) / (y2 - y1)) * (180 / Math.PI)+90 - angle;
}
}
else{
if(y1 > y2){
return Math.atan(90-((x2 - x1) / (y2 - y1)))* (180 / Math.PI)+270 - angle;
}
else{
return Math.atan((x2 - x1) / (y2 - y1)) * (180 / Math.PI)+180 - angle;
}
}
}
@Override
public void periodic() {