@@ -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