@@ -3,15 +3,11 @@ use opencv::core::Mat;
33#[ cfg( feature = "annotated_streams" ) ]
44use opencv:: mod_prelude:: ToInputArray ;
55use tokio:: io:: { AsyncWriteExt , WriteHalf } ;
6- use tokio:: sync:: RwLock ;
76use tokio_serial:: SerialStream ;
87
8+ use crate :: comms:: { control_board:: ControlBoard , meb:: MainElectronicsBoard } ;
99use crate :: video_source:: appsink:: Camera ;
1010use crate :: video_source:: MatSource ;
11- use crate :: {
12- comms:: { control_board:: ControlBoard , meb:: MainElectronicsBoard } ,
13- vision:: buoy:: Target ,
14- } ;
1511/**
1612 * Inherit this trait if you have a control board
1713 */
@@ -34,8 +30,6 @@ pub trait FrontCamIO {
3430 fn get_front_camera_mat ( & self ) -> impl std:: future:: Future < Output = Mat > + Send ;
3531 #[ cfg( feature = "annotated_streams" ) ]
3632 async fn annotate_front_camera ( & self , image : & impl ToInputArray ) ;
37- async fn get_desired_buoy_gate ( & self ) -> Target ;
38- async fn set_desired_buoy_gate ( & mut self , value : Target ) -> & Self ;
3933}
4034
4135/**
@@ -60,7 +54,6 @@ pub struct FullActionContext<'a, T: AsyncWriteExt + Unpin + Send> {
6054 main_electronics_board : & ' a MainElectronicsBoard < WriteHalf < SerialStream > > ,
6155 front_cam : & ' a Camera ,
6256 bottom_cam : & ' a Camera ,
63- desired_buoy_target : & ' a RwLock < Target > ,
6457}
6558
6659impl < ' a , T : AsyncWriteExt + Unpin + Send > FullActionContext < ' a , T > {
@@ -69,14 +62,12 @@ impl<'a, T: AsyncWriteExt + Unpin + Send> FullActionContext<'a, T> {
6962 main_electronics_board : & ' a MainElectronicsBoard < WriteHalf < SerialStream > > ,
7063 front_cam : & ' a Camera ,
7164 bottom_cam : & ' a Camera ,
72- desired_buoy_target : & ' a RwLock < Target > ,
7365 ) -> Self {
7466 Self {
7567 control_board,
7668 main_electronics_board,
7769 front_cam,
7870 bottom_cam,
79- desired_buoy_target,
8071 }
8172 }
8273}
@@ -101,14 +92,6 @@ impl<T: AsyncWriteExt + Unpin + Send> FrontCamIO for FullActionContext<'_, T> {
10192 async fn annotate_front_camera ( & self , image : & impl ToInputArray ) {
10293 self . front_cam . push_annotated_frame ( image) ;
10394 }
104- async fn get_desired_buoy_gate ( & self ) -> Target {
105- let res = self . desired_buoy_target . read ( ) . await ;
106- ( * res) . clone ( )
107- }
108- async fn set_desired_buoy_gate ( & mut self , value : Target ) -> & Self {
109- * self . desired_buoy_target . write ( ) . await = value;
110- self
111- }
11295}
11396
11497impl < T : AsyncWriteExt + Unpin + Send > BottomCamIO for FullActionContext < ' _ , T > {
@@ -141,12 +124,6 @@ impl FrontCamIO for EmptyActionContext {
141124 async fn annotate_front_camera ( & self , _image : & impl ToInputArray ) {
142125 todo ! ( ) ;
143126 }
144- async fn get_desired_buoy_gate ( & self ) -> Target {
145- todo ! ( )
146- }
147- async fn set_desired_buoy_gate ( & mut self , _value : Target ) -> & Self {
148- todo ! ( )
149- }
150127}
151128
152129impl BottomCamIO for EmptyActionContext {
0 commit comments