EasternEdgeRobotics / Software_2017

The control software for 2017
MIT License
3 stars 0 forks source link

Save calibration values to disk #312

Closed cal-pratt closed 7 years ago

cal-pratt commented 7 years ago

In this PR I'm adding a way to backup the results of the camera calibration between separate runs of the topside application. In creating this feature I decided to model the code after the motion power profile code. This code was going to be very similar so it made sense to make the profile controller a generic class. You can now save any object you want to disk by creating a ValueStore<V> instance.

This really helped clean up the camera calibration code. Instead of tracking if an object was created in the current runtime, just check the ValueStore<CameraCalibrationValue> instance to see if there was a successful calibration. This removes the need to copy the valid camera calibration images to a separate folder, as the last calibration value can be grabbed without re-running the calibration code.

Translating the value object into the JavaCV Mat and Size objects is performed as a method in the new CameraCalibrationValue kotlin data class. Might add a ctor which also accepts Mat values to keep all of the Mat to CameraCalibrationValue logic isolated to the same file.