Flash3388 / FlashLib

A robotics development framework
BSD 3-Clause "New" or "Revised" License
10 stars 0 forks source link

Feature/multi target analysis #72

Closed tomtzook closed 2 years ago

tomtzook commented 3 years ago

So far, vision framework has supported only one set of information returned with an Analysis. Although it is possible to utilize it to represent multiple targets, it's not explicitly available. This PR modifies Analysis to explicitly support multiple targets.

Analysis analysis = Analysis.builder()
    .put("some general information", 54)
    .buildTarget()
        .put("distance", 216.54)
        .put("orientation", 34)
        .build()
    .buildTarget()
        .put("distance", 78.2)
        .put("orientation", 11.5)
        .build()
    .build();
void process(Analysis analysis) {
    for (Target target : analysis.getDetectedTargets()) {
        double distance = target.getProperty("distance", double.class);
        double orientation = target.getProperty("orientation", double.class);
        // do something about the target
    }
}