PhotonVision / photonvision

PhotonVision is the free, fast, and easy-to-use computer vision solution for the FIRST Robotics Competition.
https://photonvision.org
GNU General Public License v3.0
264 stars 180 forks source link

Photonlibpy - Best Target Function #1223

Open drvladb opened 6 months ago

drvladb commented 6 months ago

A rather simple getBestTarget() function for a pipeline result.

The idea to use .get(0) comes from the Java version of the library. This implies the assumption that target packets are sent in order.

I do not have access to a robot at the moment (thus it's a draft), but this matches the behavior of the Java client, so I'm confident it should work.

Vlad & the 5113 software team.

drvladb commented 6 months ago

After testing, we have found that Photonvision does not have a particular sort for AprilTags. As such, it isn't clear why getBestTarget in Java uses .get(0) as it isn't be best AprilTag.

I would appreciate some input on the matter.

Vlad

drvladb commented 6 months ago

Additionally, it isn't clear to us whether retroreflective tape is supported in this version of the program.

If it isn't, is it possible to use sort by ambiguity to determine the best AprilTag.

gerth2 commented 6 months ago

Yes, the concept of best target is largely not a thing for apriltags, as false-positives are eliminated by othe means, and multiple valid targets are often in sight at once.

Even though true retro reflective is dead for FRC, there is still some relevance for colored shape or Neural Net pipelines ...

Probably worth test and review this summer, as examples also need updated to be apriltag-first.

gerth2 commented 3 weeks ago

Hey @drvladb FYI - Was doing some cleanup, realized this was still hanging. I'll take a look hopefully later this week again after the serde stuff settles out in python, and will propose a path forward.

It's looking more and more like we won't be robotpy wrappering the C++ vendordep like we'd hoped, which means this PR is very relevant to keep API parity between the languages.

drvladb commented 3 weeks ago

Awesome! I'm a bit out of date in terms of dev, but I'm happy this PR might be useful. It's certainly out of date, but maybe we can make it work.

Vlad