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/control_loops/superstructure/superstructure_goal.fbs b/y2020/control_loops/superstructure/superstructure_goal.fbs
index 9200082..792b6b4 100644
--- a/y2020/control_loops/superstructure/superstructure_goal.fbs
+++ b/y2020/control_loops/superstructure/superstructure_goal.fbs
@@ -5,10 +5,10 @@
table ShooterGoal {
// Angular velocity in rad/s of the slowest (lowest) wheel in the kicker.
// Positive is shooting the ball.
- velocity_accelerator:double;
+ velocity_accelerator:double (id: 0);
// Angular velocity in rad/s of the flywheel. Positive is shooting.
- velocity_finisher:double;
+ velocity_finisher:double (id: 1);
}
table Goal {
diff --git a/y2020/control_loops/superstructure/superstructure_output.fbs b/y2020/control_loops/superstructure/superstructure_output.fbs
index fd57825..005d930 100644
--- a/y2020/control_loops/superstructure/superstructure_output.fbs
+++ b/y2020/control_loops/superstructure/superstructure_output.fbs
@@ -2,35 +2,35 @@
table Output {
// Votage sent to the hood. Positive moves up.
- hood_voltage:double;
+ hood_voltage:double (id: 0);
// Voltage sent to motors on intake joint. Positive extends rollers.
- intake_joint_voltage:double;
+ intake_joint_voltage:double (id: 1);
// Voltage sent to rollers on intake. Positive rolls inward.
- intake_roller_voltage:double;
+ intake_roller_voltage:double (id: 2);
- //Voltage sent to the motors.
- //Positive rotates counterclockwise from a birds eye view.
- turret_voltage:double;
+ // Voltage sent to the motors.
+ // Positive rotates counterclockwise from a birds eye view.
+ turret_voltage:double (id: 3);
// Voltage sent to the feeder belt. Positive is feeding.
- feeder_voltage:double;
+ feeder_voltage:double (id: 4);
// Voltage sent to the washing_machine and control panel spinner.
// Positive runs the washing machine CCW facing the front of the robot, and
// the spinner runs CCW from a top down view.
- washing_machine_spinner_voltage:double;
+ washing_machine_spinner_voltage:double (id: 5);
// Voltage sent to the kicker. Positive is shooting.
- accelerator_left_voltage:double;
- accelerator_right_voltage:double;
+ accelerator_left_voltage:double (id: 6);
+ accelerator_right_voltage:double (id: 7);
// Voltage sent to the flywheel. Positive is shooting.
- finisher_voltage:double;
+ finisher_voltage:double (id: 8);
// Positive is deploying climber and to climb; cannot run in reverse
- climber_voltage:double;
+ climber_voltage:double (id: 9);
}
root_type Output;
diff --git a/y2020/control_loops/superstructure/superstructure_position.fbs b/y2020/control_loops/superstructure/superstructure_position.fbs
index ed4ba18..f139381 100644
--- a/y2020/control_loops/superstructure/superstructure_position.fbs
+++ b/y2020/control_loops/superstructure/superstructure_position.fbs
@@ -4,29 +4,29 @@
table ShooterPosition {
// Flywheel angle in radians, positive is shooting.
- theta_finisher:double;
+ theta_finisher:double (id: 0);
// Kicker angle in radians of the slowest (lowest) wheel, positive is
// accelerating the ball toward the shooter.
- theta_accelerator_left:double;
- theta_accelerator_right:double;
+ theta_accelerator_left:double (id: 1);
+ theta_accelerator_right:double (id: 2);
}
table Position {
// Zero is at the horizontal, positive towards the front (radians).
- hood:frc971.AbsolutePosition;
+ hood:frc971.AbsolutePosition (id: 0);
// Position of the intake. 0 when four-bar is vertical, positive extended.
- intake_joint:frc971.AbsolutePosition;
+ intake_joint:frc971.AbsolutePosition (id: 1);
// See goal for definition of 0
- turret:frc971.PotAndAbsolutePosition;
+ turret:frc971.PotAndAbsolutePosition (id: 2);
// Position of the kicker and flywheel
- shooter:ShooterPosition;
+ shooter:ShooterPosition (id: 3);
// Position of the control panel, relative to start, positive counterclockwise from above.
- control_panel:frc971.RelativePosition;
+ control_panel:frc971.RelativePosition (id: 4);
}
root_type Position;
diff --git a/y2020/control_loops/superstructure/superstructure_status.fbs b/y2020/control_loops/superstructure/superstructure_status.fbs
index dc6116c..fb94d32 100644
--- a/y2020/control_loops/superstructure/superstructure_status.fbs
+++ b/y2020/control_loops/superstructure/superstructure_status.fbs
@@ -6,63 +6,63 @@
table FlywheelControllerStatus {
// The current average velocity in radians/second over the last kHistoryLength
// in shooter.h
- avg_angular_velocity:double;
+ avg_angular_velocity:double (id: 0);
// The current instantaneous filtered velocity in radians/second.
- angular_velocity:double;
+ angular_velocity:double (id: 1);
// The target speed selected by the lookup table or from manual override
// Can be compared to velocity to determine if ready.
- angular_velocity_goal:double;
+ angular_velocity_goal:double (id: 2);
// Voltage error.
- voltage_error:double;
+ voltage_error:double (id: 3);
}
table ShooterStatus {
// The final wheel shooting the ball
- finisher:FlywheelControllerStatus;
+ finisher:FlywheelControllerStatus (id: 0);
// The subsystem to accelerate the ball before the finisher
// Velocity is the fastest (top) wheel
- accelerator_left:FlywheelControllerStatus;
- accelerator_right:FlywheelControllerStatus;
+ accelerator_left:FlywheelControllerStatus (id: 1);
+ accelerator_right:FlywheelControllerStatus (id: 2);
}
table AimerStatus {
// The current goal angle for the turret auto-tracking, in radians.
- turret_position:double;
+ turret_position:double (id: 0);
// The current goal velocity for the turret, in radians / sec.
- turret_velocity:double;
+ turret_velocity:double (id: 1);
// Whether we are currently aiming for the inner port.
- aiming_for_inner_port:bool;
+ aiming_for_inner_port:bool (id: 2);
// The current distance to the target, in meters.
- target_distance:double;
+ target_distance:double (id: 3);
// The current "shot distance." When shooting on the fly, this may be
// different from the static distance to the target.
- shot_distance:double;
+ shot_distance:double (id: 4);
}
table Status {
// All subsystems know their location.
- zeroed:bool;
+ zeroed:bool (id: 0);
// If true, we have aborted. This is if one or all subsystem estops.
- estopped:bool;
+ estopped:bool (id: 1);
// Subsystem status.
- hood:frc971.control_loops.AbsoluteEncoderProfiledJointStatus;
- intake:frc971.control_loops.AbsoluteEncoderProfiledJointStatus;
- turret:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus;
+ hood:frc971.control_loops.AbsoluteEncoderProfiledJointStatus (id: 2);
+ intake:frc971.control_loops.AbsoluteEncoderProfiledJointStatus (id: 3);
+ turret:frc971.control_loops.PotAndAbsoluteEncoderProfiledJointStatus (id: 4);
// Shooter subsystem status.
- shooter:ShooterStatus;
+ shooter:ShooterStatus (id: 5);
// Status of the control_panel
- control_panel:frc971.control_loops.RelativeEncoderProfiledJointStatus;
+ control_panel:frc971.control_loops.RelativeEncoderProfiledJointStatus (id: 6);
// Status of the vision auto-tracking.
- aimer:AimerStatus;
+ aimer:AimerStatus (id: 7);
}
root_type Status;
diff --git a/y2020/setpoint.fbs b/y2020/setpoint.fbs
index 5f1af72..74164e5 100644
--- a/y2020/setpoint.fbs
+++ b/y2020/setpoint.fbs
@@ -1,11 +1,11 @@
namespace y2020.joysticks;
table Setpoint {
- accelerator:double;
+ accelerator:double (id: 0);
- finisher:double;
+ finisher:double (id: 1);
- hood:double;
+ hood:double (id: 2);
}
root_type Setpoint;
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;
diff --git a/y2020/vision/vision.fbs b/y2020/vision/vision.fbs
index 17dc4a4..e89a181 100644
--- a/y2020/vision/vision.fbs
+++ b/y2020/vision/vision.fbs
@@ -10,13 +10,13 @@
// * Order: row major (index 0 is upper left, index 1 is to its right)
table CameraImage {
// The number of rows in the image.
- rows:int;
+ rows:int32 (id: 0);
// The number of columns in the image.
- cols:int;
+ cols:int32 (id: 1);
// The image data.
- data:[ubyte];
+ data:[ubyte] (id: 2);
// Timestamp when the frame was captured. This is the end-of-frame timestamp.
- monotonic_timestamp_ns:long;
+ monotonic_timestamp_ns:int64 (id: 3);
}
root_type CameraImage;