Commit Graph

23 Commits

Author SHA1 Message Date
Jochem
cc740c92c9 Added constructor overload to PhotonCameraSim for AprilTagFieldLayout (#1692) 2025-01-08 11:43:46 -07:00
Nolan Brown
b7a2636e97 [photon-lib] Fix sim tag ambiguity (#1653) 2024-12-29 17:43:55 -05:00
Matt
7a4ea3dd56 Assert that version checking won't throw on startup (#1512)
# Overview

Previously if the coproc came up later, getProperty would return the
string literal "null", which made us print the BFW. Add tests to make
sure that we don't do that anymore by rebooting a sim coproc +
robot in a combination of different orders.
2024-11-01 23:50:21 -04:00
Matt
37aaa49b32 Create timesync JNI for testing client (#1433) 2024-10-31 08:27:19 -07:00
Matt
f33218c49c Add message UUID and type names to hash and message defintion (#1409) 2024-09-22 22:27:13 -04:00
Matt
169595e56e Auto-generate packet dataclasses with Jinja (#1374) 2024-08-31 13:44:19 -04:00
Matt
67463a020a Use ReadQueue for PhotonCamera timestamps (#1316)
This removes the extra GetLastChange call to keep everything properly
atomic.

Closes #1303
2024-08-04 14:23:46 -04:00
Matt
1708376df8 Expose object detection class id/conf in photonlib (#1266)
* Implement class id/conf in photonlib

* Maybe fix things

* run lint

* Update Packet.java comments

* Update Packet.java comments again

* Update comments

* oops

* Update packet.py

---------

Co-authored-by: Chris Gerth <gerth2@users.noreply.github.com>
2024-05-10 14:52:16 -04:00
Matt
113951100e Add sequence ID, capture, publish and recieve timestamp to PhotonPipelineResult (#1305)
Closes #1304
2024-05-10 14:04:34 -04:00
amquake
39216db143 [photonlib] Invert simulated target yaw (#1243) 2024-02-18 20:59:54 -05:00
Sriman Achanta
d85bafa0eb fix naming (#1089) 2024-01-04 13:20:29 -05:00
Drew Williams
96de176ba2 Changes sim to use 36h11 tags (#1056)
Fixes #1041

---------

Co-authored-by: Drew Williams <DrewW@iARx.com>
Co-authored-by: Matt <matthew.morley.ca@gmail.com>
2024-01-02 08:09:32 -07:00
Sriman Achanta
5be9b8be2c Add PacketSerde interface and expand PacketUtils for more wpimath classes (#1058)
Follows a similar system to the current Protobuf implementation that helps make code more readable and expandable. Also wraps the NT topic to be more useful. Impl stuff is hidden so it can't be extended. Optimizes AT-specific classes by only serializing data when needed, won't save on size but will on time.

closes #1003
2023-12-24 19:56:08 -05:00
Sriman Achanta
308fd801d4 [photon-targeting][photon-lib] Add tests to the targeting classes and cleanup photon-lib & photon-targeting (#1007)
* Make MultiTagPNPResult and PNPResult singular

* add java tests

* Formatting fixes

* bring in the rest of the little stuff

* final things

* Formatting fixes

* add multisubscriber back

* Formatting fixes

* make comments better about x and y relationship
2023-11-15 18:28:26 -05:00
Matt
524b135142 Fix OpenCV load in simuated robot projects (#1001) 2023-11-05 15:13:00 -08:00
Sriman Achanta
0898dfe2f7 Aruco/Multitag 36h11 support (#981)
- Aruco pipeline now infers tag width from tag family like the AprilTag pipeline
- Removes unused Aruco and 200mm AprilTag models
- `VisionEstimation.estimateCamPosePNP()` now requires a target model instead of assuming 16h5
  - Multitarget pipeline similarly infers target model of tag family now
  - `PhotonPoseEstimator` can have target model set for on-rio multitarget

---------

Co-authored-by: amquake <noleetarrr@gmail.com>
2023-10-29 23:02:16 -04:00
amquake
d61225eba3 [photon-lib] Simulate multitag result (#973) 2023-10-25 18:35:06 -07:00
amquake
5b2be119e7 [photon-lib] Cleanup simulation Rotation3d usage (#982) 2023-10-25 18:19:48 -07:00
Sriman Achanta
63147786b9 Fix MacOS OpenCV library loading and use wpi buildTools versions (#978)
* Bump to beta 2

* Reduce copy paste spam going forwards

* Bump gradle

* oops

* fix gradlew

* update gradle wrapper props

* remove unused imports

* Update node task

* Fix shadowjar

* fix more deps

* ?

* core works

* revert changes to index

* Formatting fixes

* Update config.gradle

* Fix PhotonLib gradle

* fix tests and sim loading native libraries

* re-enable macos build

* fix?

* Update build.gradle

---------

Co-authored-by: Matt <matthew.morley.ca@gmail.com>
2023-10-25 20:27:56 -04:00
Matt
47bd077bbb Run multitag on coprocessor (#816) 2023-10-17 10:20:00 -04:00
amquake
7f283640c4 [photonlib] Simulation Visualization Update (#895) 2023-09-19 19:10:04 -04:00
amquake
816bbca2f1 [photonlib] Simulation robustness (#874)
- `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
2023-07-23 18:32:36 -07:00
amquake
f1cadc1e1e [WIP] Simulation Overhaul (#742)
### 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
2023-06-18 18:54:12 -04:00