Commit Graph

145 Commits

Author SHA1 Message Date
Tyler Veness
a161bd5be9 Upgrade all maven dependencies for 2022 (#377)
This also fixes compilation with JDK 17.
2022-01-08 10:17:28 -08:00
Matt
d6e1e28fc2 Add pi version check (#360)
Should prevent GPU acceleration on Pi 4
2021-12-18 13:12:53 -05:00
Chris Gerth
c944967476 Offline Update (.jar replace) (#340)
Allows users to upload a new JAR to a Pi. Also bumps the pi image to increase the heap size.
2021-12-03 23:08:51 -05:00
Matt
a151f23319 Add team number dialog, NT connected chip (#313)
Makes NT connection status visible from the UI
2021-11-25 15:43:29 -05:00
Tyler Veness
5ca39e7f84 Upgrade to Gradle 7.2 and WPILib 2022 (#316) 2021-11-21 20:22:56 -05:00
Chris Gerth
db09e5209f Colored shape fix (#288)
* Move test images out of resources folder

* Limit workers in CI

* Fix image area filtering bug in colored shape

* Add missing picam settings

* Swap to make blank/empty Mat when a picam doesn't supply a color image.

Co-authored-by: Matt <matthew.morley.ca@gmail.com>
2021-09-23 18:48:18 -04:00
Matt
00b8e7d1c5 Add colored shape to the UI (#258)
* Fixup colored shape backend code

* More colored shape stuff

* Start adding shape change to drawing

* Mostly works!

* Add powercell image for shape test mode

* Make super-duper-sure to release stuff

Fixes colored shape leak

* Move approx poly dp into Contour

* Adjust epsilon threshold

* Add dialog to change pipeline type

* Run spotless

* Make yes red :>

* Move "no" button

* Fix duplication/deletion name logic and switching

* Fix compilation errors from rebase

* Update VisionSourceManager.java

* Update type dialog, remove duplicate popup

The dropdown still switches even if the user says "no" tho

Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
2021-09-03 22:20:55 -04:00
Matt
6007cc752d Add libpicam with gain slider bugfix (#278)
* Add libpicam with gain slider bugfix

* Patches to get zero-copy working with Pi3.

-- Success/Failure mistmatch assumptions - lots of functions in the JNI return true on failure (not true on success)
-- isVSCMSupported() is currently implemented to be "isVSCMNotSupported()"

Likely, we'll want at least some .so changes

Co-authored-by: Chris Gerth <chrisgerth010592@gmail.com>
2021-08-31 23:48:11 -04:00
Banks T
129575dd23 Fix Test Mode (#246)
* Fix test mode path and args

* spoooootless

* Fix unit test resources
2021-03-07 21:39:02 -05:00
Declan Freeman-Gleason
ba8d2691fc Add more GPU accel support detection and more libpicam error checks (#257) 2021-03-02 17:49:29 -05:00
Banks T
b0504cbef5 Add VisionModule order determinism (#245)
This makes sure that VisionModules always appear in the same order.
2021-01-29 10:57:18 -08:00
Banks T
58b39f47aa Split photon-server and photon-core (#211)
Uses multiple Gradle projects to support the split.
2021-01-14 18:45:26 -08:00
Declan Freeman-Gleason
3d34d1ca40 Remove 1280x720 on the Pi Camera v1 for now (#228) 2021-01-11 00:35:04 -05:00
Declan Freeman-Gleason
0a4dcd17e0 Set inputShouldShow to false when all websockets disconnect (#224) 2021-01-09 16:35:42 -08:00
Matt
b2d939b3b5 Avoid implicit downcast in corner detection (#219) 2021-01-08 02:42:54 -05:00
Chris Gerth
f7e29a1992 Update which-cam-controls-LEDs logic (#220)
Modified VisionModule.java to cause any camera the either has a vendor-defined FOV or the PiCam quirks to control the LED state.

This is a bit of a patch, and directly assumes that piCam's are the devices primarily used for vision processing.

This fixes a tiny bit of pain experienced with a pi3b + picam v1 + usb Cam where not having the USB cam causes the LED's to be working normally, but plugging in the USB cam causes them to be always off.

Parallel issue entered in documentation to add this to known limitations of photon - if you had a set of all usb cameras, we wouldn't know which one is being used for vision processing, and would not be able to control the LED's accordingly. The ultimate solution is just to have teams control the NT entry themselves, which is easy enough. But, docs shouild be updated to reflect that.
2021-01-07 23:42:05 -08:00
Banks T
08a51fd237 Limit PS3Eye to 100FPS (#218)
This helps prevent running in to USB bandwidth issues with multiple PS3Eyes.
2021-01-06 17:27:01 -05:00
Matt
8e190ce5f7 Save input image before resize or draw (#214) 2021-01-01 15:16:45 -08:00
Matt
f676023a5d Fix multicam and picam acceleration (#205)
Allows pipelines to access quirks
2020-12-31 22:41:57 -08:00
Banks T
d92595f622 Use pipeline members for setPipeParams (#208) 2020-12-31 20:52:34 -08:00
Matt
69142928b3 Only change LED state in the vendor camera vision module (#206) 2020-12-31 20:52:05 -08:00
Matt
28e3b510c7 Remove year from header (#207)
Yeet the year
2020-12-31 19:57:51 -08:00
Matt
fc05bcab2c Add best target raw X/Y position (#198) 2020-12-31 11:33:15 -08:00
Matt
abf5226405 Resize image in driver mode (#197) 2020-12-30 10:41:31 -08:00
Matt
d327428e1b Reduce max snapshots to 12 (#195)
This prevents OOMs on Gloworm, without sacrificing too much accuracy
2020-12-27 20:32:26 -08:00
Matt
79fc194575 Resize image before drawing (#193)
This helps line viability at high divisors
2020-12-27 14:07:53 -08:00
Declan Freeman-Gleason
7a9d999c15 Update libpicam to fix GPU OOM (#196) 2020-12-27 13:54:47 -08:00
Chris Gerth
2cf725876f Add Gloworm Images to Unit Tests for Calibration (#192)
* Incorporated new images from gloworm beta unit from Declan into unit test suite.

* Missed one unit test case - looks like the 1280x720 image set also returns wonky center values.
2020-12-27 10:30:32 -08:00
Declan Freeman-Gleason
2ca879c82d Add sensor model detection (#194) 2020-12-26 11:33:32 -08:00
Chris Gerth
be5d8f6518 Add Gloworm 320x240 9x7 Cal Unit Test (#189)
Unit tests non-square chessboards.
2020-12-23 09:31:12 -08:00
Matt
7a032cce6e [Calibration] Fix iterator bound while creating object points (#188)
Fixes mismatched iterator bounds while creating object points. This addresses calibration failing for non square boards.
2020-12-23 09:05:27 -08:00
Matt
f2f32da2f9 Compensate for binning in picam FOV (#186)
Compensates for picam binning in the OV sensor.
2020-12-23 00:42:39 -08:00
Matt
5768648cde Make dhclient not block (#187) 2020-12-22 21:16:06 -05:00
Chris Gerth
6856427f86 Calibration Checkerboard Corner Find Optimizations (#184)
* WIP monkeying around with adding new targets.

* Added testcase to replicate large extrinsics result from calibration.

* Tweaked calibration pipline to return image with chessboard corner detection overlaid.

* Removed "bad" images from the cal, but that didn't seem to help...

* Added test logic to output the undistorted Mat for evaluating the quality of the calibration.

* Tweaked generation of chessboard points to be in a square pattern, not parallelogram.

* Spotless and removed bespoke test target in prep for PR.

* Revised to a double-for loop for less complex-looking logic

* #thanks spotless

al;ksgfjh akljghf ;lakdfdhg ksadfgh klasdfjhg kasdfjghj aklsjg two spaces

* Boop

* Updated findBoardCorners to operate on the image at a fixed, small resolution.

This means the image is scaled down before passing to openCV for processing, then the returned point cloud is scaled back up by that same factor.
Added additional flags to findBoardCorners to "fail fast".
Revised subpixel optimization parameters to use a dynamically-sized window (based on the distance observed between board corners).

* Added additional unit testing on calibration at different resolutions

* Spotless cleanup

* Add Mat release calls

* One more missing release.

Also, tried to make spotless a bit happier

* Additional formatting and WIP tracking down t he memory leak

* Cleaned up `Point` allocation in utility functions that iterate over mats of points

* Maybe fixing this bugger????

* Indeed! We can now get through the image capture stage of calibration at full resolution and save off images. Still crashing on out of memory as expected.

Added additional unit sim pass/fail criteria to catch unreleased mat's and a new set of images for testing high-res cal.

* Letting spotless do its thing

* Undistort debug seems to be acting a bit wonky in CI, so just commenting out for now

* Guard against testcases bleeding state into each other.

In particular, at least in CI, it appears not all mats are getting released in previous testcases, which borks up a hard check against "0 mats allocated" in our calibration tests.

* Removed obsolete tests

* One of these days, I will indeed learn to run spotless before I push.

But today is (still) not that day.

Today we push. FOR ROHAN!
2020-12-20 22:06:14 -05:00
Chris Gerth
2a687a1db8 Calibration3D Pipeline Memory Leak (#185)
* Cherry-pick the extra debug info from Bank's patches.

* Updated Calibrate3d pipeline to release all unnedded mat's prior to returning.

Update a few raw mat operations to use CVMat for better traceability.

* spotless cleanup

* Added check to shouldPrint for optimization on cvmat deallocate

* Reworked stack trace printing to use lambdas for efficiency

* Missed an unneeded logger.trace

* Formatting improvements
2020-12-20 21:09:39 -05:00
Chris Gerth
771f7442c9 Cal checkerboard object coords update (#181)
* WIP monkeying around with adding new targets.

* Added testcase to replicate large extrinsics result from calibration.

* Tweaked calibration pipline to return image with chessboard corner detection overlaid.

* Removed "bad" images from the cal, but that didn't seem to help...

* Added test logic to output the undistorted Mat for evaluating the quality of the calibration.

* Tweaked generation of chessboard points to be in a square pattern, not parallelogram.

* Spotless and removed bespoke test target in prep for PR.

* Revised to a double-for loop for less complex-looking logic

* #thanks spotless

al;ksgfjh akljghf ;lakdfdhg ksadfgh klasdfjhg kasdfjghj aklsjg two spaces

* Boop

* Reverting my changes in Calibrate3dPipeline.java to make this merge better with other PR's

* Derp changed the wrong one
2020-12-20 20:39:21 -05:00
Matt
c7d092a775 Delete native library if it already exists (#179)
* Delete native library if it already exists

* Spotless
2020-12-13 19:32:00 -05:00
Declan Freeman-Gleason
11a66b15ed Statically link OpenCV and always extract shared object (#177) 2020-12-13 11:28:18 -08:00
Matt
0c89db421c Init image save command key with default value (#178)
This makes it show up in OutlineViewer
2020-12-13 10:29:52 -08:00
Chris Gerth
36de88f903 Added camera pitch (tiltDegrees) to the hunk of data sent to the UI on initial request. (#176) 2020-12-10 12:10:27 -08:00
Declan Freeman-Gleason
229570d522 Make libpicam only link with OpenCV core (#174) 2020-12-10 11:21:22 -05:00
Declan Freeman-Gleason
d346513ad7 Continually set Picam rotation (#173) 2020-12-10 11:20:59 -05:00
Matt
a5437f7215 Fix solvePNP draw bug (#172)
Removes duplicate members, try-catches streaming processing, and prevents drawing empty contours. The latter likely stems from some sort of use-after-free condition.
2020-12-08 17:54:02 -08:00
Matt
0c3aeb409b Address empty object points bug during calibration
Resolves failure mode where object points would be empty in all calibrations after the first.
2020-12-08 17:46:45 -08:00
Declan Freeman-Gleason
e4b6559b81 Fix driver mode memory leak with libpicam (#171) 2020-12-08 13:33:30 -05:00
Declan Freeman-Gleason
663684fb10 Check if PicamJNI is supported in driver pipe (#170)
Fixes UnsatisfiedLinkErros when the JNI is not loaded.
2020-12-08 10:32:10 -08:00
Declan Freeman-Gleason
c3dbd45716 Add GPU Acceleration on the Raspberry Pi (#140)
* Add native stuff

* use runtimeloader

* add more native methods

* more stuff

* Switch JNI methods to static

* Remove non-java classes from the picam jni

* Add gradle task for JNI generation

* Migrate my previous GPU accel work

* Initial work on defining JNI interface

* Change libpicam to a symlink for now

* Initial work on adding no-copy OMX GPU accel on the pi

* Make DIRECT_OMX GPU accel mode not crash

* Clean up OMX changes (still not getting valid data back)

* Re-add GPU unit test

* A couple debugging tweaks/notes

* Add temporary special cases to get RGB out of ProcessingMode.NONE

* Code clarity improvements; fix possible VBO bug

* Get DIRECT_OMX working

* Remove some debugging switches in GPUAccelerator

* Pipe in VCSM stuff to read out pixels FAST

* Apply Spotless

* Revert versioningHelper changes

* Add missing import

* Convert to MMAL and move everything to native

* Re-add shared object

* Rework to use MMAL and do everything natively

* Condense pipeline settings classes

* Add OutputStreamPipeline

* Apply spotless

* Fix duplicate variable inits and add more video modes

* Integrate color frames and latency measurements for GPU

* Fix camera detection on pi and other platforms

* Add proper color copy disabling and camera settings calls

* Fix things that were broken by rebase

* Fix spotless issues and remove uneeded prints

* Remove libpicam symlink

* Fix stream resolution limiting

* Remove testing code in GPUAcceleratedHSVPipe

* Make profiling options general to all computers

* Make PicamJNI load from resources

* run spotlessApply

* Address review comments

* Update Maven repo for JOGL

* Fix release race condition

* Only run GPU accel test on the pi

* Lint fix and merge conflict accident fixes

* Make Jackson ignore extra fields when unmarshalling HardwareConfig

* Fix Mat releasing data race

* Spotless apply

* Remove broken header generation task

* Fix shared library loading typo

* Add a ZeroCopyPicam quirk to allow setting gain with the MMAL backend

* Make sure that exposure/brightness/gain get set after res changes

* Make rawInputMat properly local

* Remove bogus set of shouldRun flag

* Clean up small GPUHSVPipe print

* Add in some things that missed the ZeroCopyPiCameraSource rename

* Fix incorrect scoping introduced in past rebase

* Don't filter out too-low resolutions

* Only show latency when GPU accel is enabled

* Don't free Mats in stream thread before we use them

* Fix use-after-free and latency caluclation bugs on USB camera source

* Update libpicam

* Remove unwanted print

* Add libpicam forceLoad in unit test

* Fix streaming during camera calibration

* Fix zerocopy Picam calculation

* Use logger trace method instead of raw prints

* Fix calibration and driver mode pipes with the Picam

Co-authored-by: Matt <matthew.morley.ca@gmail.com>
Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
2020-12-08 02:34:21 -05:00
Matt
15d21b7841 Fix calibration modal bug, save calibration images (#165)
Saves calibration images to photonvision_config/calibImgs
2020-12-05 12:18:07 -08:00
Matt
14ed7ce7a4 Ensure stream divisor respects pipeline changes (#163)
Ensure stream divisor respects pipeline changes. Previously this was only set on UI commands and on construction.
2020-12-04 19:38:23 -08:00
Matt
d2b0e465ff Restart avahi-daemon on hostname changes (#161)
* Restart avahi-daemon on hostname changes

* Update NetworkManager.java

* Spotless
2020-12-03 12:16:05 -08:00