mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-21 01:01:41 +00:00
Robot offset point (#98)
* Add offset point calculation in backend * Add pipeline result caching * Add dual offset unit test
This commit is contained in:
@@ -47,4 +47,13 @@ public class MathUtils {
|
||||
public static double nanosToMillis(long nanos) {
|
||||
return nanos / 1000000.0;
|
||||
}
|
||||
|
||||
public static double map(
|
||||
double value, double in_min, double in_max, double out_min, double out_max) {
|
||||
return (value - in_min) * (out_max - out_min) / (in_max - in_min) + out_min;
|
||||
}
|
||||
|
||||
public static int map(int value, int inMin, int inMax, int outMin, int outMax) {
|
||||
return (int) Math.floor(map((double) value, inMin, inMax, outMin, outMax) + 0.5);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user