Calibrated ground-plane measurements from timestamped object tracks
检测结果 → MBMOT 身份轨迹 → 显式选择地面锚点 → MoonGround 米制测量 → 通道过线事件
↑ ↑
检测质量可用 MoonDetEval moon-cv-geometry
+ moon-kalman| 入口 | 用途 |
|---|---|
| 根包 | GroundCalibration、MeasurementSession、MeasurementCheckpoint、PixelTransform、像素观测和测量结果 |
| calibration | 严格与稳健控制点拟合、逐点诊断、独立检查点、矩阵导入、有效域、像素协方差投影,以及显式共享标定模式的点对、长度差值/比值、方向及有向夹角、凸多边形面积差值/比值误差传播 |
| camera | 有效域受限的 Brown–Conrady 镜头校正、像素协方差转换与地面投影组合 |
| motion | 已有米制观测的时间处理、运动估计、分段与 MotionCheckpoint |
| events | 消费 motion.FrameResult 的有向有限通道;均值计数 GateCounter 与法向协方差证据计数 EvidenceGateCounter 各自保存完整状态 |
| analysis | 像素/米制测量与均值或法向证据计数的原子更新,分别保存完整检查点,并可直接联合证据区间通行及确认时刻分窗,支持独立分支与像素换算 |
| health | 独立固定地标的逐点残差、连续采样证据确认、完整 HealthCheckpoint 与像素换算 |
| guarded | 当前地标确认健康后计算对象,阻断时结束片段;均值/法向证据门控、证据通行及其确认分窗分别保存完整检查点,支持投影切换与重新确认 |
| transit | 同目标同片段的有向入口/出口配对、通行时间界与插值估计、取消原因;均值/法向证据策略分别保存独立完整检查点;已完成证据通行可按确认时刻分窗、按时长界分类 |
| velocity | 指定地面方向的速度分量、完整速度协方差投影与三态阈值证据;帧入口只采用当前 Ready 测量,无持久化状态 |
| zones | 米制凸区域的位置协方差支持区间与三态关系;可显式加入确定性圆盘或非对称凸足迹,保留位置/形状支持/组合区间及分离边,可按精确帧时间和目标片段逐个分配;独立监视器保存同形状确认样本序列与完整检查点 |
| codec | 原生 CLI 与浏览器共用的严格 JSON 协议、检查点、坐标转换,以及独立/联合测量、通道、证据、地标健康、门控与区间回放 |
///|
test "README: three contact observations produce a measured speed" {
let calibration = @moonground.GroundCalibration::from_homography(
[0.01, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 1.0],
[
@moonground.Point2::new(0.0, 0.0),
@moonground.Point2::new(640.0, 0.0),
@moonground.Point2::new(640.0, 480.0),
@moonground.Point2::new(0.0, 480.0),
],
)
let session = @moonground.MeasurementSession::new(
"warehouse-contact-points",
calibration,
@moonground.MotionConfig::new(),
)
let observe = (x : Double) => {
@moonground.PixelObservation::new(
7,
@moonground.Point2::new(x, 200.0),
@moonground.Covariance2::isotropic(0.25),
)
}
let first = session.update(0L, [observe(100.0)])
assert_true(first.motion.tracks[0].speed_mps is None)
let counter = @events.GateCounter::new(
"warehouse-contact-points",
[
@events.LineGate::new(
"aisle",
@moonground.Point2::new(1.15, 0.0),
@moonground.Point2::new(1.15, 4.0),
deadband_m=0.01,
),
],
@events.GateConfig::new(),
)
ignore(counter.update(first.motion))
let second = session.update(200000L, [observe(110.0)])
ignore(counter.update(second.motion))
let third = session.update(400000L, [observe(120.0)])
let counted = counter.update(third.motion)
assert_eq(counted.counts[0].positive_to_negative, 1L)
assert_eq(counted.crossings[0].direction, @events.PositiveToNegative)
match third.motion.tracks[0].speed_mps {
Some(speed) => assert_true(speed > 0.45 && speed < 0.55)
None => fail("three accepted observations should produce a speed")
}
// Both components are at 400000 us; joining validates and detaches them.
let analysis = @analysis.AnalysisSession::from_pixel(session, counter)
let analysis_restored = @analysis.AnalysisSession::from_checkpoint(
analysis.checkpoint(),
)
let restored = @moonground.MeasurementSession::from_checkpoint(
session.checkpoint(),
)
let continued = session.update(600000L, [observe(130.0)])
let resumed = restored.update(600000L, [observe(130.0)])
let combined = analysis.update_pixel(600000L, [observe(130.0)])
let combined_resumed = analysis_restored.update_pixel(600000L, [
observe(130.0),
])
assert_eq(
combined.measurement.motion.tracks[0].filtered_state,
continued.motion.tracks[0].filtered_state,
)
assert_eq(
combined_resumed.measurement.motion.tracks[0].filtered_state,
combined.measurement.motion.tracks[0].filtered_state,
)
assert_eq(combined.counting.counts[0].positive_to_negative, 1L)
assert_eq(
resumed.motion.tracks[0].filtered_state,
continued.motion.tracks[0].filtered_state,
)
assert_eq(
resumed.motion.tracks[0].filtered_covariance,
continued.motion.tracks[0].filtered_covariance,
)
assert_eq(
resumed.motion.tracks[0].observed_path_length_m,
continued.motion.tracks[0].observed_path_length_m,
)
let transform = @moonground.PixelTransform::new(
scale_x=0.5,
scale_y=0.75,
offset_x=-40.0,
offset_y=16.0,
)
let reframed = session.reframed(transform)
assert_eq(
reframed.checkpoint().motion.tracks[0].state,
session.checkpoint().motion.tracks[0].state,
)
let next = reframed.update(800000L, [observe(140.0).reframed(transform)])
assert_eq(next.motion.tracks[0].accepted_count, 5)
assert_eq(next.motion.tracks[0].segment_id, "1")
let analysis_reframed = analysis.reframed(transform)
let combined_next = analysis_reframed.update_pixel(800000L, [
observe(140.0).reframed(transform),
])
assert_eq(
combined_next.measurement.motion.tracks[0].filtered_state,
next.motion.tracks[0].filtered_state,
)
assert_eq(combined_next.counting.counts[0].positive_to_negative, 1L)
}| 配置 | 默认值 |
|---|---|
| 速度就绪条件 | 至少 3 次接受观测,首末接受观测跨度至少 0.3 秒 |
| 接受观测最大间隔 | 0.5 秒;达到边界即关闭旧段 |
| NIS 创新门限 | 9.21034 |
| 活跃目标上限 | 1000 |
| CLI 像素观测标准差 | 未指定协方差时为 2 像素 |
| CLI ground 模式标准差 | 未指定协方差时为 0.05 米 |
| 地面附加噪声下限 | 标准差 0.001 米 |
| max_position_std_m、max_velocity_std_mps | 未设置;可分别启用位置、速度不确定性门限 |
{"camera": {"fx":600,"fy":580,"cx":320,"cy":240,"k1":-0.12,"k2":0.015,"p1":0.001,"p2":-0.002,"k3":0.001,"max_normalized_radius":0.8}}///|
test "README: robust fitting reports mislabeled controls" {
let controls : Array[@moonground.Point2] = [
{ x: 0.0, y: 0.0, },
{ x: 100.0, y: 0.0, },
{ x: 100.0, y: 100.0, },
{ x: 0.0, y: 100.0, },
{ x: 25.0, y: 50.0, },
{ x: 70.0, y: 30.0, },
{ x: 40.0, y: 80.0, },
{ x: 60.0, y: 10.0, },
]
let world = controls.map(p => @moonground.Point2::{
x: p.x * 0.02,
y: p.y * 0.02,
})
world[6] = { x: 1.8, y: 0.6, }
world[7] = { x: 0.2, y: 2.2, }
let checks : Array[@moonground.Point2] = [
{ x: 20.0, y: 30.0, },
{ x: 80.0, y: 70.0, },
]
let fitted = @moonground.GroundCalibration::fit_robust(
controls,
world,
checks,
checks.map(p => @moonground.Point2::{ x: p.x * 0.02, y: p.y * 0.02, }),
controls[:4].to_owned(),
options=@moonground.RobustFitOptions::new(inlier_threshold_m=0.01),
)
assert_eq(fitted.inlier_mask(), [
true, true, true, true, true, true, false, false,
])
assert_eq(fitted.calibration().report().fit_count(), 6)
}| RobustFitOptions 字段 | 默认值与范围 |
|---|---|
| inlier_threshold_m | 0.05 米,有限正数 |
| min_inlier_ratio | 0.6,范围 (0,1];最终还须至少六个内点 |
| max_trials | 512,范围 1—4096 |
| seed | 1,范围 1—2147483647 |
./_build/native/release/build/cmd/main/main.exe --calibrate < examples/robust-calibration.json///|
test {
let calibration = @moonground.GroundCalibration::from_homography(
[0.1, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 1.0],
[
{ x: 0.0, y: 0.0, },
{ x: 100.0, y: 0.0, },
{ x: 100.0, y: 100.0, },
{ x: 0.0, y: 100.0, },
],
)
// The mode uses calibration.matrix()'s normalized nine-coefficient gauge.
let model = @calibration.HomographySensitivity::new(calibration, [
[0.0, 0.0, 0.25, 0.0, 0.0, 0.5, 0.0, 0.0, 0.0],
])
let pair = model.evaluate_pair({ x: 20.0, y: 20.0, }, { x: 80.0, y: 60.0, })
assert_eq(pair.first.contribution_m2.xx, 0.0625)
assert_eq(pair.cross_contribution_m2(), [0.0625, 0.125, 0.125, 0.25])
assert_eq(pair.displacement_contribution_m2.xx, 0.0)
assert_eq(pair.displacement_contribution_m2.yy, 0.0)
}///|
test "README: shared calibration scale cancels from a length ratio" {
let calibration = @moonground.GroundCalibration::from_homography(
[0.125, 0.0, 0.0, 0.0, 0.125, 0.0, 0.0, 0.0, 1.0],
[
{ x: 0.0, y: 0.0, },
{ x: 100.0, y: 0.0, },
{ x: 100.0, y: 100.0, },
{ x: 0.0, y: 100.0, },
],
)
let model = @calibration.HomographySensitivity::new(calibration, [
[0.015625, 0.0, 0.0, 0.0, 0.015625, 0.0, 0.0, 0.0, 0.0],
])
let comparison = model.compare_distances(
{ x: 0.0, y: 0.0, },
{ x: 24.0, y: 32.0, },
{ x: 0.0, y: 0.0, },
{ x: 80.0, y: 0.0, },
)
assert_eq(comparison.first.distance_m, 5.0)
assert_eq(comparison.second.distance_m, 10.0)
assert_eq(comparison.cross_contribution_m2, 0.78125)
assert_eq(comparison.difference_std_m, 0.625)
assert_eq(comparison.ratio, 0.5)
assert_eq(comparison.ratio_contribution, 0.0)
}///|
test "README: shared calibration rotation cancels from a directed angle" {
let calibration = @moonground.GroundCalibration::from_homography(
[0.125, 0.0, 0.0, 0.0, 0.125, 0.0, 0.0, 0.0, 1.0],
[
{ x: 0.0, y: 0.0, },
{ x: 100.0, y: 0.0, },
{ x: 100.0, y: 100.0, },
{ x: 0.0, y: 100.0, },
],
)
let model = @calibration.HomographySensitivity::new(calibration, [
[0.0, -0.015625, 0.0, 0.015625, 0.0, 0.0, 0.0, 0.0, 0.0],
])
let comparison = model.compare_directions(
{ x: 0.0, y: 0.0, },
{ x: 24.0, y: 32.0, },
{ x: 0.0, y: 0.0, },
{ x: 0.0, y: 80.0, },
)
assert_eq(comparison.first.std_rad, 0.125)
assert_eq(comparison.second.std_rad, 0.125)
assert_eq(comparison.cross_contribution_rad2, 0.015625)
assert_eq(comparison.mode_responses_rad(), [0.0])
assert_eq(comparison.contribution_rad2, 0.0)
assert_true((comparison.angle_rad - 0.6435011087932844).abs() < 1.0e-14)
}///|
test "README: shared calibration scale cancels from a convex area ratio" {
let calibration = @moonground.GroundCalibration::from_homography(
[0.125, 0.0, 0.0, 0.0, 0.125, 0.0, 0.0, 0.0, 1.0],
[
{ x: 0.0, y: 0.0, },
{ x: 100.0, y: 0.0, },
{ x: 100.0, y: 100.0, },
{ x: 0.0, y: 100.0, },
],
)
let model = @calibration.HomographySensitivity::new(calibration, [
[0.015625, 0.0, 0.0, 0.0, 0.015625, 0.0, 0.0, 0.0, 0.0],
])
let comparison = model.compare_areas(
[{ x: 0.0, y: 0.0, }, { x: 32.0, y: 0.0, }, { x: 0.0, y: 32.0, }],
[{ x: 0.0, y: 0.0, }, { x: 64.0, y: 0.0, }, { x: 0.0, y: 64.0, }],
)
assert_eq(comparison.first.area_m2, 8.0)
assert_eq(comparison.second.area_m2, 32.0)
assert_eq(comparison.cross_contribution_m4, 16.0)
assert_eq(comparison.difference_m2, -24.0)
assert_eq(comparison.difference_std_m2, 6.0)
assert_eq(comparison.ratio, 0.25)
assert_eq(comparison.ratio_mode_responses(), [0.0])
assert_eq(comparison.ratio_std, 0.0)
}///|
test "README: fixed landmarks confirm calibration evidence and reset on missing data" {
let calibration = @moonground.GroundCalibration::from_homography(
[0.01, 0.0, 0.0, 0.0, 0.01, 0.0, 0.0, 0.0, 1.0],
[
{ x: 0.0, y: 0.0, },
{ x: 640.0, y: 0.0, },
{ x: 640.0, y: 480.0, },
{ x: 0.0, y: 480.0, },
],
)
let landmarks = [
@health.KnownLandmark::new("A", { x: 1.0, y: 1.0, }),
@health.KnownLandmark::new("B", { x: 5.0, y: 1.0, }),
@health.KnownLandmark::new("C", { x: 5.0, y: 4.0, }),
]
let monitor = @health.CalibrationMonitor::new(
calibration,
landmarks,
@health.HealthConfig::new(),
)
let observations = (shift_pixels : Double) => {
landmarks.map(landmark => {
@health.LandmarkObservation::new(
landmark.landmark_id,
{
x: landmark.ground_m.x / 0.01 + shift_pixels,
y: landmark.ground_m.y / 0.01,
},
@moonground.Covariance2::isotropic(0.25),
)
})
}
assert_eq(monitor.update(0L, observations(0.0)).status, @health.Pending)
ignore(monitor.update(150000L, observations(0.0)))
assert_eq(monitor.update(300000L, observations(0.0)).status, @health.Healthy)
assert_eq(monitor.update(400000L, observations(30.0)).status, @health.Pending)
ignore(monitor.update(550000L, observations(30.0)))
assert_eq(monitor.update(700000L, observations(30.0)).status, @health.Drift)
let restored = @health.CalibrationMonitor::from_checkpoint(
monitor.checkpoint(),
)
let incomplete = restored.update(800000L, [])
assert_eq(incomplete.status, @health.HealthStatus::Insufficient)
assert_eq(incomplete.streak_since_us, None)
assert_eq(incomplete.rms_error_m, None)
}| HealthConfig | 默认值与含义 |
|---|---|
| min_landmarks | 3;至少多少个当前可用地标才判定证据,范围 1—64 |
| rms_limit_m、max_error_m | 0.1 米、0.2 米;各自为有限非负数,两个门限同时满足才符合阈值,等号包含 |
| confirmation_us、min_observations | 连续同类证据跨度至少 300,000 微秒且至少 3 次采样;跨度可为 0,样本数范围 1—1,000,000 |
| max_gap_us | 500,000 微秒;相邻帧间隔达到上限即重新开始确认 |
| max_position_std_m | 默认未设置;启用后跳过最差方向位置标准差超限的地标 |
///|
test "README: normal covariance evidence resumes from an independent checkpoint" {
let motion = @moonground.MotionEstimator::new(
"normal-evidence",
@moonground.MotionConfig::new(gate=1.0e12, max_tracks=10),
)
let counter = @events.EvidenceGateCounter::new(
"normal-evidence",
[@events.LineGate::new("aisle", { x: 0.0, y: 0.0, }, { x: 10.0, y: 0.0, })],
@events.GateConfig::new(max_tracks=10),
)
let observe = (y : Double) => {
@moonground.GroundObservation::new(
7,
{ x: 5.0, y, },
@moonground.Covariance2::new(100.0, 0.0, 0.01),
)
}
let initial = counter.update(motion.update(0L, [observe(-1.0)]))
assert_eq(initial.evidence[0].side, -1)
assert_true((initial.evidence[0].normal_std_m - 0.1).abs() < 1.0e-12)
let continued = @events.EvidenceGateCounter::from_checkpoint(
counter.checkpoint(),
)
let result = continued.update(motion.update(100000L, [observe(1.0)]))
assert_eq(result.counting.counts[0].negative_to_positive, 1L)
assert_eq(result.counting.crossings[0].from_timestamp_us, 0L)
assert_eq(result.counting.crossings[0].to_timestamp_us, 100000L)
assert_eq(counter.checkpoint().last_timestamp_us, Some(0L))
}///|
test "README: evidence analysis resumes both engines from one checkpoint" {
let session = @analysis.EvidenceAnalysisSession::from_ground(
@moonground.MotionEstimator::new(
"joint-evidence",
@moonground.MotionConfig::new(gate=1.0e12, max_tracks=10),
),
@events.EvidenceGateCounter::new(
"joint-evidence",
[
@events.LineGate::new("aisle", { x: 0.0, y: 0.0, }, { x: 10.0, y: 0.0, }),
],
@events.GateConfig::new(max_tracks=10),
),
)
let observe = (y : Double) => {
@moonground.GroundObservation::new(
7,
{ x: 5.0, y, },
@moonground.Covariance2::isotropic(0.01),
)
}
ignore(session.update_ground(0L, [observe(-1.0)]))
let restored = @analysis.EvidenceAnalysisSession::from_checkpoint(
session.checkpoint(),
)
let crossed = restored.update_ground(100000L, [observe(1.0)])
assert_eq(crossed.counting.counting.counts[0].negative_to_positive, 1L)
let stopped = restored.interrupt(200000L)
assert_eq(stopped.measurement.motion.closed_segment_ids, ["1"])
assert_eq(stopped.counting.evidence.length(), 0)
assert_eq(stopped.counting.counting.counts[0].negative_to_positive, 1L)
assert_eq(session.checkpoint().counting.last_timestamp_us, Some(0L))
}///|
test "README: explicit landmark policy ends blocked paths and starts a fresh segment" {
let calibration = @moonground.GroundCalibration::from_homography(
[0.1, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 1.0],
[
{ x: 0.0, y: 0.0, },
{ x: 20.0, y: 0.0, },
{ x: 20.0, y: 20.0, },
{ x: 0.0, y: 20.0, },
],
)
let analysis = @analysis.AnalysisSession::from_pixel(
@moonground.MeasurementSession::new(
"guarded-example",
calibration,
@moonground.MotionConfig::new(max_tracks=10),
),
@events.GateCounter::new(
"guarded-example",
[@events.LineGate::new("door", { x: 1.0, y: 0.0, }, { x: 1.0, y: 2.0, })],
@events.GateConfig::new(max_tracks=10),
),
)
let known = [
@health.KnownLandmark::new("A", { x: 0.0, y: 0.0, }),
@health.KnownLandmark::new("B", { x: 1.0, y: 0.0, }),
@health.KnownLandmark::new("C", { x: 0.0, y: 1.0, }),
]
let health = @health.CalibrationMonitor::new(
calibration,
known,
@health.HealthConfig::new(confirmation_us=0L, min_observations=1),
)
let session = @guarded.GuardedSession::new(analysis, health)
let landmarks = known.map(point => {
@health.LandmarkObservation::new(
point.landmark_id,
{ x: point.ground_m.x * 10.0, y: point.ground_m.y * 10.0, },
@moonground.Covariance2::isotropic(0.1),
)
})
let object = @moonground.PixelObservation::new(
7,
{ x: 5.0, y: 5.0, },
@moonground.Covariance2::isotropic(0.1),
)
assert_eq(session.update(0L, landmarks, [object]).decision, @guarded.Allowed)
let blocked = session.update(100000L, [], [object])
assert_eq(blocked.decision, @guarded.Blocked)
assert_eq(blocked.suppressed_track_ids, [7])
assert_eq(blocked.analysis.measurement.motion.closed_segment_ids, ["1"])
assert_eq(blocked.analysis.measurement.motion.tracks.length(), 0)
let restored = @guarded.GuardedSession::from_checkpoint(session.checkpoint())
let resumed = restored.update(200000L, landmarks, [object])
assert_eq(resumed.analysis.measurement.motion.tracks[0].segment_id, "2")
assert_eq(resumed.analysis.measurement.motion.tracks[0].accepted_count, 1)
assert_eq(resumed.analysis.measurement.motion.tracks[0].speed_mps, None)
let barrier = restored.replace_projection(300000L, calibration, camera=None)
assert_eq(barrier.health.status, @health.Insufficient)
assert_eq(barrier.analysis.measurement.motion.closed_segment_ids, ["2"])
let reconfirmed = restored.update(400000L, landmarks, [object])
assert_eq(reconfirmed.analysis.measurement.motion.tracks[0].segment_id, "3")
assert_eq(reconfirmed.analysis.measurement.motion.tracks[0].accepted_count, 1)
}///|
test "README: evidence guard restores three components and reconfirms after projection replacement" {
let calibration = @moonground.GroundCalibration::from_homography(
[0.1, 0.0, 0.0, 0.0, 0.1, 0.0, 0.0, 0.0, 1.0],
[
{ x: 0.0, y: 0.0, },
{ x: 20.0, y: 0.0, },
{ x: 20.0, y: 20.0, },
{ x: 0.0, y: 20.0, },
],
)
let session = @guarded.EvidenceGuardedSession::new(
@analysis.EvidenceAnalysisSession::from_pixel(
@moonground.MeasurementSession::new(
"evidence-guard",
calibration,
@moonground.MotionConfig::new(max_tracks=10),
),
@events.EvidenceGateCounter::new(
"evidence-guard",
[
@events.LineGate::new("door", { x: 1.0, y: 0.0, }, { x: 1.0, y: 2.0, }),
],
@events.GateConfig::new(max_tracks=10),
sigma_multiplier=3.0,
),
),
@health.CalibrationMonitor::new(
calibration,
[@health.KnownLandmark::new("A", { x: 1.0, y: 1.0, })],
@health.HealthConfig::new(
min_landmarks=1,
confirmation_us=100000L,
min_observations=2,
),
),
)
let covariance = @moonground.Covariance2::isotropic(0.1)
let references = [
@health.LandmarkObservation::new("A", { x: 10.0, y: 10.0, }, covariance),
]
let object = @moonground.PixelObservation::new(
7,
{ x: 5.0, y: 5.0, },
covariance,
)
assert_eq(session.update(0L, references, [object]).decision, @guarded.Blocked)
assert_eq(
session.update(100000L, references, [object]).decision,
@guarded.Allowed,
)
let restored = @guarded.EvidenceGuardedSession::from_checkpoint(
session.checkpoint(),
)
let barrier = restored.replace_projection(150000L, calibration, camera=None)
assert_eq(barrier.health.status, @health.Insufficient)
assert_eq(barrier.analysis.measurement.motion.closed_segment_ids, ["1"])
assert_eq(
restored.update(200000L, references, [object]).decision,
@guarded.Blocked,
)
let fresh = restored.update(300000L, references, [object])
assert_eq(fresh.decision, @guarded.Allowed)
assert_eq(fresh.analysis.measurement.motion.tracks[0].segment_id, "2")
assert_eq(restored.checkpoint().analysis.counting.sigma_multiplier, 3.0)
}///|
test "README: health-controlled evidence transit restores pending entry and preserves completion on replacement" {
let calibration = @moonground.GroundCalibration::from_homography(
[1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0],
[
{ x: -10.0, y: -10.0, },
{ x: 10.0, y: -10.0, },
{ x: 10.0, y: 10.0, },
{ x: -10.0, y: 10.0, },
],
max_meters_per_pixel=2.0,
)
let transit = @transit.EvidenceTransitCounter::new(
@events.EvidenceGateCounter::new(
"guarded-transit-example",
[
@events.LineGate::new("entry", { x: -5.0, y: 0.0, }, { x: 5.0, y: 0.0, }),
@events.LineGate::new("exit", { x: -5.0, y: 2.0, }, { x: 5.0, y: 2.0, }),
],
@events.GateConfig::new(max_tracks=10),
sigma_multiplier=2.0,
),
[
@transit.Section::new(
"aisle",
"entry",
@events.NegativeToPositive,
"exit",
@events.NegativeToPositive,
),
],
)
let session = @guarded.EvidenceGuardedTransitSession::new(
@analysis.EvidenceTransitSession::from_pixel(
@moonground.MeasurementSession::new(
"guarded-transit-example",
calibration,
@moonground.MotionConfig::new(q=1000000.0, gate=1.0e12, max_tracks=10),
),
transit,
),
@health.CalibrationMonitor::new(
calibration,
[@health.KnownLandmark::new("A", { x: 1.0, y: 1.0, })],
@health.HealthConfig::new(
min_landmarks=1,
confirmation_us=100000L,
min_observations=2,
),
),
)
let covariance = @moonground.Covariance2::isotropic(0.01)
let landmarks = [
@health.LandmarkObservation::new("A", { x: 1.0, y: 1.0, }, covariance),
]
let object = (y : Double) => {
@moonground.PixelObservation::new(7, { x: 0.0, y, }, covariance)
}
assert_eq(
session.update(0L, landmarks, [object(-1.0)]).decision,
@guarded.Blocked,
)
ignore(session.update(100000L, landmarks, [object(-1.0)]))
assert_eq(
session.update(200000L, landmarks, [object(1.0)]).analysis.transit.pending_count,
1,
)
let restored = @guarded.EvidenceGuardedTransitSession::from_checkpoint(
session.checkpoint(),
)
assert_eq(
restored.update(300000L, landmarks, [object(3.0)]).analysis.transit.passages.length(),
1,
)
let barrier = restored.replace_projection(350000L, calibration, camera=None)
assert_eq(barrier.decision, @guarded.Blocked)
assert_eq(barrier.health.status, @health.Insufficient)
assert_eq(barrier.analysis.transit.counts[0].completed, 1L)
assert_eq(barrier.analysis.measurement.motion.closed_segment_ids, ["1"])
assert_eq(
restored.update(400000L, landmarks, [object(-1.0)]).decision,
@guarded.Blocked,
)
let fresh = restored.update(500000L, landmarks, [object(-1.0)])
assert_eq(fresh.decision, @guarded.Allowed)
assert_eq(fresh.analysis.measurement.motion.tracks[0].segment_id, "2")
}///|
test "README: measured motion completes a directional transit after checkpoint recovery" {
let motion = @moonground.MotionEstimator::new(
"transit-example",
@moonground.MotionConfig::new(q=1000000.0, gate=1.0e12, max_tracks=10),
)
let transit = @transit.TransitCounter::new(
@events.GateCounter::new(
"transit-example",
[
@events.LineGate::new("entry", { x: 0.0, y: 0.0, }, { x: 10.0, y: 0.0, }),
@events.LineGate::new("exit", { x: 0.0, y: 2.0, }, { x: 10.0, y: 2.0, }),
],
@events.GateConfig::new(max_tracks=10),
),
[
@transit.Section::new(
"aisle",
"entry",
@events.NegativeToPositive,
"exit",
@events.NegativeToPositive,
),
],
)
let observation = (y : Double) => {
@moonground.GroundObservation::new(
7,
{ x: 5.0, y, },
@moonground.Covariance2::isotropic(0.01),
)
}
ignore(transit.update(motion.update(0L, [observation(-1.0)])))
assert_eq(
transit.update(motion.update(100000L, [observation(1.0)])).pending_count,
1,
)
let restored = @transit.TransitCounter::from_checkpoint(transit.checkpoint())
let result = restored.update(motion.update(200000L, [observation(3.0)]))
assert_eq(result.passages.length(), 1)
assert_eq(result.counts[0].completed, 1L)
assert_eq(result.passages[0].elapsed_upper_us, 200000L)
assert_true(result.passages[0].estimated_elapsed_us > 0.0)
}///|
test "README: covariance-confirmed transit restores its endpoint evidence" {
let motion = @moonground.MotionEstimator::new(
"evidence-transit-example",
@moonground.MotionConfig::new(q=1000000.0, gate=1.0e12, max_tracks=10),
)
let transit = @transit.EvidenceTransitCounter::new(
@events.EvidenceGateCounter::new(
"evidence-transit-example",
[
@events.LineGate::new("entry", { x: 0.0, y: 0.0, }, { x: 10.0, y: 0.0, }),
@events.LineGate::new("exit", { x: 0.0, y: 2.0, }, { x: 10.0, y: 2.0, }),
],
@events.GateConfig::new(max_tracks=10),
),
[
@transit.Section::new(
"aisle",
"entry",
@events.NegativeToPositive,
"exit",
@events.NegativeToPositive,
),
],
)
let observation = (y : Double) => {
@moonground.GroundObservation::new(
7,
{ x: 5.0, y, },
@moonground.Covariance2::isotropic(0.01),
)
}
ignore(transit.update(motion.update(0L, [observation(-1.0)])))
assert_eq(
transit.update(motion.update(100000L, [observation(1.0)])).pending_count,
1,
)
let restored = @transit.EvidenceTransitCounter::from_checkpoint(
transit.checkpoint(),
)
let result = restored.update(motion.update(200000L, [observation(3.0)]))
assert_eq(result.passages.length(), 1)
assert_eq(result.counts[0].completed, 1L)
assert_eq(result.passages[0].elapsed_upper_us, 200000L)
assert_true(result.passages[0].estimated_elapsed_us > 0.0)
}///|
test "README: joint evidence transit restores measurement and pending entry together" {
let motion = @moonground.MotionEstimator::new(
"joint-evidence-transit-example",
@moonground.MotionConfig::new(q=1000000.0, gate=1.0e12, max_tracks=10),
)
let transit = @transit.EvidenceTransitCounter::new(
@events.EvidenceGateCounter::new(
"joint-evidence-transit-example",
[
@events.LineGate::new("entry", { x: 0.0, y: 0.0, }, { x: 10.0, y: 0.0, }),
@events.LineGate::new("exit", { x: 0.0, y: 2.0, }, { x: 10.0, y: 2.0, }),
],
@events.GateConfig::new(max_tracks=10),
),
[
@transit.Section::new(
"aisle",
"entry",
@events.NegativeToPositive,
"exit",
@events.NegativeToPositive,
),
],
)
let joined = @analysis.EvidenceTransitSession::from_ground(motion, transit)
let observation = (y : Double) => {
@moonground.GroundObservation::new(
7,
{ x: 5.0, y, },
@moonground.Covariance2::isotropic(0.01),
)
}
ignore(joined.update_ground(0L, [observation(-1.0)]))
assert_eq(
joined.update_ground(100000L, [observation(1.0)]).transit.pending_count,
1,
)
let restored = @analysis.EvidenceTransitSession::from_checkpoint(
joined.checkpoint(),
)
let result = restored.update_ground(200000L, [observation(3.0)]).transit
assert_eq(result.passages.length(), 1)
assert_eq(result.counts[0].completed, 1L)
assert_eq(result.passages[0].elapsed_upper_us, 200000L)
assert_true(result.passages[0].estimated_elapsed_us > 0.0)
}///|
test "README: evidence transit windows resume aggregates at the original confirmation clock" {
let motion = @moonground.MotionEstimator::new(
"window-example",
@moonground.MotionConfig::new(q=1000000.0, gate=1.0e12, max_tracks=10),
)
let upstream = @transit.EvidenceTransitCounter::new(
@events.EvidenceGateCounter::new(
"window-example",
[
@events.LineGate::new("entry", { x: 0.0, y: 0.0, }, { x: 10.0, y: 0.0, }),
@events.LineGate::new("exit", { x: 0.0, y: 2.0, }, { x: 10.0, y: 2.0, }),
],
@events.GateConfig::new(max_tracks=10),
),
[
@transit.Section::new(
"aisle",
"entry",
@events.NegativeToPositive,
"exit",
@events.NegativeToPositive,
),
],
)
let windows = @transit.EvidenceTransitWindowCounter::new(
upstream.checkpoint(),
window_us=200000L,
duration_limits_us=[0L, 100000L, 200000L],
)
let observation = (y : Double) => {
@moonground.GroundObservation::new(
7,
{ x: 5.0, y, },
@moonground.Covariance2::isotropic(0.01),
)
}
for index, y in [-1.0, 1.0] {
let transit = upstream.update(
motion.update(index.to_int64() * 100000L, [observation(y)]),
)
ignore(windows.update(transit))
}
let restored = @transit.EvidenceTransitWindowCounter::from_checkpoint(
windows.checkpoint(),
)
let transit = upstream.update(motion.update(200000L, [observation(3.0)]))
let result = restored.update(transit)
assert_eq(result.closed_window.unwrap().input_frames, 2L)
assert_eq(result.current_window.start_us, 200000L)
assert_eq(result.current_window.sections[0].completed, 1L)
assert_eq(
result.current_window.sections[0].duration_limits[1].indeterminate,
1L,
)
assert_eq(result.current_window.sections[0].duration_limits[2].within, 1L)
assert_eq(result.unobserved_windows, 0L)
}moon update
moon build cmd/main --target native --release --deny-warn
./_build/native/release/build/cmd/main/main.exe --stream < examples/warehouse.ndjsonGet-Content -Raw -Encoding UTF8 examples/warehouse.ndjson |
& .\_build\native\release\build\cmd\main\main.exe --stream{"session_id":"warehouse","mode":"ground","motion":{"q":1}}
{"timestamp_us":"0","observations":[{"track_id":7,"point":[1,2],"covariance":[0.01,0,0.01]}]}
{"timestamp_us":"200000","observations":[{"track_id":7,"point":[1.1,2],"covariance":[0.01,0,0.01]}]}
{"timestamp_us":"400000","observations":[{"track_id":7,"point":[1.2,2],"covariance":[0.01,0,0.01]}]}./_build/native/release/build/cmd/main/main.exe --checkpoint < examples/warehouse.ndjson > checkpoint.json
python -c 'import json; print(json.dumps({"resume":json.load(open("checkpoint.json",encoding="utf-8"))}))' > resume.ndjson
./_build/native/release/build/cmd/main/main.exe --stream --max-line-bytes 16777216 < resume.ndjsonpython -c 'import json; p=open("examples/distorted-camera.ndjson",encoding="utf-8").read().splitlines(); print(json.dumps({"source":json.loads(p[0]),"transform":{"scale_x":0.5,"scale_y":0.75,"offset_x":-40,"offset_y":16}})); print(*p[1:],sep="\n")' |
./_build/native/release/build/cmd/main/main.exe --reframe > reframed.ndjson
./_build/native/release/build/cmd/main/main.exe --stream < reframed.ndjsonpython -c 'import json; from pathlib import Path; p=Path("examples/warehouse.ndjson").read_text(encoding="utf-8").splitlines(); print(json.dumps({"measurement":p[0],"counting":Path("examples/gates.json").read_text(encoding="utf-8")})); print(*p[1:],sep="\n")' > analysis-input.ndjson
./_build/native/release/build/cmd/main/main.exe --analyze < analysis-input.ndjson > analysis.ndjson
./_build/native/release/build/cmd/main/main.exe --analyze-checkpoint < analysis-input.ndjson > analysis-checkpoint.json
python -c 'import json; print(json.dumps({"resume":json.load(open("analysis-checkpoint.json",encoding="utf-8"))}))' > analysis-resume.ndjson
./_build/native/release/build/cmd/main/main.exe --analyze --max-line-bytes 16777216 < analysis-resume.ndjson./_build/native/release/build/cmd/main/main.exe --stream < examples/warehouse.ndjson > measurements.ndjson
python -c 'from pathlib import Path; print("".join(Path("examples/gates.json").read_text(encoding="utf-8").splitlines())); print(Path("measurements.ndjson").read_text(encoding="utf-8"),end="")' > count-input.ndjson
./_build/native/release/build/cmd/main/main.exe --count < count-input.ndjson > gate-events.ndjson
./_build/native/release/build/cmd/main/main.exe --count-checkpoint < count-input.ndjson > gates-checkpoint.json./_build/native/release/build/cmd/main/main.exe --stream < examples/warehouse.ndjson > measurements.ndjson
python -c 'from pathlib import Path; print("".join(Path("examples/transit.json").read_text(encoding="utf-8").splitlines())); print(Path("measurements.ndjson").read_text(encoding="utf-8"),end="")' > transit-input.ndjson
./_build/native/release/build/cmd/main/main.exe --transit < transit-input.ndjson > transit-results.ndjson
./_build/native/release/build/cmd/main/main.exe --transit-checkpoint < transit-input.ndjson > transit-checkpoint.json
python -c 'import json; print(json.dumps({"resume":json.load(open("transit-checkpoint.json",encoding="utf-8"))}))' > transit-resume.ndjson
./_build/native/release/build/cmd/main/main.exe --transit --max-line-bytes 16777216 < transit-resume.ndjson./_build/native/release/build/cmd/main/main.exe --health < examples/health.ndjson > health-results.ndjson
./_build/native/release/build/cmd/main/main.exe --health-checkpoint < examples/health.ndjson > health-checkpoint.json
python -c 'import json; print(json.dumps({"resume":json.load(open("health-checkpoint.json",encoding="utf-8"))}))' > health-resume.ndjson
./_build/native/release/build/cmd/main/main.exe --health --max-line-bytes 16777216 < health-resume.ndjson./_build/native/release/build/cmd/main/main.exe --guarded < examples/guarded.ndjson > guarded-results.ndjson
./_build/native/release/build/cmd/main/main.exe --guarded-checkpoint < examples/guarded.ndjson > guarded-checkpoint.json
python -c 'import json; print(json.dumps({"resume":json.load(open("guarded-checkpoint.json",encoding="utf-8"))}))' > guarded-resume.ndjson
./_build/native/release/build/cmd/main/main.exe --guarded --max-line-bytes 16777216 < guarded-resume.ndjson./_build/native/release/build/cmd/main/main.exe --guarded < examples/projection-replace.ndjson > projection-replace-results.ndjson
./_build/native/release/build/cmd/main/main.exe --guarded-checkpoint < examples/projection-replace.ndjson > projection-replace-checkpoint.json./_build/native/release/build/cmd/main/main.exe --calibrate < examples/calibration.jsonnode web/build.mjs
node web/serve.mjspython -c "import pathlib,sys; sys.stdout.write(pathlib.Path('examples/gate-evidence.json').read_text().replace('\n','')+'\n'+pathlib.Path('measurements.ndjson').read_text())" > evidence-input.ndjson
./_build/native/release/build/cmd/main/main.exe --count-evidence < evidence-input.ndjson > evidence-results.ndjson
./_build/native/release/build/cmd/main/main.exe --evidence-checkpoint < evidence-input.ndjson > evidence-checkpoint.json
python -c "import pathlib,sys; sys.stdout.write('{\"resume\":'+pathlib.Path('evidence-checkpoint.json').read_text().strip()+'}\n')" > evidence-resume.ndjsonpython -c 'import json; from pathlib import Path; lines=Path("examples/warehouse.ndjson").read_text(encoding="utf-8").splitlines(); print(json.dumps({"measurement":lines[0],"counting":Path("examples/gate-evidence.json").read_text(encoding="utf-8")})); print("\n".join(lines[1:]))' > evidence-analysis-input.ndjson
./_build/native/release/build/cmd/main/main.exe --analyze-evidence < evidence-analysis-input.ndjson > evidence-analysis-results.ndjson
./_build/native/release/build/cmd/main/main.exe --analyze-evidence-checkpoint < evidence-analysis-input.ndjson > evidence-analysis-checkpoint.json
python -c 'from pathlib import Path; print("{\"resume\":"+Path("evidence-analysis-checkpoint.json").read_text(encoding="utf-8").strip()+"}")' > evidence-analysis-resume.ndjson./_build/native/release/build/cmd/main/main.exe --guarded-evidence < examples/evidence-guarded.ndjson > evidence-guarded-results.ndjson
./_build/native/release/build/cmd/main/main.exe --guarded-evidence-checkpoint < examples/evidence-guarded.ndjson > evidence-guarded-checkpoint.json
python -c 'from pathlib import Path; print("{\"resume\":"+Path("evidence-guarded-checkpoint.json").read_text(encoding="utf-8").strip()+"}")' > evidence-guarded-resume.ndjson./_build/native/release/build/cmd/main/main.exe --stream < examples/warehouse.ndjson > measurements.ndjson
python -c 'from pathlib import Path; print(Path("examples/evidence-transit-source.json").read_text(encoding="utf-8").strip()); print(Path("measurements.ndjson").read_text(encoding="utf-8"), end="")' > evidence-transit-input.ndjson
./_build/native/release/build/cmd/main/main.exe --transit-evidence < evidence-transit-input.ndjson > evidence-transit-results.ndjson
./_build/native/release/build/cmd/main/main.exe --transit-evidence-checkpoint < evidence-transit-input.ndjson > evidence-transit-checkpoint.jsonpython -c 'import json; from pathlib import Path; lines=Path("examples/warehouse.ndjson").read_text(encoding="utf-8").splitlines(); print(json.dumps({"measurement":lines[0],"transit":Path("examples/evidence-transit-source.json").read_text(encoding="utf-8")})); print("\n".join(lines[1:]))' > joint-transit-input.ndjson
./_build/native/release/build/cmd/main/main.exe --analyze-transit-evidence < joint-transit-input.ndjson > joint-transit-results.ndjson
./_build/native/release/build/cmd/main/main.exe --analyze-transit-evidence-checkpoint < joint-transit-input.ndjson > joint-transit-checkpoint.json./_build/native/release/build/cmd/main/main.exe --guarded-transit-evidence < examples/evidence-guarded-transit.ndjson > evidence-guarded-transit-results.ndjson
./_build/native/release/build/cmd/main/main.exe --guarded-transit-evidence-checkpoint < examples/evidence-guarded-transit.ndjson > evidence-guarded-transit-checkpoint.json
python -c 'from pathlib import Path; print("{\"resume\":"+Path("evidence-guarded-transit-checkpoint.json").read_text(encoding="utf-8").strip()+"}")' > evidence-guarded-transit-resume.ndjson./_build/native/release/build/cmd/main/main.exe --transit-windows < transit-windows-input.ndjson > transit-windows-results.ndjson
./_build/native/release/build/cmd/main/main.exe --transit-windows-checkpoint < transit-windows-input.ndjson > transit-windows-checkpoint.json///|
test "README: raw observations restore measurement pending entry and statistics together" {
let motion = @moonground.MotionEstimator::new(
"joint-window-example",
@moonground.MotionConfig::new(q=1000000.0, gate=1.0e12, max_tracks=10),
)
let transit = @transit.EvidenceTransitCounter::new(
@events.EvidenceGateCounter::new(
"joint-window-example",
[
@events.LineGate::new("entry", { x: 0.0, y: 0.0, }, { x: 10.0, y: 0.0, }),
@events.LineGate::new("exit", { x: 0.0, y: 2.0, }, { x: 10.0, y: 2.0, }),
],
@events.GateConfig::new(max_tracks=10),
),
[
@transit.Section::new(
"aisle",
"entry",
@events.NegativeToPositive,
"exit",
@events.NegativeToPositive,
),
],
)
let joined = @analysis.EvidenceTransitWindowSession::new(
@analysis.EvidenceTransitSession::from_ground(motion, transit),
window_us=200000L,
duration_limits_us=[0L, 100000L, 200000L],
)
let observation = (y : Double) => {
@moonground.GroundObservation::new(
7,
{ x: 5.0, y, },
@moonground.Covariance2::isotropic(0.01),
)
}
ignore(joined.update_ground(0L, [observation(-1.0)]))
assert_eq(
joined.update_ground(100000L, [observation(1.0)]).analysis.transit.pending_count,
1,
)
let restored = @analysis.EvidenceTransitWindowSession::from_checkpoint(
joined.checkpoint(),
)
let frame = restored.update_ground(200000L, [observation(3.0)])
let result = frame.analysis.transit
assert_eq(result.passages.length(), 1)
assert_eq(result.counts[0].completed, 1L)
assert_eq(result.passages[0].elapsed_upper_us, 200000L)
assert_true(frame.windows.closed_window is Some(_))
assert_eq(frame.windows.current_window.start_us, 200000L)
assert_eq(frame.windows.current_window.input_frames, 1L)
assert_eq(frame.windows.current_window.sections[0].completed, 1L)
assert_eq(
frame.windows.current_window.sections[0].duration_limits[2].within,
1L,
)
}./_build/native/release/build/cmd/main/main.exe --analyze-transit-windows < observations.ndjson > results.ndjson
./_build/native/release/build/cmd/main/main.exe --analyze-transit-windows-checkpoint < observations.ndjson > checkpoint.json///|
test "README: health-controlled windows preserve pending entries and count projection barriers once" {
let calibration = @moonground.GroundCalibration::from_homography(
[1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0],
[
{ x: -10.0, y: -10.0, },
{ x: 10.0, y: -10.0, },
{ x: 10.0, y: 10.0, },
{ x: -10.0, y: 10.0, },
],
max_meters_per_pixel=2.0,
)
let transit = @transit.EvidenceTransitCounter::new(
@events.EvidenceGateCounter::new(
"guarded-window-example",
[
@events.LineGate::new("entry", { x: -5.0, y: 0.0, }, { x: 5.0, y: 0.0, }),
@events.LineGate::new("exit", { x: -5.0, y: 2.0, }, { x: 5.0, y: 2.0, }),
],
@events.GateConfig::new(max_tracks=10),
sigma_multiplier=2.0,
),
[
@transit.Section::new(
"aisle",
"entry",
@events.NegativeToPositive,
"exit",
@events.NegativeToPositive,
),
],
)
let upstream = @guarded.EvidenceGuardedTransitSession::new(
@analysis.EvidenceTransitSession::from_pixel(
@moonground.MeasurementSession::new(
"guarded-window-example",
calibration,
@moonground.MotionConfig::new(q=1000000.0, gate=1.0e12, max_tracks=10),
),
transit,
),
@health.CalibrationMonitor::new(
calibration,
[@health.KnownLandmark::new("A", { x: 1.0, y: 1.0, })],
@health.HealthConfig::new(
min_landmarks=1,
confirmation_us=100000L,
min_observations=2,
),
),
)
let session = @guarded.EvidenceGuardedTransitWindowSession::new(
upstream,
window_us=200000L,
duration_limits_us=[0L, 100000L, 200000L],
)
let covariance = @moonground.Covariance2::isotropic(0.01)
let landmarks = [
@health.LandmarkObservation::new("A", { x: 1.0, y: 1.0, }, covariance),
]
let object = (y : Double) => {
@moonground.PixelObservation::new(7, { x: 0.0, y, }, covariance)
}
assert_eq(
session.update(0L, landmarks, [object(-1.0)]).guarded.decision,
@guarded.Blocked,
)
ignore(session.update(100000L, landmarks, [object(-1.0)]))
assert_eq(
session.update(200000L, landmarks, [object(1.0)]).guarded.analysis.transit.pending_count,
1,
)
let restored = @guarded.EvidenceGuardedTransitWindowSession::from_checkpoint(
session.checkpoint(),
)
assert_eq(
restored.update(300000L, landmarks, [object(3.0)]).guarded.analysis.transit.passages.length(),
1,
)
let barrier = restored.replace_projection(350000L, calibration, camera=None)
assert_eq(barrier.windows.current_window.input_frames, 3L)
assert_eq(barrier.guarded.decision, @guarded.Blocked)
assert_eq(barrier.guarded.health.status, @health.Insufficient)
assert_eq(barrier.guarded.analysis.transit.counts[0].completed, 1L)
assert_eq(barrier.guarded.analysis.measurement.motion.closed_segment_ids, [
"1",
])
assert_eq(
restored.update(400000L, landmarks, [object(-1.0)]).guarded.decision,
@guarded.Blocked,
)
let fresh = restored.update(500000L, landmarks, [object(-1.0)])
assert_eq(fresh.guarded.decision, @guarded.Allowed)
assert_eq(fresh.guarded.analysis.measurement.motion.tracks[0].segment_id, "2")
}./_build/native/release/build/cmd/main/main.exe --guarded-transit-windows < guarded.ndjson > results.ndjson
./_build/native/release/build/cmd/main/main.exe --guarded-transit-windows-checkpoint < guarded.ndjson > checkpoint.json///|
test "README: directed velocity uses its own covariance rather than the worst direction" {
let probe = @velocity.VelocityProbe::new(
"aisle-east",
{ x: 1.0, y: 0.0, },
0.99,
sigma_multiplier=2.0,
)
let evidence = probe.evaluate(
{ x: 1.0, y: 0.0, },
@moonground.Covariance2::new(0.000001, 0.0, 1000000.0),
)
assert_true((evidence.axis_std_mps - 0.001).abs() < 1.0e-12)
assert_true((evidence.lower_mps - 0.998).abs() < 1.0e-12)
assert_eq(evidence.decision, @velocity.Above)
}///|
test "README: restored motion recomputes independent velocity evidence without another checkpoint" {
let motion = @moonground.MotionEstimator::new(
"velocity-readme",
@moonground.MotionConfig::new(gate=1000000.0),
)
let projector = @velocity.VelocityProjector::new("velocity-readme", [
@velocity.VelocityProbe::new(
"east",
{ x: 1.0, y: 0.0, },
0.2,
sigma_multiplier=0.0,
),
])
let observe = (x : Double) => {
@moonground.GroundObservation::new(
7,
{ x, y: 0.0, },
@moonground.Covariance2::isotropic(0.01),
)
}
for index in 0..<3 {
let frame = motion.update(index.to_int64() * 200000L, [
observe(index.to_double() * 0.2),
])
let evidence = projector.evaluate(frame)
if index < 2 {
assert_eq(evidence.evidence.length(), 0)
assert_eq(evidence.unavailable.length(), 1)
} else {
assert_eq(evidence.evidence[0].evidence.decision, @velocity.Above)
}
}
let restored = @moonground.MotionEstimator::from_checkpoint(
motion.checkpoint(),
)
let expected = projector.evaluate(motion.update(600000L, [observe(0.6)]))
let actual = projector.evaluate(restored.update(600000L, [observe(0.6)]))
assert_eq(@debug.to_string(actual), @debug.to_string(expected))
}./_build/native/release/build/cmd/main/main.exe --velocity-evidence < measured.ndjson > velocity-evidence.ndjson///|
test "README: convex zone evidence preserves conservative corner separation" {
let zone = @zones.ConvexZone::new(
"storage",
[
{ x: 0.0, y: 0.0, },
{ x: 1.0, y: 0.0, },
{ x: 1.0, y: 1.0, },
{ x: 0.0, y: 1.0, },
],
sigma_multiplier=1.0,
)
let covariance = @moonground.Covariance2::isotropic(0.25)
assert_eq(
zone.evaluate({ x: 0.5, y: 0.5, }, covariance).decision,
@zones.Inside,
)
assert_eq(
zone.evaluate({ x: 1.2, y: 1.2, }, covariance).decision,
@zones.Indeterminate,
)
let outside = zone.evaluate({ x: 1.5, y: 0.5, }, covariance)
assert_eq(outside.decision, @zones.Outside)
assert_eq(outside.separating_edge_index, Some(1))
}///|
test "README: original motion recovery recomputes current zone evidence" {
let zone = @zones.ConvexZone::new(
"storage",
[
{ x: 0.0, y: 0.0, },
{ x: 1.0, y: 0.0, },
{ x: 1.0, y: 1.0, },
{ x: 0.0, y: 1.0, },
],
sigma_multiplier=0.0,
)
let projector = @zones.ZoneProjector::new("zone-readme", [zone])
let motion = @moonground.MotionEstimator::new(
"zone-readme",
@moonground.MotionConfig::new(gate=1000000.0),
)
let observe = (x : Double) => {
@moonground.GroundObservation::new(
7,
{ x, y: 0.5, },
@moonground.Covariance2::isotropic(0.01),
)
}
for index in 0..<3 {
let frame = motion.update(index.to_int64() * 200000L, [
observe(0.2 + index.to_double() * 0.1),
])
let evidence = projector.evaluate(frame)
if index < 2 {
assert_eq(evidence.evidence.length(), 0)
assert_eq(evidence.unavailable.length(), 1)
} else {
assert_eq(evidence.evidence[0].evidence.decision, @zones.Inside)
}
}
let restored = @moonground.MotionEstimator::from_checkpoint(
motion.checkpoint(),
)
let expected = projector.evaluate(motion.update(600000L, [observe(0.5)]))
let actual = projector.evaluate(restored.update(600000L, [observe(0.5)]))
assert_eq(@debug.to_string(actual), @debug.to_string(expected))
}./_build/native/release/build/cmd/main/main.exe --zone-evidence < measured.ndjson > zone-evidence.ndjson///|
test "README: explicit physical radius can cross a boundary while the modeled anchor stays inside" {
let zone = @zones.ConvexZone::new(
"storage",
[
{ x: 0.0, y: 0.0, },
{ x: 1.0, y: 0.0, },
{ x: 1.0, y: 1.0, },
{ x: 0.0, y: 1.0, },
],
sigma_multiplier=0.0,
)
let position : @moonground.Point2 = { x: 0.875, y: 0.5, }
let covariance = @moonground.Covariance2::isotropic(0.25)
assert_eq(zone.evaluate(position, covariance).decision, @zones.Inside)
let body = zone.evaluate_disk(
position,
covariance,
@zones.DiskFootprint::new(0.25),
)
assert_eq(body.decision, @zones.Indeterminate)
assert_eq(body.faces[1].position_upper_m, -0.125)
assert_eq(body.faces[1].upper_m, 0.125)
assert_eq(body.faces[1].normal_std_m, 0.25)
}///|
test "README: original motion recovery recomputes disk support without another clock" {
let zone = @zones.ConvexZone::new(
"storage",
[
{ x: 0.0, y: 0.0, },
{ x: 1.0, y: 0.0, },
{ x: 1.0, y: 1.0, },
{ x: 0.0, y: 1.0, },
],
sigma_multiplier=0.0,
)
let projector = @zones.ZoneProjector::new("disk-readme", [zone])
let footprint = @zones.DiskFootprint::new(0.05)
let motion = @moonground.MotionEstimator::new(
"disk-readme",
@moonground.MotionConfig::new(gate=1000000.0),
)
let observe = (x : Double) => {
@moonground.GroundObservation::new(
7,
{ x, y: 0.5, },
@moonground.Covariance2::isotropic(0.01),
)
}
for index in 0..<3 {
let frame = motion.update(index.to_int64() * 200000L, [
observe(0.2 + index.to_double() * 0.1),
])
let evidence = projector.evaluate_disk(frame, footprint)
if index < 2 {
assert_eq(evidence.evidence.length(), 0)
assert_eq(evidence.unavailable.length(), 1)
} else {
assert_eq(evidence.evidence[0].evidence.decision, @zones.Inside)
}
}
let restored = @moonground.MotionEstimator::from_checkpoint(
motion.checkpoint(),
)
let expected = projector.evaluate_disk(
motion.update(600000L, [observe(0.5)]),
footprint,
)
let actual = projector.evaluate_disk(
restored.update(600000L, [observe(0.5)]),
footprint,
)
assert_eq(@debug.to_string(actual), @debug.to_string(expected))
}./_build/native/release/build/cmd/main/main.exe --disk-zone-evidence < measured.ndjson > disk-zone-evidence.ndjson///|
test "README: asymmetric footprint distinguishes an inside anchor from body extent" {
let zone = @zones.ConvexZone::new(
"work-area",
[
{ x: 0.0, y: 0.0, },
{ x: 4.0, y: 0.0, },
{ x: 4.0, y: 4.0, },
{ x: 0.0, y: 4.0, },
],
sigma_multiplier=0.0,
)
let footprint = @zones.ConvexFootprint::new([
{ x: -0.25, y: -0.25, },
{ x: 1.0, y: -0.25, },
{ x: 1.0, y: 0.25, },
{ x: -0.25, y: 0.25, },
])
let position : @moonground.Point2 = { x: 3.5, y: 2.0, }
let covariance = @moonground.Covariance2::isotropic(0.01)
assert_eq(zone.evaluate(position, covariance).decision, @zones.Inside)
let result = zone.evaluate_footprint(position, covariance, footprint)
assert_eq(result.decision, @zones.Indeterminate)
assert_eq(result.faces[1].position_upper_m, -0.5)
assert_eq(result.faces[1].footprint_lower_m, -0.25)
assert_eq(result.faces[1].footprint_upper_m, 1.0)
assert_eq(result.faces[1].upper_m, 0.5)
}///|
test "README: a footprint vertex anchor preserves its zero support boundary" {
let zone = @zones.ConvexZone::new(
"corner-area",
[
{ x: 0.0, y: 0.0, },
{ x: 4.0, y: 0.0, },
{ x: 4.0, y: 4.0, },
{ x: 0.0, y: 4.0, },
],
sigma_multiplier=0.0,
)
let footprint = @zones.ConvexFootprint::new([
{ x: 0.0, y: 0.0, },
{ x: 1.0, y: 0.0, },
{ x: 1.0, y: 0.5, },
{ x: 0.0, y: 0.5, },
])
let result = zone.evaluate_footprint(
{ x: 0.0, y: 0.0, },
@moonground.Covariance2::isotropic(0.01),
footprint,
)
assert_eq(result.decision, @zones.Inside)
assert_eq(result.faces[0].footprint_upper_m, 0.0)
assert_eq(result.faces[0].upper_m, result.faces[0].position_upper_m)
}///|
test "README: frame bound assignments distinguish mixed target bodies without retaining shapes" {
let motion = @motion.MotionEstimator::new(
"mixed-bodies",
@motion.MotionConfig::new(min_observations=2, min_span_us=0L),
)
let observations = [1, 2].map(id => {
@moonground.GroundObservation::new(
id,
{ x: 0.5, y: 0.5, },
@moonground.Covariance2::isotropic(0.01),
)
})
ignore(motion.update(0L, observations))
let frame = motion.update(100000L, observations)
let projector = @zones.ZoneProjector::new("mixed-bodies", [
@zones.ConvexZone::new(
"unit-area",
[
{ x: 0.0, y: 0.0, },
{ x: 1.0, y: 0.0, },
{ x: 1.0, y: 1.0, },
{ x: 0.0, y: 1.0, },
],
sigma_multiplier=0.0,
),
])
let body = @zones.ConvexFootprint::new([
{ x: -0.25, y: -0.25, },
{ x: 1.0, y: -0.25, },
{ x: 1.0, y: 0.25, },
{ x: -0.25, y: 0.25, },
])
let items = frame.tracks.map(track => {
@zones.FootprintAssignment::new(
track.track_id,
track.segment_id,
if track.track_id == 1 {
@zones.Disk(@zones.DiskFootprint::new(0.125))
} else {
@zones.Convex(body)
},
)
})
let result = projector.evaluate_assigned(
frame,
@zones.FootprintAssignments::new(frame.timestamp_us, items),
)
guard result.evidence[0].evidence is @zones.Disk(disk) else {
fail("disk missing")
}
guard result.evidence[1].evidence is @zones.Convex(convex) else {
fail("convex missing")
}
assert_eq(disk.decision, @zones.Inside)
assert_eq(convex.decision, @zones.Indeterminate)
let unassigned = projector.evaluate_assigned(
frame,
@zones.FootprintAssignments::new(frame.timestamp_us, []),
)
assert_eq(unassigned.evidence.length(), 0)
assert_eq(unassigned.unavailable.length(), 2)
assert_eq(unassigned.unavailable[0].reason, @zones.MissingFootprint)
}{
"measurement": "<原 schema 0.2.0 测量帧 JSON>",
"assignments": "{\"timestamp_us\":\"100000\",\"footprints\":[{\"track_id\":1,\"segment_id\":\"1\",\"shape\":{\"kind\":\"disk\",\"radius_m\":0.125}}]}"
}///|
test "README: footprint run confirmation uses supplied samples and stops at unknown" {
let motion = @motion.MotionEstimator::new(
"confirmed-samples",
@motion.MotionConfig::new(min_observations=2, min_span_us=0L),
)
let observations = [
@moonground.GroundObservation::new(
1,
{ x: 0.5, y: 0.5, },
@moonground.Covariance2::isotropic(0.01),
),
]
let monitor = @zones.FootprintRunMonitor::new(
"confirmed-samples",
[
@zones.ConvexZone::new(
"area",
[
{ x: 0.0, y: 0.0, },
{ x: 1.0, y: 0.0, },
{ x: 1.0, y: 1.0, },
{ x: 0.0, y: 1.0, },
],
sigma_multiplier=0.0,
),
],
@zones.FootprintRunConfig::new(
min_samples=2L,
confirmation_us=100000L,
max_gap_us=200000L,
),
)
ignore(motion.update(0L, observations))
let first = motion.update(100000L, observations)
let assign = fn(frame : @motion.FrameResult) raise {
@zones.FootprintAssignments::new(
frame.timestamp_us,
frame.tracks.map(track => {
@zones.FootprintAssignment::new(
track.track_id,
track.segment_id,
@zones.Disk(@zones.DiskFootprint::new(0.125)),
)
}),
)
}
assert_eq(monitor.update(first, assign(first)).confirmed.length(), 0)
let second = motion.update(200000L, observations)
let confirmed = monitor.update(second, assign(second))
assert_eq(confirmed.confirmed.length(), 1)
assert_eq(confirmed.active[0].sample_count, 2L)
assert_eq(confirmed.active[0].sample_span_us, 100000L)
let restored = @zones.FootprintRunMonitor::from_checkpoint(
monitor.checkpoint(),
)
let third = motion.update(300000L, observations)
let unknown = restored.update(
third,
@zones.FootprintAssignments::new(third.timestamp_us, []),
)
assert_eq(unknown.active.length(), 0)
assert_eq(unknown.closed[0].reason, @zones.UnavailableEvidence)
assert_eq(unknown.closed[0].run.last_timestamp_us, 200000L)
}///|
test "README: prepare actual footprint identities before a complete joint commit" {
let motion = @motion.MotionEstimator::new(
"joint-footprints",
@motion.MotionConfig::new(min_observations=2, min_span_us=0L),
)
let monitor = @zones.FootprintRunMonitor::new(
"joint-footprints",
[
@zones.ConvexZone::new(
"area",
[
{ x: 0.0, y: 0.0, },
{ x: 1.0, y: 0.0, },
{ x: 1.0, y: 1.0, },
{ x: 0.0, y: 1.0, },
],
sigma_multiplier=0.0,
),
],
@zones.FootprintRunConfig::new(confirmation_us=100000L, min_samples=2L),
)
let session = @analysis.FootprintRunSession::from_ground(motion, monitor)
let observations = [
@moonground.GroundObservation::new(
1,
{ x: 0.5, y: 0.5, },
@moonground.Covariance2::isotropic(0.01),
),
]
let initial = session.prepare_ground(0L, observations)
assert_eq(initial.measurement().motion.tracks[0].segment_id, "1")
ignore(initial.commit(@zones.FootprintAssignments::new(0L, [])))
let candidate = session.prepare_ground(100000L, observations)
let assign = fn(frame : @moonground.MeasurementFrame) raise {
@zones.FootprintAssignments::new(
frame.motion.timestamp_us,
frame.motion.tracks.map(track => {
@zones.FootprintAssignment::new(
track.track_id,
track.segment_id,
@zones.Disk(@zones.DiskFootprint::new(0.125)),
)
}),
)
}
let result = candidate.commit(assign(candidate.measurement()))
assert_eq(result.runs.active[0].sample_count, 1L)
let restored = @analysis.FootprintRunSession::from_checkpoint(
session.checkpoint(),
)
let next = restored.prepare_ground(200000L, observations)
let confirmed = next.commit(assign(next.measurement()))
assert_eq(confirmed.runs.confirmed.length(), 1)
assert_eq(confirmed.runs.active[0].sample_span_us, 100000L)
}///|
test "README: health and actual footprint candidates commit together" {
let calibration = @moonground.GroundCalibration::from_homography(
[1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0],
[
{ x: 0.0, y: 0.0, },
{ x: 10.0, y: 0.0, },
{ x: 10.0, y: 10.0, },
{ x: 0.0, y: 10.0, },
],
max_meters_per_pixel=2.0,
)
let known = [
@health.KnownLandmark::new("a", { x: 1.0, y: 1.0, }),
@health.KnownLandmark::new("b", { x: 2.0, y: 1.0, }),
@health.KnownLandmark::new("c", { x: 1.0, y: 2.0, }),
]
let session = @guarded.FootprintRunGuardedSession::new(
@analysis.FootprintRunSession::from_pixel(
@moonground.MeasurementSession::new(
"guarded-runs",
calibration,
@moonground.MotionConfig::new(
max_tracks=2,
min_observations=2,
min_span_us=0L,
),
),
@zones.FootprintRunMonitor::new(
"guarded-runs",
[
@zones.ConvexZone::new(
"area",
[
{ x: 0.0, y: 0.0, },
{ x: 10.0, y: 0.0, },
{ x: 10.0, y: 10.0, },
{ x: 0.0, y: 10.0, },
],
sigma_multiplier=0.0,
),
],
@zones.FootprintRunConfig::new(confirmation_us=0L, min_samples=1L),
max_tracks=2,
),
),
@health.CalibrationMonitor::new(
calibration,
known,
@health.HealthConfig::new(min_observations=1, confirmation_us=0L),
),
)
let landmarks = known.map(point => {
@health.LandmarkObservation::new(
point.landmark_id,
point.ground_m,
@moonground.Covariance2::isotropic(0.01),
)
})
let objects = [
@moonground.PixelObservation::new(
7,
{ x: 5.0, y: 5.0, },
@moonground.Covariance2::isotropic(0.01),
),
]
for time in [0L, 100000L] {
let candidate = session.prepare(time, landmarks, objects)
let preview = candidate.preview()
assert_eq(preview.decision, @guarded.Allowed)
let assignments = preview.measurement.motion.tracks.map(track => {
@zones.FootprintAssignment::new(
track.track_id,
track.segment_id,
@zones.Disk(@zones.DiskFootprint::new(0.1)),
)
})
ignore(
candidate.commit(@zones.FootprintAssignments::new(time, assignments)),
)
}
let restored = @guarded.FootprintRunGuardedSession::from_checkpoint(
session.checkpoint(),
)
let blocked = restored.prepare(200000L, [], objects)
assert_eq(blocked.preview().measurement.motion.tracks.length(), 0)
let ended = blocked.commit(@zones.FootprintAssignments::new(200000L, []))
assert_eq(ended.decision, @guarded.Blocked)
assert_eq(ended.suppressed_track_ids, [7])
assert_eq(ended.analysis.measurement.motion.closed_segment_ids, ["1"])
assert_eq(ended.analysis.runs.closed.length(), 1)
}///|
test "README: footprint confirmation windows count first reports once" {
let measurement = @motion.MotionEstimator::new(
"run-window-example",
@motion.MotionConfig::new(max_tracks=2, min_observations=2, min_span_us=0L),
)
let original = @zones.FootprintRunMonitor::new(
"run-window-example",
[
@zones.ConvexZone::new(
"area",
[
{ x: 0.0, y: 0.0, },
{ x: 1.0, y: 0.0, },
{ x: 1.0, y: 1.0, },
{ x: 0.0, y: 1.0, },
],
sigma_multiplier=0.0,
),
],
@zones.FootprintRunConfig::new(confirmation_us=50L, min_samples=2L),
max_tracks=2,
)
let windows = @zones.FootprintRunWindowMonitor::new(original, window_us=100L)
let object = @moonground.GroundObservation::new(
7,
{ x: 0.5, y: 0.5, },
@moonground.Covariance2::isotropic(0.01),
)
for time in [0L, 50L, 100L, 150L] {
let frame = measurement.update(time, [object])
let assignments = frame.tracks.map(track => {
@zones.FootprintAssignment::new(
track.track_id,
track.segment_id,
@zones.Disk(@zones.DiskFootprint::new(0.1)),
)
})
let result = windows.update(
frame,
@zones.FootprintAssignments::new(time, assignments),
)
if time >= 100L {
assert_eq(result.statistics.current_window.start_us, 100L)
assert_eq(result.statistics.current_window.zones[0].confirmed_inside, 1L)
}
}
let restored = @zones.FootprintRunWindowMonitor::from_checkpoint(
windows.checkpoint(),
)
let frame = measurement.update(200L, [object])
let assignment = @zones.FootprintAssignment::new(
7,
frame.tracks[0].segment_id,
@zones.Disk(@zones.DiskFootprint::new(0.1)),
)
let next = restored.update(
frame,
@zones.FootprintAssignments::new(200L, [assignment]),
)
assert_eq(next.statistics.current_window.zones[0].confirmed_inside, 0L)
assert_eq(next.statistics.current_window.zones[0].opening_confirmed, 1L)
}///|
test "README: original observations commit with footprint outcome windows" {
let measurement = @motion.MotionEstimator::new(
"raw-window-example",
@motion.MotionConfig::new(min_observations=2, min_span_us=0L),
)
let runs = @zones.FootprintRunMonitor::new(
"raw-window-example",
[
@zones.ConvexZone::new(
"area",
[
{ x: 0.0, y: 0.0, },
{ x: 1.0, y: 0.0, },
{ x: 1.0, y: 1.0, },
{ x: 0.0, y: 1.0, },
],
sigma_multiplier=0.0,
),
],
@zones.FootprintRunConfig::new(confirmation_us=50L, min_samples=2L),
)
let session = @analysis.FootprintRunWindowSession::new(
@analysis.FootprintRunSession::from_ground(measurement, runs),
window_us=100L,
)
let observation = @moonground.GroundObservation::new(
7,
{ x: 0.5, y: 0.5, },
@moonground.Covariance2::isotropic(0.01),
)
for time in [0L, 50L, 100L, 150L] {
let prepared = session.prepare_ground(time, [observation])
let actual = prepared.measurement()
let assignments = actual.motion.tracks.map(track => {
@zones.FootprintAssignment::new(
track.track_id,
track.segment_id,
@zones.Disk(@zones.DiskFootprint::new(0.1)),
)
})
let result = prepared.commit(
@zones.FootprintAssignments::new(time, assignments),
)
if time >= 100L {
assert_eq(
result.windows.statistics.current_window.zones[0].confirmed_inside,
1L,
)
}
}
let restored = @analysis.FootprintRunWindowSession::from_checkpoint(
session.checkpoint(),
)
let prepared = restored.prepare_ground(200L, [observation])
let actual = prepared.measurement()
let assignments = actual.motion.tracks.map(track => {
@zones.FootprintAssignment::new(
track.track_id,
track.segment_id,
@zones.Disk(@zones.DiskFootprint::new(0.1)),
)
})
let result = prepared.commit(
@zones.FootprintAssignments::new(200L, assignments),
)
assert_eq(
result.windows.statistics.current_window.zones[0].confirmed_inside,
0L,
)
assert_eq(
result.windows.statistics.current_window.zones[0].opening_confirmed,
1L,
)
}///|
test "README: health controls complete raw footprint windows" {
let calibration = @moonground.GroundCalibration::from_homography(
[1.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 1.0],
[
{ x: 0.0, y: 0.0, },
{ x: 10.0, y: 0.0, },
{ x: 10.0, y: 10.0, },
{ x: 0.0, y: 10.0, },
],
max_meters_per_pixel=2.0,
)
let known = [
@health.KnownLandmark::new("a", { x: 1.0, y: 1.0, }),
@health.KnownLandmark::new("b", { x: 2.0, y: 1.0, }),
@health.KnownLandmark::new("c", { x: 1.0, y: 2.0, }),
]
let original = @guarded.FootprintRunGuardedSession::new(
@analysis.FootprintRunSession::from_pixel(
@moonground.MeasurementSession::new(
"guarded-runs",
calibration,
@moonground.MotionConfig::new(
max_tracks=2,
min_observations=2,
min_span_us=0L,
),
),
@zones.FootprintRunMonitor::new(
"guarded-runs",
[
@zones.ConvexZone::new(
"area",
[
{ x: 0.0, y: 0.0, },
{ x: 10.0, y: 0.0, },
{ x: 10.0, y: 10.0, },
{ x: 0.0, y: 10.0, },
],
sigma_multiplier=0.0,
),
],
@zones.FootprintRunConfig::new(confirmation_us=0L, min_samples=1L),
max_tracks=2,
),
),
@health.CalibrationMonitor::new(
calibration,
known,
@health.HealthConfig::new(min_observations=1, confirmation_us=0L),
),
)
let session = @guarded.FootprintRunWindowGuardedSession::new(
original,
window_us=100000L,
)
let landmarks = known.map(point => {
@health.LandmarkObservation::new(
point.landmark_id,
point.ground_m,
@moonground.Covariance2::isotropic(0.01),
)
})
let objects = [
@moonground.PixelObservation::new(
7,
{ x: 5.0, y: 5.0, },
@moonground.Covariance2::isotropic(0.01),
),
]
for time in [0L, 100000L] {
let candidate = session.prepare(time, landmarks, objects)
let preview = candidate.preview()
assert_eq(preview.decision, @guarded.Allowed)
let assignments = preview.measurement.motion.tracks.map(track => {
@zones.FootprintAssignment::new(
track.track_id,
track.segment_id,
@zones.Disk(@zones.DiskFootprint::new(0.1)),
)
})
ignore(
candidate.commit(@zones.FootprintAssignments::new(time, assignments)),
)
}
let restored = @guarded.FootprintRunWindowGuardedSession::from_checkpoint(
session.checkpoint(),
)
let blocked = restored.prepare(200000L, [], objects)
assert_eq(blocked.preview().measurement.motion.tracks.length(), 0)
let ended = blocked.commit(@zones.FootprintAssignments::new(200000L, []))
assert_eq(ended.decision, @guarded.Blocked)
assert_eq(ended.suppressed_track_ids, [7])
assert_eq(ended.analysis.measurement.motion.closed_segment_ids, ["1"])
assert_eq(ended.analysis.windows.runs.closed.length(), 1)
assert_eq(ended.analysis.windows.statistics.current_window.input_frames, 1L)
assert_eq(
ended.analysis.windows.statistics.current_window.zones[0].opening_confirmed,
1L,
)
assert_eq(
ended.analysis.windows.statistics.current_window.zones[0].endings[1].confirmed,
1L,
)
}///|
test "README: bounded ellipse intersection resolves a disjoint corner" {
let zone = @zones.ConvexZone::new(
"corner",
[
{ x: 0.0, y: 0.0, },
{ x: 1.0, y: 0.0, },
{ x: 1.0, y: 1.0, },
{ x: 0.0, y: 1.0, },
],
sigma_multiplier=1.0,
)
let point : @types.Point2 = { x: 1.125, y: 1.125, }
let covariance = @types.Covariance2::isotropic(0.125)
assert_true(zone.evaluate(point, covariance).decision is @zones.Indeterminate)
let intersection = zone.intersect_position(point, covariance)
assert_true(intersection.decision is @zones.Disjoint)
assert_true(intersection.minimum_quadratic_lower > 1.0)
assert_true(intersection.minimum_quadratic_lower <= 2.0)
assert_true(intersection.minimum_quadratic_upper >= 2.0)
assert_true(intersection.witness_edge_index is Some(_))
}moon fmt --check
moon info
moon check --target all --deny-warn
moon build --target all --deny-warn
moon test --target all --deny-warn
node web/build.mjs
node --test web/parity.test.mjs
python validation/checkpoint_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/checkpoint-v0.36-results.json
python validation/robust_fit_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/robust-fit-v0.36-results.json
python validation/reframe_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/reframe-v0.36-results.json
python validation/gates_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/gates-v0.36-results.json
python validation/analysis_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/analysis-v0.36-results.json
python validation/health_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/health-v0.36-results.json
python validation/guarded_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/guarded-v0.36-results.json
python validation/transit_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/transit-v0.36-results.json
python validation/projection_replace_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/projection-replace-v0.36-results.json
python validation/evidence_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/evidence-v0.36-results.json
python validation/evidence_analysis_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/evidence-analysis-v0.36-results.json
python validation/evidence_guarded_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/evidence-guarded-v0.36-results.json
python validation/evidence_transit_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/evidence-transit-v0.36-results.json
python validation/evidence_transit_analysis_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/evidence-transit-analysis-v0.36-results.json
python validation/evidence_guarded_transit_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/evidence-guarded-transit-v0.36-results.json
python validation/transit_windows_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/transit-windows-v0.36-results.json
python validation/evidence_transit_window_analysis_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/evidence-transit-window-analysis-v0.36-results.json
python validation/evidence_guarded_transit_window_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/evidence-guarded-transit-window-v0.36-results.json
python validation/velocity_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/velocity-v0.36-results.json
python validation/zone_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/zone-v0.36-results.json
python validation/disk_zone_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/disk-zone-v0.36-results.json
python validation/footprint_zone_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/footprint-zone-v0.36-results.json
python validation/assigned_zone_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/assigned-zone-v0.36-results.json
python validation/footprint_run_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/footprint-run-v0.36-results.json
python validation/footprint_run_analysis_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/footprint-run-analysis-v0.36-results.json
python validation/footprint_run_guarded_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/footprint-run-guarded-v0.36-results.json
python validation/footprint_run_windows_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/footprint-run-windows-v0.36-results.json
python validation/footprint_run_window_analysis_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/footprint-run-window-analysis-v0.36-results.json
python validation/footprint_run_window_guarded_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/footprint-run-window-guarded-v0.36-results.json
python validation/calibration_area_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/calibration-area-results.json
python validation/calibration_angle_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/calibration-angle-v0.36-results.json
python validation/calibration_distance_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/calibration-distance-v0.36-results.json
python validation/calibration_sensitivity_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/calibration-sensitivity-v0.36-results.json
python validation/zone_intersection_verify.py --binary _build/native/release/build/cmd/main/main.exe --web --output validation/zone-intersection-v0.36-results.jsonpython validation/verify.py --binary _build/native/release/build/cmd/main/main.exe --output validation/regression-v0.36-results.json
python validation/stream_test.py --binary _build/native/release/build/cmd/main/main.exe --frames 3000 --targets 10 --latency-samples 100 --output validation/stream-v0.36-results.json
moon package
python validation/camera_verify.py --binary _build/native/release/build/cmd/main/main.exe --output validation/camera-v0.36-results.json
python examples/consumer/archive_smoke.py --archive _build/publish/python123-ops-moonground-0.36.0.zip --output validation/package-v0.36-results.jsonpub(all) struct MeasurementCheckpoint {
calibration : GroundCalibration
camera : CameraModel?
motion : MotionCheckpoint
}impl Debug for MeasurementCheckpointpub(all) struct MeasurementFrame {
motion : FrameResult
projection_failures : Array[ProjectionFailure]
} derive(Debug)pub struct MeasurementSession {
calibration : GroundCalibration
estimator : MotionEstimator
max_tracks : Int
// private fields
}fn MeasurementSession::from_checkpoint(checkpoint : MeasurementCheckpoint) -> MeasurementSession raise GroundErrorfn MeasurementSession::new(session_id : String, calibration : GroundCalibration, config : MotionConfig, camera? : CameraModel) -> MeasurementSession raise GroundErrorfn MeasurementSession::reframed(self : MeasurementSession, transform : PixelTransform) -> MeasurementSession raise GroundErrorfn MeasurementSession::update(self : MeasurementSession, timestamp_us : Int64, observations : Array[PixelObservation], lost? : Array[Int], removed? : Array[Int]) -> MeasurementFrame raise GroundErrorfn PixelObservation::new(track_id : Int, position : Point2, covariance : Covariance2) -> PixelObservation raise GroundErrorfn PixelObservation::reframed(self : PixelObservation, transform : PixelTransform) -> PixelObservation raise GroundErrorfn is_finite(value : Double) -> BoolInstall
Download zipCalibrated ground-plane measurements from timestamped object tracks