mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-20 00:51:41 +00:00
changed all double and int data type to Number
added pipeline change handle in ui
This commit is contained in:
@@ -1,24 +1,27 @@
|
||||
package com.chameleonvision.util;
|
||||
|
||||
import java.lang.Math;
|
||||
|
||||
import edu.wpi.first.wpiutil.math.Num;
|
||||
import org.apache.commons.math3.util.FastMath;
|
||||
|
||||
public class MathHandler {
|
||||
MathHandler() {}
|
||||
|
||||
public static double sigmoid(double x){
|
||||
public static double sigmoid(Number x){
|
||||
double bias = 0;
|
||||
double a = 5;
|
||||
double b = -0.05;
|
||||
double k = 200;
|
||||
|
||||
if (x < 50){
|
||||
if (x.doubleValue() < 50){
|
||||
bias = -1.338;
|
||||
}
|
||||
|
||||
return ((k / (1 + Math.pow(Math.E,(a + (b * x))))) + bias);
|
||||
return ((k / (1 + Math.pow(Math.E,(a + (b * x.doubleValue()))))) + bias);
|
||||
}
|
||||
public static double toSlope(double angle){
|
||||
return FastMath.atan(FastMath.toRadians(angle - 90));
|
||||
|
||||
public static double toSlope(Number angle){
|
||||
return FastMath.atan(FastMath.toRadians(angle.doubleValue() - 90));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user