mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-22 01:11:40 +00:00
better csv parsing with errors
This commit is contained in:
@@ -187,20 +187,23 @@ public class RequestHandler {
|
||||
public static void onPnpModel(Context ctx) throws JsonProcessingException {
|
||||
//noinspection unchecked
|
||||
List<List<Number>> points = kObjectMapper.readValue(ctx.body(), List.class);
|
||||
|
||||
// each entry should be an xy pair
|
||||
var pointsList = new ArrayList<Point3>();
|
||||
for (List<Number> point : points) {
|
||||
double x, y;
|
||||
x = point.get(0).doubleValue();
|
||||
y = point.get(1).doubleValue();
|
||||
var pointToAdd = new Point3(x, y, 0.0);
|
||||
pointsList.add(pointToAdd);
|
||||
}
|
||||
System.out.println(pointsList.toString());
|
||||
if (VisionManager.getCurrentUIVisionProcess().pipelineManager.getCurrentPipeline().settings instanceof StandardCVPipelineSettings) {
|
||||
var settings = (StandardCVPipelineSettings) VisionManager.getCurrentUIVisionProcess().pipelineManager.getCurrentPipeline().settings;
|
||||
settings.targetCornerMat.fromList(pointsList);
|
||||
try {
|
||||
// each entry should be an xy pair
|
||||
var pointsList = new ArrayList<Point3>();
|
||||
for (List<Number> point : points) {
|
||||
double x, y;
|
||||
x = point.get(0).doubleValue();
|
||||
y = point.get(1).doubleValue();
|
||||
var pointToAdd = new Point3(x, y, 0.0);
|
||||
pointsList.add(pointToAdd);
|
||||
}
|
||||
System.out.println(pointsList.toString());
|
||||
if (VisionManager.getCurrentUIVisionProcess().pipelineManager.getCurrentPipeline().settings instanceof StandardCVPipelineSettings) {
|
||||
var settings = (StandardCVPipelineSettings) VisionManager.getCurrentUIVisionProcess().pipelineManager.getCurrentPipeline().settings;
|
||||
settings.targetCornerMat.fromList(pointsList);
|
||||
}
|
||||
} catch (Exception e){
|
||||
ctx.status(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user