Milind Upadhyay | cd677a3 | 2022-12-04 13:06:43 -0800 | [diff] [blame] | 1 | namespace frc971.vision; |
| 2 | |
milind-u | 3f5f83c | 2023-01-29 15:23:51 -0800 | [diff] [blame] | 3 | table Position { |
| 4 | x:double (id: 0); |
| 5 | y:double (id: 1); |
| 6 | z:double (id: 2); |
| 7 | } |
| 8 | |
| 9 | table Quaternion { |
| 10 | w:double (id: 0); |
| 11 | x:double (id: 1); |
| 12 | y:double (id: 2); |
| 13 | z:double (id: 3); |
| 14 | } |
| 15 | |
Milind Upadhyay | cd677a3 | 2022-12-04 13:06:43 -0800 | [diff] [blame] | 16 | // Represents 3d pose of an april tag on the field. |
| 17 | table TargetPoseFbs { |
| 18 | // AprilTag ID of this target |
| 19 | id:uint64 (id: 0); |
| 20 | |
Yash Chainani | bd6c6e5 | 2023-02-18 19:31:32 -0800 | [diff] [blame] | 21 | // Pose of target relative to either the field origin or camera. |
milind-u | 09fb125 | 2023-01-28 19:21:41 -0800 | [diff] [blame] | 22 | // To get the pose of the target, do: |
milind-u | 3f5f83c | 2023-01-29 15:23:51 -0800 | [diff] [blame] | 23 | // Translation3d(position.x(), position.y(), position.z()) * |
| 24 | // Quaterniond(orientation.w(), orientation.x(), orientation.y(), orientation.z()) |
| 25 | position:Position (id: 1); |
| 26 | orientation:Quaternion (id: 2); |
milind-u | 681c471 | 2023-02-23 21:22:50 -0800 | [diff] [blame] | 27 | |
| 28 | // Minimum decision margin (confidence) for this april tag detection. |
| 29 | // Only filled out if this pose represents a live detection. |
| 30 | // NOTE: Detections with a decision margin less than |
| 31 | // FLAGS_min_decision_margin in aprilrobotics.cc are already filtered |
| 32 | // out before sending. |
| 33 | confidence:double (id: 3); |
milind-u | fc8ab70 | 2023-02-26 14:14:39 -0800 | [diff] [blame] | 34 | |
| 35 | // Object-space error of the tag from pose estimation. |
| 36 | // Only filled out if this pose represents a live detection. |
| 37 | // Tags which are seen completely usually have a pose_error < 1e-6, |
| 38 | // and a higher error could imply that part of the tag is being blocked. |
| 39 | // NOTE: not filtered by aprilrobotics.cc so that we can log |
| 40 | // more detections. |
| 41 | pose_error:double (id: 4); |
milind-u | f5b3b4b | 2023-02-26 14:50:38 -0800 | [diff] [blame] | 42 | |
| 43 | // A measure of how much distortion affected this detection. |
| 44 | // Only filled out if this pose represents a live detection. |
| 45 | // This is computed as the average distance between the distorted |
| 46 | // corners and undistorted corners, normalized by the image size |
milind-u | 60e7fe5 | 2023-02-26 16:13:50 -0800 | [diff] [blame] | 47 | // and the maximum expected distortion to be between 0-1. |
milind-u | f5b3b4b | 2023-02-26 14:50:38 -0800 | [diff] [blame] | 48 | // NOTE: not filtered by aprilrobotics.cc so that we can log |
| 49 | // more detections. |
| 50 | distortion_factor:double (id: 5); |
milind-u | de9045f | 2023-03-25 18:17:12 -0700 | [diff] [blame] | 51 | |
| 52 | // Ratio of pose_error from the best estimation to |
| 53 | // pose error of the second best estimation. |
| 54 | // Only filled out if this pose represents a live detection. |
| 55 | // This should be significantly less than 1, |
| 56 | // otherwise this pose may be a wrong solution. |
| 57 | // NOTE: not filtered by aprilrobotics.cc so that we can log |
| 58 | // more detections. |
| 59 | pose_error_ratio:double (id: 6); |
Milind Upadhyay | cd677a3 | 2022-12-04 13:06:43 -0800 | [diff] [blame] | 60 | } |
| 61 | |
| 62 | // Map of all target poses on a field. |
milind-u | 09fb125 | 2023-01-28 19:21:41 -0800 | [diff] [blame] | 63 | // There are two possible uses for this: |
| 64 | // 1. Static april tag poses on the field solved for by TargetMapper. |
Yash Chainani | bd6c6e5 | 2023-02-18 19:31:32 -0800 | [diff] [blame] | 65 | // 2. List of detected april poses relative to the camera. |
Milind Upadhyay | cd677a3 | 2022-12-04 13:06:43 -0800 | [diff] [blame] | 66 | table TargetMap { |
| 67 | target_poses:[TargetPoseFbs] (id: 0); |
Milind Upadhyay | 05652cb | 2022-12-07 20:51:51 -0800 | [diff] [blame] | 68 | |
milind-u | 09fb125 | 2023-01-28 19:21:41 -0800 | [diff] [blame] | 69 | // Unique name of the field (for use case 1.) |
Milind Upadhyay | 05652cb | 2022-12-07 20:51:51 -0800 | [diff] [blame] | 70 | field_name:string (id: 1); |
milind-u | 09fb125 | 2023-01-28 19:21:41 -0800 | [diff] [blame] | 71 | |
| 72 | // End-of-frame timestamp for the frame with tag detections. |
| 73 | // (for use case 2.). |
| 74 | monotonic_timestamp_ns:int64 (id: 2); |
milind-u | 99b1a76 | 2023-03-12 16:48:32 -0700 | [diff] [blame] | 75 | |
| 76 | // Number of april tags rejected (cumulative) because |
| 77 | // of low decision margin (affected by lighting). |
| 78 | // We do the decision margin rejection in aprilrobotics |
| 79 | // so we don't have an excessive amount of random target |
| 80 | // detections (for use case 2). |
| 81 | rejections:uint64 (id: 3); |
Maxwell Henderson | febee25 | 2023-01-28 16:53:52 -0800 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | root_type TargetMap; |