Skip to content

Commit ee1fc80

Browse files
committed
read correct file for LinearInterpolation
1 parent 268ad0c commit ee1fc80

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/main/java/frc/robot/lib/LinearInterpolation.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,16 @@
33
import java.io.FileNotFoundException;
44
import java.io.FileReader;
55
import java.io.IOException;
6+
import java.nio.file.Paths;
67
import java.util.Arrays;
78
import java.util.List;
89

910
import org.apache.commons.csv.CSVFormat;
1011
import org.apache.commons.csv.CSVParser;
1112
import org.apache.commons.csv.CSVRecord;
1213

14+
import edu.wpi.first.wpilibj.Filesystem;
15+
1316
public class LinearInterpolation {
1417
public double[] xs, ys;
1518
public double[] slopes, intercepts;
@@ -19,7 +22,7 @@ public class LinearInterpolation {
1922
// Performs linear interpolation for a strictly monotonically increasing function.
2023
public LinearInterpolation(String filename) {
2124
try {
22-
CSVParser csvParser = CSVFormat.DEFAULT.parse(new FileReader(filename));
25+
CSVParser csvParser = CSVFormat.DEFAULT.parse(new FileReader(Filesystem.getDeployDirectory().toPath().resolve(Paths.get(filename)).toFile()));
2326
List<CSVRecord> records = csvParser.getRecords();
2427
numPoints = records.size() - 1; // Subtract 1 because of the labels.
2528
// Set the size of the arrays

0 commit comments

Comments
 (0)