Merge "Make sure velocity is close before shooting"
diff --git a/aos/starter/BUILD b/aos/starter/BUILD
index a7d7e02..0ebe0f5 100644
--- a/aos/starter/BUILD
+++ b/aos/starter/BUILD
@@ -1,5 +1,6 @@
load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
load("//aos:config.bzl", "aos_config")
+load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
exports_files(["roborio_irq_config.json"])
@@ -191,6 +192,14 @@
deps = ["//aos/util:process_info_fbs"],
)
+flatbuffer_ts_library(
+ name = "starter_ts_fbs",
+ srcs = ["starter.fbs"],
+ target_compatible_with = ["@platforms//os:linux"],
+ visibility = ["//visibility:public"],
+ deps = ["//aos/util:process_info_ts_fbs"],
+)
+
static_flatbuffer(
name = "kthread_fbs",
srcs = ["kthread.fbs"],
diff --git a/aos/util/BUILD b/aos/util/BUILD
index 599d477..206bd8f 100644
--- a/aos/util/BUILD
+++ b/aos/util/BUILD
@@ -1,6 +1,7 @@
load("//aos/flatbuffers:generate.bzl", "static_flatbuffer")
load("//aos:flatbuffers.bzl", "cc_static_flatbuffer")
load("config_validator_macro.bzl", "config_validator_test")
+load("@com_github_google_flatbuffers//:typescript.bzl", "flatbuffer_ts_library")
package(default_visibility = ["//visibility:public"])
@@ -373,6 +374,13 @@
visibility = ["//visibility:public"],
)
+flatbuffer_ts_library(
+ name = "process_info_ts_fbs",
+ srcs = ["process_info.fbs"],
+ target_compatible_with = ["@platforms//os:linux"],
+ visibility = ["//visibility:public"],
+)
+
cc_library(
name = "top",
srcs = ["top.cc"],
diff --git a/frc971/orin/argus_camera.cc b/frc971/orin/argus_camera.cc
index 42686a1..81a4904 100644
--- a/frc971/orin/argus_camera.cc
+++ b/frc971/orin/argus_camera.cc
@@ -31,8 +31,8 @@
"Mode to use. Don't change unless you know what you are doing.");
DEFINE_int32(camera, 0, "Camera number");
DEFINE_int32(mode, 0, "Mode number to use.");
-DEFINE_int32(exposure, 200000, "Exposure number to use.");
-DEFINE_int32(gain, 5, "gain number to use.");
+DEFINE_int32(exposure, 100000, "Exposure number to use.");
+DEFINE_int32(gain, 8, "gain number to use.");
DEFINE_int32(width, 1456, "Image width");
DEFINE_int32(height, 1088, "Image height");
DEFINE_double(rgain, 1.0, "R gain");
diff --git a/frc971/orin/gpu_apriltag.cc b/frc971/orin/gpu_apriltag.cc
index cc3c7f4..425e45f 100644
--- a/frc971/orin/gpu_apriltag.cc
+++ b/frc971/orin/gpu_apriltag.cc
@@ -26,7 +26,7 @@
"1.0.");
DEFINE_double(min_decision_margin, 50.0,
"Minimum decision margin (confidence) for an apriltag detection");
-DEFINE_int32(pixel_border, 10,
+DEFINE_int32(pixel_border, 150,
"Size of image border within which to reject detected corners");
DEFINE_uint64(pose_estimation_iterations, 50,
"Number of iterations for apriltag pose estimation.");
@@ -282,12 +282,12 @@
if (!converged) {
VLOG(1) << "Rejecting detection because Undistort failed to coverge";
- // Send rejected corner points to foxglove in red
+ // Send corner points rejected to to lack of convergence in orange
std::vector<cv::Point2f> rejected_corner_points =
MakeCornerVector(gpu_detection);
foxglove_corners.push_back(frc971::vision::BuildPointsAnnotation(
builder.fbb(), eof, rejected_corner_points,
- std::vector<double>{1.0, 0.0, 0.0, 0.5}));
+ std::vector<double>{1.0, 0.65, 0.0, 0.5}));
rejections_++;
continue;
}
diff --git a/frc971/vision/intrinsics_calibration.cc b/frc971/vision/intrinsics_calibration.cc
index d3ddba7..e0ec38c 100644
--- a/frc971/vision/intrinsics_calibration.cc
+++ b/frc971/vision/intrinsics_calibration.cc
@@ -44,6 +44,13 @@
"camera moves.";
std::unique_ptr<aos::ExitHandle> exit_handle = event_loop.MakeExitHandle();
+ CHECK(aos::network::ParsePiOrOrin(hostname))
+ << "Failed to parse node type from " << hostname
+ << ". Should be of form orin1-971-1";
+ CHECK(aos::network::ParsePiOrOrinNumber(hostname))
+ << "Failed to parse node number from " << hostname
+ << ". Should be of form orin2-7971-1";
+
std::string camera_name = absl::StrCat(
"/", aos::network::ParsePiOrOrin(hostname).value(),
std::to_string(aos::network::ParsePiOrOrinNumber(hostname).value()),
diff --git a/y2024/BUILD b/y2024/BUILD
index 7568050..6687dac 100644
--- a/y2024/BUILD
+++ b/y2024/BUILD
@@ -340,6 +340,7 @@
"//aos/network:log_web_proxy_main",
"//y2024/www:field_main_bundle.min.js",
"//y2024/www:files",
+ "//y2024/www:starter_main_bundle.min.js",
],
target_compatible_with = ["@platforms//os:linux"],
)
diff --git a/y2024/constants/971.json b/y2024/constants/971.json
index c146417..710f80b 100644
--- a/y2024/constants/971.json
+++ b/y2024/constants/971.json
@@ -8,16 +8,16 @@
{
"cameras": [
{
- "calibration": {% include 'y2024/constants/calib_files/calibration_orin-971-c-1_cam-24-05_2024-03-08_17-16-02.325066070.json' %}
+ "calibration": {% include 'y2024/constants/calib_files/calibration_imu-971-1_cam-24-05_2024-03-17_21-52-58.json' %}
},
{
- "calibration": {% include 'y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-06_2024-03-08_17-16-02.325390283.json' %}
+ "calibration": {% include 'y2024/constants/calib_files/calibration_orin1-971-0_cam-24-06_2024-03-17_21-52-58.json' %}
},
{
- "calibration": {% include 'y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-07_2024-03-08_17-16-02.325267121.json' %}
+ "calibration": {% include 'y2024/constants/calib_files/calibration_orin1-971-1_cam-24-07_2024-03-17_21-52-58.json' %}
},
{
- "calibration": {% include 'y2024/constants/calib_files/calibration_imu-971-1_cam-24-08_2024-03-01_11-02-11.982641320.json' %}
+ "calibration": {% include 'y2024/constants/calib_files/calibration_imu-971-0_cam-24-08_2024-03-01_11-02-11.json' %}
}
],
"robot": {
@@ -48,11 +48,11 @@
"altitude_constants": {
{% set _ = altitude_zero.update(
{
- "measured_absolute_position" : 0.2135
+ "measured_absolute_position" : 0.18140472352247
}
) %}
"zeroing_constants": {{ altitude_zero | tojson(indent=2)}},
- "potentiometer_offset": -0.16416323147786
+ "potentiometer_offset": {{ -0.16416323147786 + 0.0111742298989474 }}
},
"turret_constants": {
{% set _ = turret_zero.update(
diff --git a/y2024/constants/9971.json b/y2024/constants/9971.json
index da8ed92..755b56a 100644
--- a/y2024/constants/9971.json
+++ b/y2024/constants/9971.json
@@ -8,16 +8,16 @@
{
"cameras": [
{
- "calibration": {% include 'y2024/constants/calib_files/calibration_imu-9971-1-0_cam-24-10_2024-02-24_16-44-05.975708672.json' %}
+ "calibration": {% include 'y2024/constants/calib_files/calibration_imu-9971-0_cam-24-10_2024-02-24_16-44-05.json' %}
},
{
- "calibration": {% include 'y2024/constants/calib_files/calibration_imu-9971-1-1_cam-24-12_2024-02-24_19-52-39.488095264.json' %}
+ "calibration": {% include 'y2024/constants/calib_files/calibration_imu-9971-1_cam-24-12_2024-03-24_11-52-49.json' %}
},
{
- "calibration": {% include 'y2024/constants/calib_files/calibration_orin-9971-1-0_cam-24-09_2024-02-24_16-10-16.872521280.json' %}
+ "calibration": {% include 'y2024/constants/calib_files/calibration_orin1-9971-0_cam-24-09_2024-03-24_11-52-49.json' %}
},
{
- "calibration": {% include 'y2024/constants/calib_files/calibration_orin-9971-1-1_cam-24-11_2024-02-24_16-44-06.986729504.json' %}
+ "calibration": {% include 'y2024/constants/calib_files/calibration_orin1-9971-1_cam-24-11_2024-03-24_11-52-49.json' %}
},
],
"robot": {
diff --git a/y2024/constants/calib_files/calibration_imu-971-1_cam-24-08_2024-03-01_11-02-11.982641320.json b/y2024/constants/calib_files/calibration_imu-971-0_cam-24-08_2024-03-01_11-02-11.json
similarity index 100%
rename from y2024/constants/calib_files/calibration_imu-971-1_cam-24-08_2024-03-01_11-02-11.982641320.json
rename to y2024/constants/calib_files/calibration_imu-971-0_cam-24-08_2024-03-01_11-02-11.json
diff --git a/y2024/constants/calib_files/calibration_orin-971-c-1_cam-24-05_2024-03-08_17-16-02.325066070.json b/y2024/constants/calib_files/calibration_imu-971-1_cam-24-05_2024-03-17_21-52-58.json
similarity index 65%
rename from y2024/constants/calib_files/calibration_orin-971-c-1_cam-24-05_2024-03-08_17-16-02.325066070.json
rename to y2024/constants/calib_files/calibration_imu-971-1_cam-24-05_2024-03-17_21-52-58.json
index c1d4e60..8e8b1a0 100755
--- a/y2024/constants/calib_files/calibration_orin-971-c-1_cam-24-05_2024-03-08_17-16-02.325066070.json
+++ b/y2024/constants/calib_files/calibration_imu-971-1_cam-24-05_2024-03-17_21-52-58.json
@@ -14,18 +14,18 @@
],
"fixed_extrinsics": {
"data": [
- 0.999556,
- -0.026613,
- 0.013428,
- 0.146979,
- -0.006922,
- 0.230925,
- 0.972947,
- 0.30388,
- -0.028994,
- -0.972608,
- 0.230638,
- 0.32572,
+ 0.999298,
+ -0.037458,
+ 0.000597,
+ 0.13845,
+ 0.00805,
+ 0.230258,
+ 0.973096,
+ 0.328324,
+ -0.036588,
+ -0.972409,
+ 0.230398,
+ 0.313802,
0.0,
0.0,
0.0,
@@ -39,7 +39,7 @@
-0.000078,
-0.008004
],
- "calibration_timestamp": 1709946962325066070,
+ "calibration_timestamp": 1710737578848658152,
"camera_id": "24-05",
"camera_number": 1,
"reprojection_error": 1.058851
diff --git a/y2024/constants/calib_files/calibration_imu-9971-1-0_cam-24-10_2024-02-24_16-44-05.975708672.json b/y2024/constants/calib_files/calibration_imu-9971-0_cam-24-10_2024-02-24_16-44-05.json
similarity index 63%
rename from y2024/constants/calib_files/calibration_imu-9971-1-0_cam-24-10_2024-02-24_16-44-05.975708672.json
rename to y2024/constants/calib_files/calibration_imu-9971-0_cam-24-10_2024-02-24_16-44-05.json
index 66ea94a..e5f50e3 100755
--- a/y2024/constants/calib_files/calibration_imu-9971-1-0_cam-24-10_2024-02-24_16-44-05.975708672.json
+++ b/y2024/constants/calib_files/calibration_imu-9971-0_cam-24-10_2024-02-24_16-44-05.json
@@ -12,6 +12,26 @@
0.0,
1.0
],
+ "fixed_extrinsics": {
+ "data": [
+ 0.0,
+ -0.258819,
+ -0.965926,
+ -0.323293,
+ 1.0,
+ 0.0,
+ -0.0,
+ 0.268249,
+ 0.0,
+ -0.965926,
+ 0.258819,
+ 0.471129,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ },
"dist_coeffs": [
-0.251594,
0.064935,
diff --git a/y2024/constants/calib_files/calibration_imu-9971-1-1_cam-24-12_2024-02-24_19-52-39.488095264.json b/y2024/constants/calib_files/calibration_imu-9971-1-1_cam-24-12_2024-02-24_19-52-39.488095264.json
deleted file mode 100755
index 7f8b6ad..0000000
--- a/y2024/constants/calib_files/calibration_imu-9971-1-1_cam-24-12_2024-02-24_19-52-39.488095264.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "node_name": "imu",
- "team_number": 9971,
- "intrinsics": [
- 647.19928,
- 0.0,
- 690.698181,
- 0.0,
- 646.449158,
- 530.162842,
- 0.0,
- 0.0,
- 1.0
- ],
- "dist_coeffs": [
- -0.249799,
- 0.062593,
- 0.00003,
- 0.000366,
- -0.006532
- ],
- "calibration_timestamp": 1708833159488095264,
- "camera_id": "24-12",
- "camera_number": 1,
- "reprojection_error": 1.23409
-}
diff --git a/y2024/constants/calib_files/calibration_imu-9971-1_cam-24-12_2024-03-24_11-52-49.json b/y2024/constants/calib_files/calibration_imu-9971-1_cam-24-12_2024-03-24_11-52-49.json
new file mode 100755
index 0000000..530e88a
--- /dev/null
+++ b/y2024/constants/calib_files/calibration_imu-9971-1_cam-24-12_2024-03-24_11-52-49.json
@@ -0,0 +1,46 @@
+{
+ "node_name": "imu",
+ "team_number": 9971,
+ "intrinsics": [
+ 647.19928,
+ 0.0,
+ 690.698181,
+ 0.0,
+ 646.449158,
+ 530.162842,
+ 0.0,
+ 0.0,
+ 1.0
+ ],
+ "fixed_extrinsics": {
+ "data": [
+ 0.99969,
+ 0.020217,
+ -0.014527,
+ 0.160342,
+ 0.009501,
+ 0.229548,
+ 0.973251,
+ 0.25208,
+ 0.023011,
+ -0.973088,
+ 0.229284,
+ 0.41504,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ },
+ "dist_coeffs": [
+ -0.249799,
+ 0.062593,
+ 0.00003,
+ 0.000366,
+ -0.006532
+ ],
+ "calibration_timestamp": 1711306369592332476,
+ "camera_id": "24-12",
+ "camera_number": 1,
+ "reprojection_error": 1.23409
+}
\ No newline at end of file
diff --git a/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-06_2024-03-08_17-16-02.325390283.json b/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-06_2024-03-08_17-16-02.325390283.json
deleted file mode 100755
index 48da468..0000000
--- a/y2024/constants/calib_files/calibration_orin-971-1-0_cam-24-06_2024-03-08_17-16-02.325390283.json
+++ /dev/null
@@ -1,46 +0,0 @@
-{
- "node_name": "orin1",
- "team_number": 971,
- "intrinsics": [
- 648.644104,
- 0.0,
- 755.677979,
- 0.0,
- 648.522644,
- 597.744812,
- 0.0,
- 0.0,
- 1.0
- ],
- "fixed_extrinsics": {
- "data": [
- -0.997807,
- 0.015704,
- -0.064302,
- 0.134715,
- 0.058111,
- -0.25731,
- -0.96458,
- -0.273849,
- -0.031694,
- -0.966201,
- 0.255833,
- 0.295681,
- 0.0,
- 0.0,
- 0.0,
- 1.0
- ]
- },
- "dist_coeffs": [
- -0.25182,
- 0.063137,
- 0.000118,
- 0.000005,
- -0.006342
- ],
- "calibration_timestamp": 1709946962325390283,
- "camera_id": "24-06",
- "camera_number": 0,
- "reprojection_error": 1.344104
-}
\ No newline at end of file
diff --git a/y2024/constants/calib_files/calibration_orin-9971-1-0_cam-24-09_2024-02-24_16-10-16.872521280.json b/y2024/constants/calib_files/calibration_orin-9971-1-0_cam-24-09_2024-02-24_16-10-16.872521280.json
deleted file mode 100755
index 068e3d2..0000000
--- a/y2024/constants/calib_files/calibration_orin-9971-1-0_cam-24-09_2024-02-24_16-10-16.872521280.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "node_name": "orin1",
- "team_number": 9971,
- "intrinsics": [
- 648.187805,
- 0.0,
- 736.903137,
- 0.0,
- 648.028687,
- 557.169861,
- 0.0,
- 0.0,
- 1.0
- ],
- "dist_coeffs": [
- -0.265564,
- 0.078084,
- -0.000231,
- 0.000386,
- -0.010425
- ],
- "calibration_timestamp": 1708819816872521280,
- "camera_id": "24-09",
- "camera_number": 0,
- "reprojection_error": 1.881098
-}
diff --git a/y2024/constants/calib_files/calibration_orin-9971-1-1_cam-24-11_2024-02-24_16-44-06.986729504.json b/y2024/constants/calib_files/calibration_orin-9971-1-1_cam-24-11_2024-02-24_16-44-06.986729504.json
deleted file mode 100755
index c94dcaa..0000000
--- a/y2024/constants/calib_files/calibration_orin-9971-1-1_cam-24-11_2024-02-24_16-44-06.986729504.json
+++ /dev/null
@@ -1,26 +0,0 @@
-{
- "node_name": "orin1",
- "team_number": 9971,
- "intrinsics": [
- 649.866699,
- 0.0,
- 709.355713,
- 0.0,
- 648.893066,
- 576.101868,
- 0.0,
- 0.0,
- 1.0
- ],
- "dist_coeffs": [
- -0.248092,
- 0.060938,
- 0.000313,
- 0.00009,
- -0.006163
- ],
- "calibration_timestamp": 1708821846986729504,
- "camera_id": "24-11",
- "camera_number": 1,
- "reprojection_error": 1.450069
-}
diff --git a/y2024/constants/calib_files/calibration_orin1-971-0_cam-24-06_2024-03-17_21-52-58.json b/y2024/constants/calib_files/calibration_orin1-971-0_cam-24-06_2024-03-17_21-52-58.json
new file mode 100755
index 0000000..56961e0
--- /dev/null
+++ b/y2024/constants/calib_files/calibration_orin1-971-0_cam-24-06_2024-03-17_21-52-58.json
@@ -0,0 +1,46 @@
+{
+ "node_name": "orin1",
+ "team_number": 971,
+ "intrinsics": [
+ 647.96582,
+ 0.0,
+ 755.529907,
+ 0.0,
+ 647.512146,
+ 585.378479,
+ 0.0,
+ 0.0,
+ 1.0
+ ],
+ "fixed_extrinsics": {
+ "data": [
+ -0.999075,
+ -0.02262,
+ -0.036586,
+ 0.15129,
+ 0.040353,
+ -0.198353,
+ -0.9793,
+ -0.217666,
+ 0.014895,
+ -0.97987,
+ 0.199082,
+ 0.26798,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ },
+ "dist_coeffs": [
+ -0.260101,
+ 0.072815,
+ -0.000107,
+ 0.000376,
+ -0.009155
+ ],
+ "calibration_timestamp": 2328053993530848,
+ "camera_id": "24-06",
+ "camera_number": 0,
+ "reprojection_error": 2.574085
+}
diff --git a/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-07_2024-03-08_17-16-02.325267121.json b/y2024/constants/calib_files/calibration_orin1-971-1_cam-24-07_2024-03-17_21-52-58.json
similarity index 65%
rename from y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-07_2024-03-08_17-16-02.325267121.json
rename to y2024/constants/calib_files/calibration_orin1-971-1_cam-24-07_2024-03-17_21-52-58.json
index 56072d4..1412d3e 100755
--- a/y2024/constants/calib_files/calibration_orin-971-1-1_cam-24-07_2024-03-08_17-16-02.325267121.json
+++ b/y2024/constants/calib_files/calibration_orin1-971-1_cam-24-07_2024-03-17_21-52-58.json
@@ -14,18 +14,18 @@
],
"fixed_extrinsics": {
"data": [
- 0.016995,
- 0.002328,
- 0.999853,
- 0.35278,
- 0.999839,
- -0.005785,
- -0.016981,
- 0.237526,
- 0.005745,
- 0.999981,
- -0.002426,
- 0.387276,
+ 0.00834,
+ 0.006439,
+ 0.999945,
+ 0.38743,
+ 0.999567,
+ -0.028281,
+ -0.008154,
+ 0.296717,
+ 0.028227,
+ 0.999579,
+ -0.006672,
+ 0.360483,
0.0,
0.0,
0.0,
@@ -39,7 +39,7 @@
0.000016,
-0.005638
],
- "calibration_timestamp": 1709946962325267121,
+ "calibration_timestamp": 1710737578849179056,
"camera_id": "24-07",
"camera_number": 1,
"reprojection_error": 1.362672
diff --git a/y2024/constants/calib_files/calibration_orin1-9971-0_cam-24-09_2024-03-24_11-52-49.json b/y2024/constants/calib_files/calibration_orin1-9971-0_cam-24-09_2024-03-24_11-52-49.json
new file mode 100755
index 0000000..97234c9
--- /dev/null
+++ b/y2024/constants/calib_files/calibration_orin1-9971-0_cam-24-09_2024-03-24_11-52-49.json
@@ -0,0 +1,46 @@
+{
+ "node_name": "orin1",
+ "team_number": 9971,
+ "intrinsics": [
+ 648.187805,
+ 0.0,
+ 736.903137,
+ 0.0,
+ 648.028687,
+ 557.169861,
+ 0.0,
+ 0.0,
+ 1.0
+ ],
+ "fixed_extrinsics": {
+ "data": [
+ -0.999204,
+ -0.034711,
+ -0.019682,
+ 0.162103,
+ 0.028118,
+ -0.262536,
+ -0.964512,
+ -0.329348,
+ 0.028312,
+ -0.964298,
+ 0.263303,
+ 0.562319,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ },
+ "dist_coeffs": [
+ -0.265564,
+ 0.078084,
+ -0.000231,
+ 0.000386,
+ -0.010425
+ ],
+ "calibration_timestamp": 1711306369593360533,
+ "camera_id": "24-09",
+ "camera_number": 0,
+ "reprojection_error": 1.881098
+}
\ No newline at end of file
diff --git a/y2024/constants/calib_files/calibration_orin1-9971-1_cam-24-11_2024-03-24_11-52-49.json b/y2024/constants/calib_files/calibration_orin1-9971-1_cam-24-11_2024-03-24_11-52-49.json
new file mode 100755
index 0000000..daef89c
--- /dev/null
+++ b/y2024/constants/calib_files/calibration_orin1-9971-1_cam-24-11_2024-03-24_11-52-49.json
@@ -0,0 +1,46 @@
+{
+ "node_name": "orin1",
+ "team_number": 9971,
+ "intrinsics": [
+ 649.866699,
+ 0.0,
+ 709.355713,
+ 0.0,
+ 648.893066,
+ 576.101868,
+ 0.0,
+ 0.0,
+ 1.0
+ ],
+ "fixed_extrinsics": {
+ "data": [
+ -0.014623,
+ 0.004459,
+ 0.999883,
+ 0.345385,
+ 0.997965,
+ 0.062137,
+ 0.014318,
+ 0.150131,
+ -0.062066,
+ 0.998058,
+ -0.005359,
+ 0.570236,
+ 0.0,
+ 0.0,
+ 0.0,
+ 1.0
+ ]
+ },
+ "dist_coeffs": [
+ -0.248092,
+ 0.060938,
+ 0.000313,
+ 0.00009,
+ -0.006163
+ ],
+ "calibration_timestamp": 1711306369592886702,
+ "camera_id": "24-11",
+ "camera_number": 1,
+ "reprojection_error": 1.450069
+}
\ No newline at end of file
diff --git a/y2024/constants/common.json b/y2024/constants/common.json
index 52fdb74..8a59b64 100644
--- a/y2024/constants/common.json
+++ b/y2024/constants/common.json
@@ -24,6 +24,13 @@
"shot_speed_over_ground": 16.0
}
},
+ {
+ "distance_from_goal": 2.404,
+ "shot_params": {
+ "shot_altitude_angle": 0.645,
+ "shot_speed_over_ground": 16.0
+ }
+ },
// 2.2 -> high.
{
"distance_from_goal": 2.744,
diff --git a/y2024/control_loops/superstructure/superstructure.cc b/y2024/control_loops/superstructure/superstructure.cc
index 9edc626..daede87 100644
--- a/y2024/control_loops/superstructure/superstructure.cc
+++ b/y2024/control_loops/superstructure/superstructure.cc
@@ -50,7 +50,7 @@
extend_(
robot_constants_->common()->extend(),
robot_constants_->robot()->extend_constants()->zeroing_constants()),
- extend_debouncer_(std::chrono::milliseconds(30),
+ extend_debouncer_(std::chrono::milliseconds(12),
std::chrono::milliseconds(8)),
transfer_debouncer_(std::chrono::milliseconds(30),
std::chrono::milliseconds(8)) {
@@ -701,6 +701,7 @@
extend_ready_for_catapult_transfer);
status_builder.add_extend_beambreak(extend_beambreak);
status_builder.add_catapult_beambreak(position->catapult_beambreak());
+ status_builder.add_transfer_beambreak(transfer_beambreak);
(void)status->Send(status_builder.Finish());
}
diff --git a/y2024/control_loops/superstructure/superstructure_status.fbs b/y2024/control_loops/superstructure/superstructure_status.fbs
index fd19e8d..0b30edd 100644
--- a/y2024/control_loops/superstructure/superstructure_status.fbs
+++ b/y2024/control_loops/superstructure/superstructure_status.fbs
@@ -181,6 +181,7 @@
extend_beambreak:bool (id: 19);
catapult_beambreak:bool (id: 20);
+ transfer_beambreak:bool (id: 22);
// Number of shots we have taken.
shot_count:uint32 (id:21);
diff --git a/y2024/www/BUILD b/y2024/www/BUILD
index 5cb57c4..b6b6b9b 100644
--- a/y2024/www/BUILD
+++ b/y2024/www/BUILD
@@ -55,11 +55,38 @@
],
)
+ts_project(
+ name = "starter_main",
+ srcs = [
+ "starter_handler.ts",
+ "starter_main.ts",
+ ],
+ target_compatible_with = ["@platforms//os:linux"],
+ deps = [
+ "//aos/network:connect_ts_fbs",
+ "//aos/network:message_bridge_client_ts_fbs",
+ "//aos/network/www:proxy",
+ "//aos/starter:starter_ts_fbs",
+ "@com_github_google_flatbuffers//ts:flatbuffers_ts",
+ ],
+)
+
+rollup_bundle(
+ name = "starter_main_bundle",
+ entry_point = "starter_main.ts",
+ target_compatible_with = ["@platforms//os:linux"],
+ visibility = ["//y2024:__subpackages__"],
+ deps = [
+ ":starter_main",
+ ],
+)
+
aos_downloader_dir(
name = "www_files",
srcs = [
":field_main_bundle.min.js",
":files",
+ ":starter_main_bundle.min.js",
"//frc971/analysis:plot_index_bundle.min.js",
],
dir = "www",
diff --git a/y2024/www/field.html b/y2024/www/field.html
index 8fd4ebb..ebb03e5 100644
--- a/y2024/www/field.html
+++ b/y2024/www/field.html
@@ -77,12 +77,16 @@
<th colspan="2">Beambreaks</th>
</tr>
<tr>
+ <td>Transfer Beambreak</td>
+ <td id="transfer_beambreak"> NA </td>
+ </tr>
+ <tr>
<td>Extend Beambreak</td>
- <td id="extend_beambreak">FALSE</td>
+ <td id="extend_beambreak"> NA </td>
</tr>
<tr>
<td>Catapult Beambreak</td>
- <td id="catapult_beambreak">FALSE</td>
+ <td id="catapult_beambreak"> NA </td>
</tr>
<tr>
<th colspan="2">Subsytems At Position</th>
diff --git a/y2024/www/field_handler.ts b/y2024/www/field_handler.ts
index 1b4ad1e..7b5e0f4 100644
--- a/y2024/www/field_handler.ts
+++ b/y2024/www/field_handler.ts
@@ -78,6 +78,8 @@
(document.getElementById('extend_beambreak') as HTMLElement);
private catapult_beambreak: HTMLElement =
(document.getElementById('catapult_beambreak') as HTMLElement);
+ private transfer_beambreak: HTMLElement =
+ (document.getElementById('transfer_beambreak') as HTMLElement);
private extend_at_retracted: HTMLElement =
(document.getElementById('extend_at_retracted') as HTMLElement);
@@ -477,12 +479,11 @@
setBoolean(div: HTMLElement, triggered: boolean): void {
div.innerHTML = ((triggered) ? "TRUE" : "FALSE")
+ div.className = '';
if (triggered) {
- div.classList.remove('false');
- div.classList.add('true');
+ div.classList.add('lightgreen');
} else {
- div.classList.remove('true');
- div.classList.add('false');
+ div.classList.add('lightcoral');
}
}
@@ -514,6 +515,8 @@
this.setBoolean(this.catapult_beambreak, this.superstructureStatus.catapultBeambreak());
+ this.setBoolean(this.transfer_beambreak, this.superstructureStatus.transferBeambreak());
+
this.setBoolean(this.extend_ready_for_transfer, this.superstructureStatus.extendReadyForTransfer());
this.setBoolean(this.extend_at_retracted, this.superstructureStatus.extendAtRetracted());
diff --git a/y2024/www/index.html b/y2024/www/index.html
index e4e185e..98ecf42 100644
--- a/y2024/www/index.html
+++ b/y2024/www/index.html
@@ -1,6 +1,7 @@
<html>
<body>
<a href="field.html">Field Visualization</a><br>
- <a href="plotter.html">Plots</a>
+ <a href="plotter.html">Plots</a><br>
+ <a href="starter.html">AOS Starter Status</a>
</body>
</html>
diff --git a/y2024/www/starter.html b/y2024/www/starter.html
new file mode 100644
index 0000000..9060332
--- /dev/null
+++ b/y2024/www/starter.html
@@ -0,0 +1,11 @@
+<html>
+ <head>
+ <script src="starter_main_bundle.min.js" defer></script>
+ <link rel="stylesheet" href="styles.css">
+ </head>
+ <body>
+ <div>
+ <div id="status_list"></div>
+ </div>
+ </body>
+</html>
\ No newline at end of file
diff --git a/y2024/www/starter_handler.ts b/y2024/www/starter_handler.ts
new file mode 100644
index 0000000..2b953f3
--- /dev/null
+++ b/y2024/www/starter_handler.ts
@@ -0,0 +1,178 @@
+import {ByteBuffer} from 'flatbuffers'
+import {Connection} from '../../aos/network/www/proxy'
+import {Status, ApplicationStatus, State, LastStopReason, FileState} from '../../aos/starter/starter_generated'
+
+const NODES = ['/orin1', '/imu', '/roborio'];
+
+export class StarterHandler {
+ private statuses = new Map<string, ApplicationStatus[]>();
+
+ private statusList: HTMLElement =
+ (document.getElementById('status_list') as HTMLElement);
+
+ constructor(private readonly connection: Connection) {
+ for (const node in NODES) {
+ this.connection.addConfigHandler(() => {
+ this.connection.addHandler(
+ NODES[node] + '/aos', 'aos.starter.Status', (data) => {
+ this.handleStatus(data, NODES[node]);
+ });
+ });
+ }
+ }
+
+ private handleStatus(data: Uint8Array, node: string): void {
+ const fbBuffer = new ByteBuffer(data);
+ const status: Status = Status.getRootAsStatus(fbBuffer);
+
+ const temp: ApplicationStatus[] = new Array(status.statusesLength());
+
+ for (let i = 0; i < status.statusesLength(); i++) {
+ temp[i] = status.statuses(i);
+ }
+
+ this.statuses.set(node, temp);
+ }
+
+ setStateColor(div: HTMLElement): void {
+ div.className = '';
+ switch (div.innerHTML) {
+ case 'WAITING':
+ div.classList.add('yellow');
+ break;
+ case 'STARTING':
+ div.classList.add('yellowgreen');
+ break;
+ case 'RUNNING':
+ div.classList.add('lightgreen');
+ break;
+ case 'STOPPING':
+ div.classList.add('lightcoral');
+ break;
+ case 'STOPPED':
+ div.classList.add('lightcoral');
+ break;
+ }
+ }
+
+ setFileStateColor(div: HTMLElement): void {
+ div.className = '';
+ switch (div.innerHTML) {
+ case 'NOT_RUNNING':
+ div.classList.add('lightgreen');
+ break;
+ case 'NO_CHANGE':
+ div.classList.add('lightgreen');
+ break;
+ case 'CHANGED_DURING_STARTUP':
+ div.classList.add('lightcoral');
+ break;
+ case 'CHANGED':
+ div.classList.add('lightcoral');
+ break;
+ }
+ }
+
+ private populateStatusList() : void {
+ this.clearStatusList();
+
+ const ELEMENTS: string[] = [
+ 'name',
+ 'node',
+ 'state',
+ 'last_exit_code',
+ 'pid',
+ // 'id',
+ 'last_start_time',
+ 'last_stop_reason',
+ // 'process_info',
+ // 'has_active_timing_report',
+ 'file_state'
+ ];
+
+ // This is to add the field names as the top row
+ //---------------------------------------------------
+ const row = document.createElement('div');
+ row.className = "column_names";
+
+ for (const e in ELEMENTS) {
+ const element = document.createElement('div');
+ element.className = ELEMENTS[e];
+ element.innerHTML = ELEMENTS[e].toUpperCase();
+ element.style.fontWeight = 'bold';
+ row.appendChild(element);
+ }
+
+ this.statusList.appendChild(row);
+ //---------------------------------------------------
+
+ for (const node in NODES) {
+ const currentStatus = this.statuses.get(NODES[node]);
+
+ if (currentStatus) {
+ currentStatus.forEach(status => {
+ const row = document.createElement('div');
+ row.className = status.name();
+
+ for (const e in ELEMENTS) {
+ const element = document.createElement('div');
+ element.className = ELEMENTS[e];
+
+ switch (element.className) {
+ case 'name':
+ element.innerHTML = status.name();
+ break;
+ case 'node':
+ element.innerHTML = NODES[node];
+ break;
+ case 'state':
+ element.innerHTML = State[status.state()];
+ this.setStateColor(element);
+ break;
+ case 'last_exit_code':
+ element.innerHTML = status.lastExitCode().toString();
+ break;
+ case 'pid':
+ element.innerHTML = status.pid().toString();
+ break;
+ case 'last_start_time':
+ element.innerHTML = Number(status.lastStartTime() / 1000000000n).toString() + ' sec';
+ break;
+ case 'last_stop_reason':
+ element.innerHTML = LastStopReason[status.lastStopReason()];
+ break;
+ case 'file_state':
+ element.innerHTML = FileState[status.fileState()];
+ this.setFileStateColor(element);
+ break;
+ default:
+ element.innerHTML = "NA";
+ break;
+ }
+ row.appendChild(element);
+ }
+
+ this.statusList.appendChild(row);
+ })
+ }
+ }
+ }
+
+ private clearStatusList(): void {
+ if (!this.statusList) {
+ return;
+ }
+
+ while (this.statusList.firstChild) {
+ this.statusList.removeChild(this.statusList.firstChild);
+ }
+ }
+
+ draw(): void {
+ if (this.statuses) {
+ this.populateStatusList();
+ }
+
+ window.requestAnimationFrame(() => this.draw());
+ }
+}
diff --git a/y2024/www/starter_main.ts b/y2024/www/starter_main.ts
new file mode 100644
index 0000000..e9d23fa
--- /dev/null
+++ b/y2024/www/starter_main.ts
@@ -0,0 +1,11 @@
+import {Connection} from '../../aos/network/www/proxy';
+
+import {StarterHandler} from './starter_handler';
+
+const conn = new Connection();
+
+conn.connect();
+
+const starterHandler = new StarterHandler(conn);
+
+starterHandler.draw();
diff --git a/y2024/www/styles.css b/y2024/www/styles.css
index a11187b..c5e0409 100644
--- a/y2024/www/styles.css
+++ b/y2024/www/styles.css
@@ -142,10 +142,34 @@
width: 100%;
}
-.true {
+#status_list > div {
+ display: table-row;
+ padding: 3px;
+}
+
+#status_list > div > div {
+ display: table-cell;
+ padding: 10px;
+ text-align: left;
+}
+
+
+.yellow {
+ background-color: yellow;
+}
+
+.yellowgreen {
+ background-color: yellowgreen;
+}
+
+.lightgreen {
background-color: LightGreen;
}
-.false {
+.lightcoral {
+ background-color: lightcoral;
+}
+
+.red {
background-color: red;
}