Skip to content

Commit feb6e94

Browse files
authored
Return of line rejection logging (#571)
1 parent 16d3f41 commit feb6e94

2 files changed

Lines changed: 26 additions & 5 deletions

File tree

deploy/config/line_detection.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ ransac_iters = 10
44
# maximum number of models to fit in RANSAC
55
model_iters = 100
66
# residual threshold for RANSAC inliers in meters
7-
ransac_inlier_threshold = 0.02
7+
ransac_inlier_threshold = 0.025
88
# maximum distance of a valid line spot from the camera in meters
99
spot_max_distance = 4.0
1010
# minimum number of points in a valid line segment
11-
line_segment_min_points = 10
11+
line_segment_min_points = 8
1212
# minimum length of a line segment after merging in meters
1313
line_segment_min_length = 0.35
1414
# maximum length of a line segment after merging in meters

yggdrasil/src/vision/line_detection/mod.rs

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,16 @@ impl<T: CameraLocation> Plugin for LineDetectionPlugin<T> {
106106
.chain(),
107107
debug_lines::<T>,
108108
debug_lines_projected::<T>,
109-
debug_rejected_lines::<T>,
110109
),
111110
)
112111
// TODO: these debug systems should ideally all be batched over multiple cycles
113112
// but that needs a batching api in the debug module
113+
.add_named_debug_systems(
114+
Update,
115+
debug_rejected_lines::<T>,
116+
"Visualize rejected lines",
117+
SystemToggle::Disable,
118+
)
114119
.add_named_debug_systems(
115120
Update,
116121
debug_lines_inliers::<T>,
@@ -511,7 +516,7 @@ fn setup_debug<T: CameraLocation>(dbg: DebugContext) {
511516
// rejected lines
512517
dbg.log_static(
513518
T::make_entity_image_path("lines/rejected"),
514-
&rerun::Clear::flat(),
519+
&rerun::LineStrips3D::update_fields(),
515520
);
516521
}
517522

@@ -640,7 +645,21 @@ fn debug_rejected_lines<T: CameraLocation>(
640645
dbg: DebugContext,
641646
camera_matrix: Res<CameraMatrix<T>>,
642647
rejected: Query<(&Cycle, &RejectedLines), (With<T>, Added<RejectedLines>)>,
648+
cycle: Res<Cycle>,
649+
mut last_logged: Local<Option<Cycle>>,
643650
) {
651+
if rejected.is_empty()
652+
&& last_logged.is_some_and(|last_logged_cycle| {
653+
last_logged_cycle.0 + LINE_DEBUG_CLEAR_CYCLES < cycle.0
654+
})
655+
{
656+
dbg.log_with_cycle(
657+
T::make_entity_image_path("lines/rejected"),
658+
*cycle,
659+
&rerun::LineStrips2D::update_fields().with_strips(std::iter::empty::<&[(f32, f32)]>()),
660+
);
661+
}
662+
644663
for (cycle, lines) in rejected.iter() {
645664
dbg.log_with_cycle(
646665
T::make_entity_image_path("lines/rejected"),
@@ -665,13 +684,15 @@ fn debug_rejected_lines<T: CameraLocation>(
665684
.rejections
666685
.iter()
667686
.map(|r| match r {
668-
Rejection::TooShort => (255, 0, 0),
687+
Rejection::TooShort => (0, 120, 120),
669688
Rejection::TooLong => (0, 255, 0),
670689
Rejection::NotEnoughSpots => (0, 0, 255),
671690
Rejection::FailedWhiteTest => (0, 255, 255),
672691
})
673692
.collect_vec(),
674693
),
675694
);
695+
696+
*last_logged = Some(*cycle);
676697
}
677698
}

0 commit comments

Comments
 (0)