@@ -39,6 +39,63 @@ use super::{
3939 vision:: { DetectTarget , ExtractPosition , VisionNorm , VisionNormOffset } ,
4040} ;
4141
42+ pub async fn gate_run_dead_reckon <
43+ Con : Send + Sync + GetControlBoard < WriteHalf < SerialStream > > + GetMainElectronicsBoard + FrontCamIO ,
44+ > (
45+ context : & Con ,
46+ config : & Config ,
47+ color_profile : & ColorProfile ,
48+ ) {
49+ #[ cfg( feature = "logging" ) ]
50+ logln ! ( "Starting Procedural Gate" ) ;
51+
52+ let cb = context. get_control_board ( ) ;
53+ let _ = cb. bno055_periodic_read ( true ) . await ;
54+
55+ let initial_yaw = loop {
56+ if let Some ( initial_angle) = cb. responses ( ) . get_angles ( ) . await {
57+ break * initial_angle. yaw ( ) ;
58+ } else {
59+ #[ cfg( feature = "logging" ) ]
60+ logln ! ( "Failed to get initial angle" ) ;
61+ }
62+ } ;
63+
64+ // let _ = cb
65+ // .stability_2_speed_set(0.0, 0.0, 0.0, 0.0, initial_yaw, config.depth)
66+ // .await;
67+
68+ // sleep(Duration::from_secs_f32(config.init_duration)).await;
69+ // let mut mult = 1.0;
70+ // if let Side::Left = config.side {
71+ // mult = -1.0;
72+ // } else {
73+ // mult = 1.0;
74+ // }
75+ // let _ = cb
76+ // .stability_2_speed_set(
77+ // config.strafe_speed * mult,
78+ // 0.0,
79+ // 0.0,
80+ // 0.0,
81+ // initial_yaw,
82+ // config.depth,
83+ // )
84+ // .await;
85+
86+ // sleep(Duration::from_secs_f32(config.strafe_duration)).await;
87+
88+ let _ = cb
89+ . stability_2_speed_set ( 0.0 , config. speed , 0.0 , 0.0 , initial_yaw, config. depth )
90+ . await ;
91+
92+ sleep ( Duration :: from_secs_f32 ( config. traversal_duration ) ) . await ;
93+
94+ let _ = cb
95+ . stability_1_speed_set ( 0.0 , 0.0 , 0.0 , 0.0 , 0.0 , config. depth )
96+ . await ;
97+ }
98+
4299pub async fn gate_run_cv_procedural <
43100 Con : Send + Sync + GetControlBoard < WriteHalf < SerialStream > > + GetMainElectronicsBoard + FrontCamIO ,
44101> (
0 commit comments