allMetrics property

  1. @override
List<MetricLine> get allMetrics
override

A list of user-friendly explanations for each of the metrics.

Be sure to store the actual values as fields. This property should be a list of one user-friendly explanation per metric.

Implementation

@override
List<MetricLine> get allMetrics => [
  if (cameraDetections.isEmpty)
    MetricLine("No Aruco Visible"),
  for (final detection in cameraDetections) ...[
    ...detection.detectedObjects
        .sorted((a, b) => b.relativeSize.compareTo(a.relativeSize))
        .expandIndexed((index, target) sync* {
      if (index != 0) {
        yield MetricLine("--");
      }
      yield MetricLine("Aruco #${target.arucoTagId}:");
      yield MetricLine("  Camera: ${detection.details.name.humanName}");
      yield MetricLine("  Center: (${target.centerX}, ${target.centerY})");
      yield MetricLine("  Yaw: ${target.yaw.toStringAsFixed(2)}°");
      yield MetricLine("  Pitch: ${target.pitch.toStringAsFixed(2)}°");
      yield MetricLine("  Area: ${(target.relativeSize * 100).toStringAsFixed(2)}%");
      if (target.hasBestPnpResult()) {
        yield MetricLine("  3D Pose Estimation:");
        final bestPose = target.bestPnpResult.cameraToTarget;
        yield MetricLine("    Best Camera to Target:");
        yield MetricLine("      x: ${bestPose.translation.x.toStringAsFixed(3)}m");
        yield MetricLine("      y: ${bestPose.translation.y.toStringAsFixed(3)}m");
        yield MetricLine("      z: ${bestPose.translation.z.toStringAsFixed(3)}m");
        yield MetricLine("      roll: ${bestPose.rotation.x.toStringAsFixed(2)}°");
        yield MetricLine("      pitch: ${bestPose.rotation.y.toStringAsFixed(2)}°");
        yield MetricLine("      yaw: ${bestPose.rotation.z.toStringAsFixed(2)}°");
        yield MetricLine("    Best Reprojection Error: ${target.bestPnpResult.reprojectionError.toStringAsFixed(3)}");
      }
    }),
  ],
];