Publish local frustum hint state

This commit is contained in:
Meta Vens 2026-05-31 22:56:49 +01:00
commit 7898a87f20
5 changed files with 86 additions and 5 deletions

View file

@ -1160,9 +1160,13 @@ static int RunFrustumCalibrationSmoke()
markerSetId: "move-and-eve-feature-markers",
maximumDeltaMeters: 0.20,
maximumRotationDeltaDegrees: 12.0);
var featureHint = MimirCultMeshContractFactory.CreateLocalFrustumHintState(
"eve-nightwing-local-frustum-hints",
"starfire-calibration-smoke",
featureFrame);
Console.WriteLine(
$"frustum-calibration-smoke ledUpdates={frame.FrustumUpdates.Count} featureUpdates={featureFrame.FrustumUpdates.Count} confidence={frame.Confidence:0.000}/{featureFrame.Confidence:0.000} meanClipError={frame.MeanReprojectionErrorClip:0.000000}/{featureFrame.MeanReprojectionErrorClip:0.000000} sources={string.Join(",", frame.FrustumUpdates.Select(static update => $"{update.SourceId}:{update.UsedPointCount}/{update.RotationDeltaDegrees:0.00}deg/{update.HorizontalTanHalfFov:0.000}x{update.VerticalTanHalfFov:0.000}"))}");
$"frustum-calibration-smoke ledUpdates={frame.FrustumUpdates.Count} featureUpdates={featureFrame.FrustumUpdates.Count} hintFrustums={featureHint.Frustums.Length} confidence={frame.Confidence:0.000}/{featureFrame.Confidence:0.000} meanClipError={frame.MeanReprojectionErrorClip:0.000000}/{featureFrame.MeanReprojectionErrorClip:0.000000} sources={string.Join(",", frame.FrustumUpdates.Select(static update => $"{update.SourceId}:{update.UsedPointCount}/{update.RotationDeltaDegrees:0.00}deg/{update.HorizontalTanHalfFov:0.000}x{update.VerticalTanHalfFov:0.000}"))}");
return frame.HasFrustumUpdate &&
featureFrame.HasFrustumUpdate &&
@ -1172,6 +1176,9 @@ static int RunFrustumCalibrationSmoke()
featureFrame.FrustumUpdates.All(update => update.UsedPointCount == scenePoints.Length) &&
frame.FrustumUpdates.All(static update => update.MeanReprojectionErrorClip < 0.010) &&
featureFrame.FrustumUpdates.All(static update => update.MeanReprojectionErrorClip < 0.010) &&
featureHint.MarkerSetId == "move-and-eve-feature-markers" &&
featureHint.Frustums.Length == truth.Length &&
featureHint.Frustums.Any(static frustum => frustum.SourceId == "eve-camera") &&
frame.Confidence >= 0.70 &&
featureFrame.Confidence >= 0.70
? 0

View file

@ -263,6 +263,37 @@ public sealed record MimirEveMediaObservationDocument(
[property: Key(15)] string PayloadEncoding,
[property: Key(16)] byte[] Payload);
[CultDocument("mimir.local_frustum_hint_state", "mimir.local_frustum_hint_state.v1")]
[MessagePackObject]
public sealed record MimirLocalFrustumHintStateDocument(
[property: Key(0)]
[property: CultName]
string HintId,
[property: Key(1)] string UpdatedAtUtc,
[property: Key(2)] string ProducerNodeId,
[property: Key(3)] string CalibrationId,
[property: Key(4)] string CandidateKey,
[property: Key(5)] string MarkerSetId,
[property: Key(6)] double MeanReprojectionErrorClip,
[property: Key(7)] double Confidence,
[property: Key(8)] MimirLocalFrustumSnapshot[] Frustums);
[MessagePackObject]
public sealed record MimirLocalFrustumSnapshot(
[property: Key(0)] string SourceId,
[property: Key(1)] float PositionX,
[property: Key(2)] float PositionY,
[property: Key(3)] float PositionZ,
[property: Key(4)] float RotationX,
[property: Key(5)] float RotationY,
[property: Key(6)] float RotationZ,
[property: Key(7)] float RotationW,
[property: Key(8)] double HorizontalTanHalfFov,
[property: Key(9)] double VerticalTanHalfFov,
[property: Key(10)] int UsedPointCount,
[property: Key(11)] double MeanReprojectionErrorClip,
[property: Key(12)] double Confidence);
public static class MimirCultMeshContractFactory
{
public static MimirBioacousticCodebookState CreateCodebookState(
@ -334,6 +365,38 @@ public static class MimirCultMeshContractFactory
.Select(pair => new MimirFaustControlSnapshot(pair.Key, pair.Value))
.ToArray());
public static MimirLocalFrustumHintStateDocument CreateLocalFrustumHintState(
string hintId,
string producerNodeId,
MimirCameraFrustumSolveFrame frame,
DateTimeOffset? updatedAt = null) =>
new(
hintId,
(updatedAt ?? DateTimeOffset.UtcNow).ToString("O"),
producerNodeId,
frame.CalibrationId,
frame.CandidateKey,
frame.MarkerSetId,
frame.MeanReprojectionErrorClip,
frame.Confidence,
frame.FrustumUpdates
.OrderBy(update => update.SourceId, StringComparer.Ordinal)
.Select(update => new MimirLocalFrustumSnapshot(
update.SourceId,
update.EstimatedPositionMeters.X,
update.EstimatedPositionMeters.Y,
update.EstimatedPositionMeters.Z,
update.EstimatedCameraToWorldRotation.X,
update.EstimatedCameraToWorldRotation.Y,
update.EstimatedCameraToWorldRotation.Z,
update.EstimatedCameraToWorldRotation.W,
update.HorizontalTanHalfFov,
update.VerticalTanHalfFov,
update.UsedPointCount,
update.MeanReprojectionErrorClip,
update.Confidence))
.ToArray());
private static MimirBioacousticDecoderConfigurationSnapshot Snapshot(MimirBioacousticDecoderConfiguration configuration) =>
new(
configuration.Id,