Commit Graph

157 Commits

Author SHA1 Message Date
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
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
Matt
5e385b5925 Set hostname in /etc/hosts (#160)
* Set hostname in /etc/hosts

* Run spotless
2020-12-03 10:40:53 -05:00
Chris Gerth
308e108953 Update camera path if matched camera path doesn't match saved path
Improves stability when cameras change USB ports.
2020-11-28 06:24:30 -08:00
Matt
2ae750f00f Add modal and animations while calibration is running (#157)
* Add modal for calibration

* Run wpiformat
2020-11-21 21:14:27 -05:00
Chris Gerth
da2aaba033 Log file cleaner (#153)
Removes old log files to limit disk usage.
2020-11-11 11:09:31 -08:00
Chris Gerth
e74f750fc0 Leds active without vendor fov (#156)
* Changed out LED logic to always manipulate them if configured (rather than requiring vendor FOV)
2020-11-11 11:06:51 -08:00
Chris Gerth
3f48346557 Remove Erode/Dilate from backend and UI (#152)
Removing erode/dilate from Reflective pipeline in backend and UI
2020-11-07 17:23:27 -08:00
Chris Gerth
bf7c9fea44 Single Config-file Upload Support (#150)
Allow a single .json config file to be uploaded.
2020-11-07 17:21:07 -08:00
Chris Gerth
8109a2a437 Add Disk Usage Percentage Stat (#154)
Added disk usage percentage hardware stat

Updated Settings-General UI to have table-layout for metrics and other info

Added a `synchronized` modifier to the command runner due to some InterruptedThreadExceptions that were spuriously showing up while getting stats. Added additional stack trace logging when issues arise.
2020-11-07 17:13:45 -08:00
Chris Gerth
0ce49bd8f2 Improve Pi Non-GPU-accel exposure (#148)
Changes exposure setters to accept a floating point input (rather than integer)
Updates the UI to change exposure in increments of 0.1 (rather than 1.0)
Updates quirky PI camera logic to use the raw_ interface with scaling/offset logic matching the GPU-accelerated pi3 camera logic from Declan.
Adds logic to disable auto-white-balance in the PI camera, which should yield more consistent vision processing results.
2020-10-27 14:57:11 -07:00
Banks T
35a6c0bfa4 Disallow setting NT pipeline index below 0 (#145) 2020-10-19 10:29:25 -07:00
Matt
869e4628ce Fix image rotation in test mode (#144) 2020-10-19 13:26:11 -04:00
Chris Gerth
3a78e23a55 Added input and output frame file save routines (#134)
* Added input and output frame file save routines

* First pass at review items

* Revised logic to not crash on start and pass tests

* Updated build.gradle to force line endings. Spotless passes now.

* Reverted lineEndings to not force Unix.

Gerth needs to fix up his dev pc.

Co-authored-by: Banks T <btrout.dhrs@gmail.com>
2020-10-16 21:49:50 -04:00
Matt
31013346c0 Rename MJPEG streams when camera name changes (#136)
* Rename MJPEG streams when camera name changes

* Change camera name to HTTP request

This allows us to wait for it to for sure be done

* Fix reload logic

* whee lnt

* Reload on backend connect too

* Update CameraAndPipelineSelect.vue
2020-10-16 19:48:24 -04:00
Banks T
e37fcdea98 Replace JPigpio, add hardware PWM support (#127)
* Send brightness properly to clients

* Refactor GPIO, add custom Pigpio socket wrapper

* Replace PiGPIO with PigpioPin, fix hardwarePWM

* Remove Jpigpio dependency

* Apply Spotless

* Warn user of Pigpio pin incapable of hardware PWM

* Begin rework of blinking and brightness control for vision leds

* Fixed blink, fixed brightness persistence, added bootup blink

* Cleanup HardwareManager access of config

* Apply spotless

* Skip hardware test on non-Pi

Co-authored-by: Matt <matthew.morley.ca@gmail.com>
2020-10-16 19:06:40 -04:00
Matt
23f3c0e6e1 Use chessboard squares (vs interior corners); fix resolution selector bug (#139)
* Change chessboard size to be squares not interior corners

This reduces ambiguity

* Force users to select resolution

This forces the correct video mode index to be selected. Otherwise the 0th camera videomode index will be used, as it's zero-inited. This is undesirable.

* Make target model an enum

This will allow the UI to remember the currently selected target.
2020-10-13 06:58:50 -07:00
Matt
6e0a6b804e Fix calibration slider not moving, hide gain slider when needed (#135) 2020-10-05 19:22:58 -07:00
Matt
2d7a4dd1b9 Add thread safety to Logger (#131) 2020-09-25 07:47:07 -07:00
Matt
28459704c6 Fix network config "Supported" bug (#130)
* Fix network config bug

* Use Jackson instead of hacky solution for management

* run spotless

* Add assertion
2020-09-24 18:34:47 -04:00
Matt
3305c6619d Fix pipeline duplication bug (#128) 2020-09-17 11:23:00 -07:00
Matt
24132555b8 Guarantee cameras always have the same ports (#123)
* Guarantee cameras always have the same ports

* clean up cscore stuff

* Fix stream api abuse
2020-09-15 19:00:26 -07:00
Matt
44bfc3ea6c Fix static IP and network settings on Pi 2020-09-15 11:34:27 -07:00
Matt
71fc8a7017 Metrics and lighting implementation (#116)
Implements metrics and lighting control.
2020-09-15 11:19:36 -07:00
Matt
b73c698e4d Never overwrite hardware config file (#122)
* Never overwrite hardware config file

* Remove unneeded assert
2020-09-13 12:58:07 -07:00
Matt
45686b7c9d Add NT servermode switch (#120) 2020-09-13 08:58:56 -07:00
Matt
2495d348ea Implement hostname, IP setting (#114) 2020-09-10 20:07:23 -07:00
Matt
a35f775b05 Fix driver mode settings, sort resolutions (#115)
* Fix DriverMode settings

* Update FileVisionSource.java

* Sort modes by resolution

* Filter duplicated modes

* run spotless

* Fix calibration bug

* run format

* aaaaa

* Add hardware and platform support

* decrease timing sensitivity

* Better handle jvm exitg

* Make reboot happen immediately

* Cleanup restart

* Remove debug print

* Fix Jackson exploding when deserializing old versions of configs

* Add unit test for old config versions

* Run format

* Add a comment

* remove isvendorcam from pipeline manager

* oops
2020-09-10 19:20:16 -07:00
Banks T
ddd15d362b PiCam Tweaks (#63)
* Update QuirkyCamera to do name-based matching

* Add pi-cam exposure set

* Refactor QuirkyCamera

* Add PiCam quirk test, fix tests for no-name quirky cameras

* Apply Spotless

* Add pinhole model unit test
2020-09-08 12:11:29 -04:00
Matt
73fc8e04ca Filter non-bgr modes on Pi (#112)
This can almost double performance in some cases.
2020-09-05 09:33:48 -07:00
Matt
c1d2cbf1de Revert "Stream threading (#110)" (#111)
This reverts commit 4c4b76a70e.
2020-09-05 00:09:01 -04:00
Xzibit
ef7c23c558 [Hardware] Run command to start pigpio daemon before connecting to it (#107)
* Don't start metrics thread

* Start pigpio daemon before connecting to it

Co-authored-by: Matt <matthew.morley.ca@gmail.com>
2020-09-04 18:47:13 -07:00
Banks T
4c4b76a70e Stream threading (#110)
* Condense pipeline settings classes

* Add OutputStreamPipeline
2020-09-04 18:35:11 -07:00
Matt
8a7318f5dd Update log viewer, add uncalibrated modal (#108)
Adds a prettier log viewer, with the ability to filter logs. Also warns user and prevents switching into 3d mode if the resolution is uncalibrated.
2020-09-04 18:18:44 -07:00
Banks T
ec9e3dcf79 Led control (#109)
* Refactor vision source manager to not suck

* Run spotless

* Fix settings not being saved

* run spotless

* add braudcast

* set LEDs based on pipeline

* GPIO refactor, hardwaremanager singleton change

* PiGPIO cleanup, add repeating blink, StatusLED

* Refactor CustomGPIO

* add ledMode NT Entry

* Add blink reset

* Blink fixes

* Move logic to VisionLED class

* Resolve comments, apply spotless

* "Fix' HardwareManagerTest

Co-authored-by: Matt <matthew.morley.ca@gmail.com>
2020-09-04 21:15:17 -04:00
Matt
7f4df2ff4d Auto reconnect to unconnected cameras (#40)
* Auto reconnect to unconnected cameras

* Refactor vision source manager to not suck

* Filter allowed video modes

* Run spotless

* Fix filtering

* Update VisionSourceManager.java

* Remove debug stuff

* Add unit tests, rebase

* run spotless

* Fix config test

* Fix settings not being saved

* run spotless

* oop

* kil debug prints if we have no usb cams to match

* whoooops

* add braudcast

* Actually save pipeline settings

* fix memes

* get right coeffs

* Run spotless

* run spotless

* rebase and add some prints

* Sorry min

* Oops reimpl matching

* Oops
2020-08-29 16:30:33 -07:00
Xzibit
8718be7a94 Remove GPU and RAM metrics (#105)
* Don't start metrics thread if not on linux

* [Hardware] remove GPU/RAM metrics
2020-08-28 13:43:50 -07:00