changed all double and int data type to Number

added pipeline change handle in ui
This commit is contained in:
ori agranat
2019-10-14 23:35:29 +03:00
parent 221c1b7bfd
commit 91a1338022
6 changed files with 36 additions and 20 deletions

View File

@@ -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));
}
}