Use explicit flatbuffer IDs in y2017 and newer.
Non-explicit ids are risky. We've seen backwards incompatible
changes...
Change-Id: Id6ceebe031ac80430191f367635d0e951c3d2cbc
diff --git a/y2020/vision/sift/sift.fbs b/y2020/vision/sift/sift.fbs
index f38e0fe..5c44858 100644
--- a/y2020/vision/sift/sift.fbs
+++ b/y2020/vision/sift/sift.fbs
@@ -2,9 +2,9 @@
// Represents the location of a keypoint in field coordinates.
struct KeypointFieldLocation {
- x:float;
- y:float;
- z:float;
+ x:float (id: 0);
+ y:float (id: 1);
+ z:float (id: 2);
}
// Represents a single feature extracted from an image.
@@ -18,70 +18,70 @@
// The size of this depends on the parameters. It is width*width*hist_bins.
// Currently we have width=4 and hist_bins=8, which results in a size of
// 4*4*8=128.
- descriptor:[ubyte];
+ descriptor:[ubyte] (id: 0);
// Location of the keypoint.
- x:float;
- y:float;
+ x:float (id: 1);
+ y:float (id: 2);
// Size of the keypoint neighborhood.
- size:float;
+ size:float (id: 3);
// Angle of the keypoint.
// This is in [0,360) clockwise.
- angle:float;
+ angle:float (id: 4);
// How good of a keypoint this is.
- response:float;
+ response:float (id: 5);
// Which octave this keypoint is from.
- octave:int;
+ octave:int (id: 6);
// Where this feature's keypoint is on the field. This will only be filled out
// for training features, not ones extracted from query images.
- field_location:KeypointFieldLocation;
+ field_location:KeypointFieldLocation (id: 7);
}
// Represents a single match between a training image and a query image.
struct Match {
// The index of the feature for the query image.
- query_feature:int;
+ query_feature:int (id: 0);
// The index of the feature for the training image.
- train_feature:int;
+ train_feature:int (id: 1);
// How "good" the match is.
- distance:float;
+ distance:float (id: 2);
}
// Represents all the matches between a single training image and a query
// image.
table ImageMatch {
- matches:[Match];
+ matches:[Match] (id: 0);
// The index of the training image within all the training images.
- train_image:int;
+ train_image:int (id: 1);
}
table TransformationMatrix {
// The matrix data for a row-major 4x4 homogeneous transformation matrix.
// This implies the bottom row is (0, 0, 0, 1).
- data:[float];
+ data:[float] (id: 0);
}
// Calibration information for a given camera on a given robot.
table CameraCalibration {
// The name of the camera node which this calibration data applies to.
- node_name:string;
+ node_name:string (id: 0);
// The team number of the robot which this calibration data applies to.
- team_number:int;
+ team_number:int (id: 1);
// Intrinsics for the camera.
//
// This is the standard OpenCV intrinsics matrix in row major order (3x3).
- intrinsics:[float];
+ intrinsics:[float] (id: 2);
// Fixed extrinsics for the camera. This transforms from camera coordinates to
// robot coordinates. For example: multiplying (0, 0, 0, 1) by this results in
// the position of the camera aperature in robot coordinates.
- fixed_extrinsics:TransformationMatrix;
+ fixed_extrinsics:TransformationMatrix (id: 3);
// Extrinsics for a camera on a turret. This will only be filled out for
// applicable cameras. For turret-mounted cameras, fixed_extrinsics defines
@@ -97,13 +97,13 @@
// fixed_extrinsics
// rotation around the Z axis by the turret angle
// turret_extrinsics
- turret_extrinsics:TransformationMatrix;
+ turret_extrinsics:TransformationMatrix (id: 4);
// This is the standard OpenCV 5 parameter distortion coefficients
- dist_coeffs:[float];
+ dist_coeffs:[float] (id: 5);
// Timestamp for when the calibration was taken on the realtime clock.
- calibration_timestamp:int64;
+ calibration_timestamp:int64 (id: 6);
}
// Contains the information the EKF wants from an image matched against a single
@@ -120,7 +120,7 @@
// (0, 0, 0) is the aperture of the camera (we pretend it's an ideal pinhole
// camera). Positive Z is out of the camera. Positive X and Y are right
// handed, but which way they face depends on the camera extrinsics.
- camera_to_target:TransformationMatrix;
+ camera_to_target:TransformationMatrix (id: 0);
// Field coordinates of the target, represented as a transformation matrix
// from the field to the target.
@@ -133,36 +133,36 @@
//
// The value here will be selected from a small, static set of targets we
// train images on.
- field_to_target:TransformationMatrix;
+ field_to_target:TransformationMatrix (id: 1);
// The pose of the camera in the field coordinate frame
- field_to_camera:TransformationMatrix;
+ field_to_camera:TransformationMatrix (id: 2);
// 2D image coordinate representing target location on the matched image
- query_target_point_x:float;
- query_target_point_y:float;
+ query_target_point_x:float (id: 3);
+ query_target_point_y:float (id: 4);
// Perceived radius of target circle
- query_target_point_radius:float;
+ query_target_point_radius:float (id: 5);
}
table ImageMatchResult {
// The matches from this image to each of the training images which matched.
// Each member is against the same captured image.
- image_matches:[ImageMatch];
+ image_matches:[ImageMatch] (id: 0);
// The transformations for this image for each of the training images which
// matched.
// TODO(Brian): Include some kind of covariance information for these.
- camera_poses:[CameraPose];
+ camera_poses:[CameraPose] (id: 1);
// The features for this image.
- features:[Feature];
+ features:[Feature] (id: 2);
// Timestamp when the frame was captured.
- image_monotonic_timestamp_ns:long;
+ image_monotonic_timestamp_ns:long (id: 3);
// Information about the camera which took this image.
- camera_calibration:CameraCalibration;
+ camera_calibration:CameraCalibration (id: 4);
}
root_type ImageMatchResult;
diff --git a/y2020/vision/sift/sift_training.fbs b/y2020/vision/sift/sift_training.fbs
index 12ad9b4..c093e3b 100644
--- a/y2020/vision/sift/sift_training.fbs
+++ b/y2020/vision/sift/sift_training.fbs
@@ -4,26 +4,26 @@
// Represents a single image we train against.
table TrainingImage {
- features:[Feature];
+ features:[Feature] (id: 0);
// Field coordinates of the target, represented as a transformation matrix
// from the target to the field. See CameraPose in :sift_fbs for details of
// the conventions of this.
- field_to_target:TransformationMatrix;
+ field_to_target:TransformationMatrix (id: 1);
// 2D image coordinate representing target location on the training image
- target_point_x:float;
- target_point_y:float;
+ target_point_x:float (id: 2);
+ target_point_y:float (id: 3);
// Radius of target circle
- target_point_radius:float;
+ target_point_radius:float (id: 4);
}
// Represents the information used to match incoming images against.
table TrainingData {
- images:[TrainingImage];
+ images:[TrainingImage] (id: 0);
// Calibration information for all the cameras we know about.
- camera_calibrations:[CameraCalibration];
+ camera_calibrations:[CameraCalibration] (id: 1);
}
root_type TrainingData;