@@ -112,12 +112,16 @@ pub async fn slalom<
112112 logln ! ( "ALIGN" ) ;
113113
114114 if let Some ( position) = positions. next ( ) {
115+ false_count = 0 ;
115116 let x = * position. x ( ) as f32 ;
117+ dbg ! ( & x) ;
116118 let mut correction = 0.0 ;
117119 if x. abs ( ) < 0.2 {
118120 true_count += 1 ;
119121 if true_count >= 4 {
120122 correction = 0.0 ;
123+ #[ cfg( feature = "logging" ) ]
124+ logln ! ( "ALIGNED" ) ;
121125 slalom_state = SlalomState :: Approach ;
122126 if let Some ( current_angle) = cb. responses ( ) . get_angles ( ) . await {
123127 let current_yaw = * current_angle. yaw ( ) ;
@@ -128,14 +132,18 @@ pub async fn slalom<
128132 logln ! ( "true_count: {true_count}/4" ) ;
129133 }
130134 } else {
131- correction = 0.5 * x;
135+ correction = dbg ! ( - 0.2 * x) ;
132136 let _ = cb
133137 . stability_1_speed_set ( 0.0 , 0.0 , correction, 0.0 , 0.0 , config. depth )
134138 . await ;
135139 }
136140 } else {
137141 false_count += 1 ;
142+ #[ cfg( feature = "logging" ) ]
143+ logln ! ( "NO DETECTIONS" ) ;
138144 if false_count >= 100 {
145+ #[ cfg( feature = "logging" ) ]
146+ logln ! ( "KILLED NO DET" ) ;
139147 break ' detections;
140148 }
141149 }
@@ -145,29 +153,27 @@ pub async fn slalom<
145153 #[ cfg( feature = "logging" ) ]
146154 logln ! ( "APPROACH" ) ;
147155
156+ yaw_target = ( yaw_target
157+ + ( if let Left = config. side {
158+ config. yaw_adjustment
159+ } else {
160+ -config. yaw_adjustment
161+ } ) ) ;
148162 let _ = cb
149- . stability_2_speed_set (
150- 0.0 ,
151- 0.0 ,
152- 0.0 ,
153- 0.0 ,
154- ( yaw_target
155- + ( if let Left = config. side {
156- -config. yaw_adjustment
157- } else {
158- config. yaw_adjustment
159- } ) ) as f32 ,
160- config. depth ,
161- )
163+ . stability_2_speed_set ( 0.0 , 0.0 , 0.0 , 0.0 , yaw_target, config. depth )
162164 . await ;
163165
164- init_timer. execute ( ) . await ;
166+ sleep ( Duration :: from_secs ( config. init_duration as u64 ) ) . await ;
167+
168+ // init_timer.execute().await;
165169
166170 let _ = cb
167- . stability_2_speed_set ( 0.0 , config. speed , 0.0 , 0.0 , 0.0 , config. depth )
171+ . stability_1_speed_set ( 0.0 , config. speed , 0.0 , 0.0 , 0.0 , config. depth )
168172 . await ;
169173
170- traversal_timer. execute ( ) . await ;
174+ // traversal_timer.execute().await;
175+ sleep ( Duration :: from_secs ( config. traversal_duration as u64 ) ) . await ;
176+
171177 break ' detections;
172178 }
173179 }
0 commit comments