Skip to content

Node extraction quality: expose hypothesis-strength ratio + deterministic tie-break #49

Description

@rolker

Summary

From the #30 comparison against Calder's original CUBE. Two node-extraction
quality improvements: surface the hypothesis-strength ratio Calder computes, and
make hypothesis tie-breaking deterministic.

Part of #30.

1. Expose the hypothesis-strength ratio (real diagnostic value)

Calder's depth extraction returns a hypothesis-strength ratio — a measure of
how dominant the chosen hypothesis is over the runners-up
(max(0, MAX_HYPOTHESIS_RATIO - N_best/N_rest), cube_node.c:1566-1586,
:2108-2112). It does not change the chosen depth; it is a node-ambiguity
signal
. The port's extractDepthAndUncertainty (node.cpp:167-187) drops it.

Exposing it (e.g. as a third grid layer alongside elevation/uncertainty) would
let CAMP/rviz flag cells where multiple competing depth hypotheses survive —
useful for QA and for steering re-survey.

2. Deterministic tie-break

Calder stores hypotheses in a push-down linked list (newest at head); the port
uses a std::vector with push_back (newest at tail), reversing iteration. On an
exact error / num_samples tie the two pick different hypotheses
(bestHypothesis node.cpp:65-79, chooseHypothesis :189-200). Calder's own
qsort comparator never returns 0, so its tie outcome is also undefined.

Exact float ties are vanishingly rare in practice, but a defined rule makes the
behavior testable. Add an explicit tie-break (e.g. on a tie, prefer higher
num_samples, then lower current_variance, then most-recent) and a test that
pins it.

Acceptance

  • Hypothesis-strength ratio computed and surfaced from node extraction (+ optional
    grid layer); test pins the ratio for a known multi-hypothesis node.
  • Deterministic tie-break rule implemented in both selection paths; test asserts
    the chosen hypothesis on a constructed exact tie.

Authored-By: Claude Code Agent
Model: Claude Opus 4.8 (1M context)

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions