blob: 9ba2b11a165122c90905e9dc34328bd106869478 [file] [log] [blame]
milind-u2f101fc2023-01-21 12:28:49 -08001include "frc971/vision/calibration.fbs";
Milind Upadhyaye2f40d72022-02-24 13:55:53 -08002
milind-u92195982022-01-22 20:29:31 -08003namespace y2022.vision;
4
Henry Speisere45e7a22022-02-04 23:17:01 -08005struct Point {
6 x:int (id: 0);
7 y:int (id: 1);
8}
9
Milind Upadhyay8f38ad82022-03-03 10:06:18 -080010struct Size {
11 width:int (id: 0);
12 height:int (id: 1);
13}
14
Henry Speisere45e7a22022-02-04 23:17:01 -080015table Blob {
16 points:[Point] (id: 0);
17}
18
19// Statistics for each blob used for filtering
20table BlobStatsFbs {
21 centroid:Point (id: 0);
Milind Upadhyay8f38ad82022-03-03 10:06:18 -080022 size:Size (id: 4);
Henry Speisere45e7a22022-02-04 23:17:01 -080023 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 Upadhyay25610d22022-02-07 15:35:26 -080029table BlobResultFbs {
Henry Speisere45e7a22022-02-04 23:17:01 -080030 // 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 Upadhyay8f38ad82022-03-03 10:06:18 -080036 // Stats of filtered blobs
37 filtered_stats:[BlobStatsFbs] (id: 4);
Henry Speisere45e7a22022-02-04 23:17:01 -080038 // Average centroid of the filtered blobs
39 centroid:Point (id: 3);
40}
41
Milind Upadhyayf61e1482022-02-11 20:42:55 -080042// Euler angles rotation
43struct Rotation {
44 roll:double (id: 0);
45 pitch:double (id: 1);
46 yaw:double (id: 2);
47}
48
milind-u92195982022-01-22 20:29:31 -080049// Contains the information the EKF wants from blobs from a single image.
50table 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 Upadhyayf61e1482022-02-11 20:42:55 -080054 // Positive means left of center, negative means right.
milind-u92195982022-01-22 20:29:31 -080055 angle_to_target:double (id: 1);
Milind Upadhyayf61e1482022-02-11 20:42:55 -080056 // 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 Upadhyay8f38ad82022-03-03 10:06:18 -080061 // Confidence in the estimate from 0 to 1,
62 // based on the final deviation between projected points and actual blobs.
Milind Upadhyay14279de2022-02-26 16:07:53 -080063 // Good estimates currently have confidences of around 0.9 or greater.
64 confidence:double (id: 7);
milind-u92195982022-01-22 20:29:31 -080065
Milind Upadhyay25610d22022-02-07 15:35:26 -080066 blob_result:BlobResultFbs (id: 2);
Henry Speisere45e7a22022-02-04 23:17:01 -080067
Jim Ostrowski210765a2022-02-27 12:52:14 -080068 // Contains the duration between the epoch and the nearest point
69 // in time from when it was called.
Milind Upadhyayf61e1482022-02-11 20:42:55 -080070 image_monotonic_timestamp_ns:int64 (id: 5);
Jim Ostrowski210765a2022-02-27 12:52:14 -080071
Milind Upadhyaye2f40d72022-02-24 13:55:53 -080072 // Information about the camera which took this image.
Milind Upadhyayf61e1482022-02-11 20:42:55 -080073 camera_calibration:frc971.vision.calibration.CameraCalibration (id: 6);
milind-u92195982022-01-22 20:29:31 -080074}
milind-uf2f59aa2022-01-23 21:06:12 -080075
76root_type TargetEstimate;