> there is a problem if the found tags are a valid one plus an invalid tag, so eg it sees a tag but finds noise on the wall, and so lists tags 2 and 15. Lines 90-99 will ignore tag 15, and put 4 corners into the list. It will get past the test on line 100 (there are 4 corners). BUT then at line 106, there are 2 entries in visTags, so it will go to the "else" and try to use solvePNP_SQPNP().
- `PNPResults` can now be empty (`isPresent` = false)
- solvePNP methods actually handle errors and return empty `PNPResults`
- This reveals an odd error where some inputs to `solvePNP_SQUARE()` resulted in an estimated transform with NaN values, and attempts to handle it
- Overwrites java changes from #817 since #742 had duplicate fixes
- Minor bugfixes
This reverts commit 013ff5e, which caused crashes with libcamera cameras.
More testing required to root-cause and fix this PR, but rolling back for testing for now.
### What does this do?
- Deprecates previous sim classes
- Has a `CameraProperties` class for describing a camera's basic/calibration info, and performance values for simulation. Calibration values can be loaded from the `config.json` in the settings exported by photonvision.
- `OpenCVHelp` provides convenience functions for using opencv methods with wpilib/photonvision classes, mainly to project 3d points to a camera's 2d image and perform solvePnP with the above camera calibration info.
- `TargetModel`s describe the 3d shape of a target, both for projecting into the camera's 2d image and use in solvePnP.
- `PhotonCameraSim` uses camera properties to simulate how 3d targets would appear in its view, and has simulated noise, latency, and FPS. For apriltags, the best/alternate camera-to-target transform is also estimated with solvePnP.
- `VideoSimUtil` has helper functions for drawing apriltags to a simulated raw and processed MJPEG stream for each camera using the projected tag corners.
- `VisionSystemSim` stores `VisionTargetSim`s and `PhotonCameraSim`s, and is periodically updated with the robot's simulated pose. When updating, camera sims are automatically processed and published with their visible targets from their respective poses with proper latency.
### What's still not working?
- Mac Arm builds are broken
- More examples
- Update website/docs
This adds a regex that ignores cameras if they match it, for if you have another piece of software running that needs a second camera, or if you have a webcam in your laptop that cscore hates.
- Made alternate constructor for ```PhotonPoseEstimator``` that doesn't need ```PhotonCamera```
- Changed ```update``` function to take in missing cameraMatrixData and coeffsData that were previously received from PhotonCamera.
- Changed the internal ```update``` and ```multiTagPNP``` function to take in cameraMatrixData & coeffsData
- If not needed for the specified strategy then the parameters are simply not used. Also if PhotonCamera is used in constructor it instead backs up to that.
Co-authored-by: Matt <matthew.morley.ca@gmail.com>
* Add pose caching to Java
* Refactor strategy fallthrough
* Hopefully add pose caching to C++
* Make Java switch same order as enum and C++ switch
* C++ absolute value in timestamp check
* Fix Java NPE
* Use `units::second_t` in timestamp
Co-authored-by: Matt <matthew.morley.ca@gmail.com>
* Expand Java unit test
* Copy comments into C++
* Add tests to C++
* Run format
* Update PhotonCamera.cpp
* Probably fix bad access exception
* a
* init timestamp
* Remove prints
---------
Co-authored-by: Matt <matthew.morley.ca@gmail.com>
Co-authored-by: Joseph Eng <joseng2358@gmail.com>
There are a few references to PhotonPipelineResult in this header. I noticed this was being indirectly included when trying to remove the PhotonCamera dependency.
Allows teams with a mechanism that moves the camera's position (eg, a pan and tilt mechanism) to update the location of their camera for their pose calculations.
---------
Co-authored-by: Matthew Morley <matthew.morley.ca@gmail.com>
* update documentation
* add suggested changes
* rename April Tag to AprilTag
* Update RobotPoseEstimator.java
Co-authored-by: Mohammad Durrani <46766905+mdurrani808@users.noreply.github.com>
* Use List for RobotPoseEstimator constructor
* Update `RobotPoseEstimator` constructor to accept wpilib `AprilTagFieldLayout` java
* Initial cpp changes
* Java return optional from update
* Fix java test
* Clean up strategy switch
* small lint
* Actually link to vision_shared
* Fix auto optimized imports
* format
* report error
* small method changes
* format and clean up
Co-authored-by: Matt <matthew.morley.ca@gmail.com>
RobotPoseEstimator can pick the most likely pose for the robot given a number of possible poses, using a number of different strategies. Examples are still WIP.