milind-u | 2f101fc | 2023-01-21 12:28:49 -0800 | [diff] [blame] | 1 | include "frc971/vision/calibration.fbs"; |
Milind Upadhyay | e2f40d7 | 2022-02-24 13:55:53 -0800 | [diff] [blame] | 2 | |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 3 | namespace y2022.vision; |
| 4 | |
Henry Speiser | e45e7a2 | 2022-02-04 23:17:01 -0800 | [diff] [blame] | 5 | struct Point { |
| 6 | x:int (id: 0); |
| 7 | y:int (id: 1); |
| 8 | } |
| 9 | |
Milind Upadhyay | 8f38ad8 | 2022-03-03 10:06:18 -0800 | [diff] [blame] | 10 | struct Size { |
| 11 | width:int (id: 0); |
| 12 | height:int (id: 1); |
| 13 | } |
| 14 | |
Henry Speiser | e45e7a2 | 2022-02-04 23:17:01 -0800 | [diff] [blame] | 15 | table Blob { |
| 16 | points:[Point] (id: 0); |
| 17 | } |
| 18 | |
| 19 | // Statistics for each blob used for filtering |
| 20 | table BlobStatsFbs { |
| 21 | centroid:Point (id: 0); |
Milind Upadhyay | 8f38ad8 | 2022-03-03 10:06:18 -0800 | [diff] [blame] | 22 | size:Size (id: 4); |
Henry Speiser | e45e7a2 | 2022-02-04 23:17:01 -0800 | [diff] [blame] | 23 | aspect_ratio:double (id: 1); |
| 24 | area:double (id: 2); |
| 25 | num_points:uint64 (id: 3); |
| 26 | } |
| 27 | |
| 28 | // Information for debugging blob detection |
Milind Upadhyay | 25610d2 | 2022-02-07 15:35:26 -0800 | [diff] [blame] | 29 | table BlobResultFbs { |
Henry Speiser | e45e7a2 | 2022-02-04 23:17:01 -0800 | [diff] [blame] | 30 | // Blobs that passed the filtering step |
| 31 | filtered_blobs:[Blob] (id: 0); |
| 32 | // All detected blobs |
| 33 | unfiltered_blobs:[Blob] (id: 1); |
| 34 | // Stats on the blobs |
| 35 | blob_stats:[BlobStatsFbs] (id: 2); |
Milind Upadhyay | 8f38ad8 | 2022-03-03 10:06:18 -0800 | [diff] [blame] | 36 | // Stats of filtered blobs |
| 37 | filtered_stats:[BlobStatsFbs] (id: 4); |
Henry Speiser | e45e7a2 | 2022-02-04 23:17:01 -0800 | [diff] [blame] | 38 | // Average centroid of the filtered blobs |
| 39 | centroid:Point (id: 3); |
| 40 | } |
| 41 | |
Milind Upadhyay | f61e148 | 2022-02-11 20:42:55 -0800 | [diff] [blame] | 42 | // Euler angles rotation |
| 43 | struct Rotation { |
| 44 | roll:double (id: 0); |
| 45 | pitch:double (id: 1); |
| 46 | yaw:double (id: 2); |
| 47 | } |
| 48 | |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 49 | // Contains the information the EKF wants from blobs from a single image. |
| 50 | table TargetEstimate { |
| 51 | // Horizontal distance from the camera to the center of the upper hub |
| 52 | distance:double (id: 0); |
| 53 | // Angle from the camera to the target (horizontal angle in rad). |
Milind Upadhyay | f61e148 | 2022-02-11 20:42:55 -0800 | [diff] [blame] | 54 | // Positive means left of center, negative means right. |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 55 | angle_to_target:double (id: 1); |
Milind Upadhyay | f61e148 | 2022-02-11 20:42:55 -0800 | [diff] [blame] | 56 | // Polar angle from target to camera (not rotation). |
| 57 | // Currently being frozen at 0 |
| 58 | angle_to_camera:double (id: 3); |
| 59 | // Rotation of the camera in the hub's reference frame |
| 60 | rotation_camera_hub:Rotation (id: 4); |
Milind Upadhyay | 8f38ad8 | 2022-03-03 10:06:18 -0800 | [diff] [blame] | 61 | // Confidence in the estimate from 0 to 1, |
| 62 | // based on the final deviation between projected points and actual blobs. |
Milind Upadhyay | 14279de | 2022-02-26 16:07:53 -0800 | [diff] [blame] | 63 | // Good estimates currently have confidences of around 0.9 or greater. |
| 64 | confidence:double (id: 7); |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 65 | |
Milind Upadhyay | 25610d2 | 2022-02-07 15:35:26 -0800 | [diff] [blame] | 66 | blob_result:BlobResultFbs (id: 2); |
Henry Speiser | e45e7a2 | 2022-02-04 23:17:01 -0800 | [diff] [blame] | 67 | |
Jim Ostrowski | 210765a | 2022-02-27 12:52:14 -0800 | [diff] [blame] | 68 | // Contains the duration between the epoch and the nearest point |
| 69 | // in time from when it was called. |
Milind Upadhyay | f61e148 | 2022-02-11 20:42:55 -0800 | [diff] [blame] | 70 | image_monotonic_timestamp_ns:int64 (id: 5); |
Jim Ostrowski | 210765a | 2022-02-27 12:52:14 -0800 | [diff] [blame] | 71 | |
Milind Upadhyay | e2f40d7 | 2022-02-24 13:55:53 -0800 | [diff] [blame] | 72 | // Information about the camera which took this image. |
Milind Upadhyay | f61e148 | 2022-02-11 20:42:55 -0800 | [diff] [blame] | 73 | camera_calibration:frc971.vision.calibration.CameraCalibration (id: 6); |
milind-u | 9219598 | 2022-01-22 20:29:31 -0800 | [diff] [blame] | 74 | } |
milind-u | f2f59aa | 2022-01-23 21:06:12 -0800 | [diff] [blame] | 75 | |
| 76 | root_type TargetEstimate; |