Commit Graph

146 Commits

Author SHA1 Message Date
Chris Gerth
aaac6a4fbb Add Websocket Camera Streaming (#529)
* WIP adding second websocket handling for cameras

* just more WIP

* even more wip. Most java-side framework completed, but not yet debugged

* IT LIVES. Still needs lots of cleanup. But we're transferring and displaying data!

* moved down an architecture layer. Improved multiple-camera handling

* Additional WIP to help improve smoothness and performance, though not yet tested

* bugfixes galore

* tweak compression

* spotless

* more tweaks for handling slow/intermittent streams

* wpilibformat maybe?

* clang-format maybe?

* WIP - adding thinclient. I don't like it yet, it should be more auto-generated than it is.

* thinclient formatting fixups

* Reduced amount of empty send data by limiting to only one stream per client (which is all we really need). Framerate is up slightly, overhead is down.

* bugfixes, faster streaming, better mjpeg compression settings, thinclient working

* spotless and formatting

* cmon wpiformat....

* re-added mjpg streams

* added a loading GIF to imporve the feeling of responsiveness

* formatting

* urlparams and built-in thinclient

* wpiformat

* prevent wpiformat complaints

* Removed uint8 array and base64 conversion from client side

* Synced up js implementations for ws streaming

* formatting/spotless
2022-10-30 13:16:17 -05:00
Jack
a1b09100e0 Remove pitch camera configuration (#492)
* Remove pitch configuration from camera view

* Remove pitch config from backend; fix 'this' binding bug

* Stylistic choice to remove excessive whitespace br

* Spotless apply

* Spotless apply 2
2022-10-17 12:41:57 -04:00
shueja-personal
a764ace7f2 Initial AprilTag support (#458)
(Very) beta AprilTag support in PhotonVision. Disables Picam GPU acceleration until we can debug auto exposure in the MMAL driver.

Co-authored-by: Banks Troutman <btrout.dhrs@gmail.com>
Co-authored-by: Matt <matthew.morley.ca@gmail.com>
Co-authored-by: Chris Gerth <gerth2@users.noreply.github.com>
Co-authored-by: Chris <chrisgerth010592@gmail.com>
Co-authored-by: mdurrani808 <mdurrani808@gmail.com>
2022-09-28 21:21:41 -04:00
Matt
72717cecf0 Disable Roborio finder (#450)
Rio finder has been linked to weird crashes after Autonomous
2022-03-31 22:55:51 -04:00
Matt
54fdd1db51 Add test mode from path (#440)
adds --path to --test-mode
2022-03-16 21:33:20 -07:00
Matt
1805785cc6 Rio discovery slowdown (#444)
* Only send rio IPs on settings button click

* Wpiformat
2022-03-14 20:44:14 -07:00
Tyler Veness
9893cf1f7e Update photonlib and photonlib example license headers to MIT (#395) 2022-01-20 22:35:28 -05:00
Matt
e6d8e05b91 2022 grouping and test mode updates (#381)
Add 2022 images, "2orMore" grouping mode, and 2022 test mode
Test mode now preserves old settings
2022-01-10 16:51:06 -08:00
Tyler Veness
46fa17dfd8 Upgrade spotless and shadow (#385)
Fixes Log4J vulnerability
2022-01-10 11:56:45 -08:00
Matt
43c35286f3 Reword restart modal (#374)
Clarifies that photon will restart (when running as service)
2022-01-09 16:02:32 -08:00
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
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
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
2ca879c82d Add sensor model detection (#194) 2020-12-26 11:33:32 -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
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