@@ -14,19 +14,12 @@ use sw8s_rust_lib::{
1414 missions:: {
1515 action:: ActionExec ,
1616 action_context:: FullActionContext ,
17- align_buoy:: { buoy_align, buoy_align_shot} ,
1817 basic:: descend_and_go_forward,
1918 bin:: bin,
20- circle_buoy:: {
21- buoy_circle_sequence, buoy_circle_sequence_blind, buoy_circle_sequence_model,
22- } ,
23- coinflip:: { coinflip, coinflip_procedural} ,
19+ coinflip:: coinflip_procedural,
2420 example:: { initial_descent, pid_test} ,
2521 fire_torpedo:: { FireLeftTorpedo , FireRightTorpedo } ,
26- gate:: {
27- gate_run_complex, gate_run_cv_procedural, gate_run_dead_reckon, gate_run_naive,
28- gate_run_procedural, gate_run_testing,
29- } ,
22+ gate:: { gate_run_cv_procedural, gate_run_dead_reckon, gate_run_procedural} ,
3023 meb:: WaitArm ,
3124 octagon:: octagon,
3225 path_align:: { path_align_procedural, static_align_procedural} ,
@@ -37,15 +30,14 @@ use sw8s_rust_lib::{
3730 vision:: PIPELINE_KILL ,
3831 } ,
3932 video_source:: appsink:: Camera ,
40- vision:: buoy:: Target ,
4133 TIMESTAMP ,
4234} ;
4335use tokio:: {
4436 io:: WriteHalf ,
4537 signal,
4638 sync:: {
4739 mpsc:: { self , UnboundedSender } ,
48- OnceCell , RwLock , Semaphore ,
40+ OnceCell , Semaphore ,
4941 } ,
5042 time:: { sleep, timeout} ,
5143} ;
@@ -129,13 +121,6 @@ async fn bottom_cam() -> &'static Camera {
129121 . await
130122}
131123
132- static GATE_TARGET : OnceCell < RwLock < Target > > = OnceCell :: const_new ( ) ;
133- async fn gate_target ( ) -> & ' static RwLock < Target > {
134- GATE_TARGET
135- . get_or_init ( || async { RwLock :: new ( Target :: Earth1 ) } )
136- . await
137- }
138-
139124static STATIC_CONTEXT : OnceCell < FullActionContext < WriteHalf < SerialStream > > > = OnceCell :: const_new ( ) ;
140125async fn static_context ( ) -> & ' static FullActionContext < ' static , WriteHalf < SerialStream > > {
141126 STATIC_CONTEXT
@@ -145,7 +130,6 @@ async fn static_context() -> &'static FullActionContext<'static, WriteHalf<Seria
145130 meb ( ) . await ,
146131 front_cam ( ) . await ,
147132 bottom_cam ( ) . await ,
148- gate_target ( ) . await ,
149133 )
150134 } )
151135 . await
@@ -369,23 +353,6 @@ async fn run_mission(mission: &str, cancel: CancellationToken) -> Result<()> {
369353 meb( ) . await ,
370354 front_cam( ) . await ,
371355 bottom_cam( ) . await ,
372- gate_target( ) . await ,
373- ) )
374- . execute( ) ) ,
375- "gate_run_naive" => ctwrap ! ( gate_run_naive( & FullActionContext :: new(
376- control_board( ) . await ,
377- meb( ) . await ,
378- front_cam( ) . await ,
379- bottom_cam( ) . await ,
380- gate_target( ) . await ,
381- ) )
382- . execute( ) ) ,
383- "gate_run_complex" => ctwrap ! ( gate_run_complex( & FullActionContext :: new(
384- control_board( ) . await ,
385- meb( ) . await ,
386- front_cam( ) . await ,
387- bottom_cam( ) . await ,
388- gate_target( ) . await ,
389356 ) )
390357 . execute( ) ) ,
391358 "gate_run_coinflip" => ctwrap ! ( gate_run_cv_procedural(
@@ -394,7 +361,6 @@ async fn run_mission(mission: &str, cancel: CancellationToken) -> Result<()> {
394361 meb( ) . await ,
395362 front_cam( ) . await ,
396363 bottom_cam( ) . await ,
397- gate_target( ) . await ,
398364 ) ,
399365 & config. missions. gate,
400366 & config. get_color_profile( ) . unwrap( ) ,
@@ -405,7 +371,6 @@ async fn run_mission(mission: &str, cancel: CancellationToken) -> Result<()> {
405371 meb( ) . await ,
406372 front_cam( ) . await ,
407373 bottom_cam( ) . await ,
408- gate_target( ) . await ,
409374 ) ,
410375 & config. missions. gate
411376 ) ) ,
@@ -415,19 +380,9 @@ async fn run_mission(mission: &str, cancel: CancellationToken) -> Result<()> {
415380 meb( ) . await ,
416381 front_cam( ) . await ,
417382 bottom_cam( ) . await ,
418- gate_target( ) . await ,
419383 ) ,
420384 & config. missions. gate,
421- & config. get_color_profile( ) . unwrap( ) ,
422385 ) ) ,
423- "gate_run_testing" => ctwrap ! ( gate_run_testing( & FullActionContext :: new(
424- control_board( ) . await ,
425- meb( ) . await ,
426- front_cam( ) . await ,
427- bottom_cam( ) . await ,
428- gate_target( ) . await ,
429- ) )
430- . execute( ) ) ,
431386 "start_cam" => {
432387 // This has not been tested
433388 logln ! ( "Opening camera" ) ;
@@ -442,7 +397,6 @@ async fn run_mission(mission: &str, cancel: CancellationToken) -> Result<()> {
442397 meb( ) . await ,
443398 front_cam( ) . await ,
444399 bottom_cam( ) . await ,
445- gate_target( ) . await ,
446400 ) ,
447401 & config. missions. path_align,
448402 & config. get_color_profile( ) . unwrap( ) ,
@@ -453,7 +407,6 @@ async fn run_mission(mission: &str, cancel: CancellationToken) -> Result<()> {
453407 meb( ) . await ,
454408 front_cam( ) . await ,
455409 bottom_cam( ) . await ,
456- gate_target( ) . await ,
457410 ) ,
458411 & config. missions. path_align,
459412 ) ) ,
@@ -462,15 +415,13 @@ async fn run_mission(mission: &str, cancel: CancellationToken) -> Result<()> {
462415 meb( ) . await ,
463416 front_cam( ) . await ,
464417 bottom_cam( ) . await ,
465- gate_target( ) . await ,
466418 ) )
467419 . execute( ) ) ,
468420 "pid_test" => ctwrap ! ( pid_test( & FullActionContext :: new(
469421 control_board( ) . await ,
470422 meb( ) . await ,
471423 front_cam( ) . await ,
472424 bottom_cam( ) . await ,
473- gate_target( ) . await ,
474425 ) )
475426 . execute( ) ) ,
476427 "octagon" => ctwrap ! ( octagon(
@@ -479,22 +430,7 @@ async fn run_mission(mission: &str, cancel: CancellationToken) -> Result<()> {
479430 & config. get_color_profile( ) . unwrap( )
480431 )
481432 . execute( ) ) ,
482- "buoy_circle" => ctwrap ! ( buoy_circle_sequence( & FullActionContext :: new(
483- control_board( ) . await ,
484- meb( ) . await ,
485- front_cam( ) . await ,
486- bottom_cam( ) . await ,
487- gate_target( ) . await ,
488- ) )
489- . execute( ) ) ,
490- "buoy_model" => ctwrap ! ( buoy_circle_sequence_model( static_context( ) . await ) . execute( ) ) ,
491- "buoy_blind" => ctwrap ! ( buoy_circle_sequence_blind( static_context( ) . await ) . execute( ) ) ,
492- "buoy_align" => ctwrap ! ( buoy_align( static_context( ) . await ) . execute( ) ) ,
493- "spin" => ctwrap ! ( spin( static_context( ) . await ) . execute( ) ) ,
494- "torpedo" | "fire_torpedo" => {
495- let _ = buoy_align_shot ( static_context ( ) . await ) . execute ( ) . await ;
496- Ok ( ( ) )
497- }
433+ "spin" => ctwrap ! ( spin( static_context( ) . await , & config. missions. spin) ) ,
498434 "torpedo_only" => {
499435 FireRightTorpedo :: new ( static_context ( ) . await )
500436 . execute ( )
@@ -538,7 +474,7 @@ async fn run_mission(mission: &str, cancel: CancellationToken) -> Result<()> {
538474 let _ = sonar ( static_context ( ) . await , & config. sonar , cancel) . await ;
539475 Ok ( ( ) )
540476 }
541- "bin" => ctwrap ! ( bin( static_context( ) . await , & config . missions . bin ) ) ,
477+ "bin" => ctwrap ! ( bin( static_context( ) . await ) ) ,
542478 x => bail ! ( "Invalid argument: [{x}]" ) ,
543479 } ;
544480
0 commit comments