@@ -174,39 +174,16 @@ def compute(self, state : VehicleState, component : Component = None):
174174 curve_radius = self .path .fit_curve_radius ((curr_x ,curr_y ), curve_points )
175175 # map curve radius to desired_speed. Note curve_radius can be inf if all points are colinear
176176 print ("curve_radius: " , curve_radius )
177- #if curve_radius < 10:
178- # desired_speed = 2.5
179- #elif curve_radius < 15:
180- # desired_speed = 3
181- #elif curve_radius < 20:
182- # desired_speed = 4
183- #elif curve_radius < 30:
184- # desired_speed = 5
185- #else:
186- # desired_speed = 10
177+
187178 desired_speed = (.5 * curve_radius )** .5
188179 else :
189180 #decay speed when crosstrack error is high
190181 desired_speed *= np .exp (- abs (ct_error )* 0.4 )
191182 if desired_speed > self .speed_limit :
192183 desired_speed = self .speed_limit
193184
194-
195- # # # braking for 50m dash test
196- # if self.current_path_parameter >= self.path.domain()[1]:
197- # if component is not None:
198- # component.debug_event('Past the end of trajectory')
199- # #past the end, just stop
200- # desired_speed = 0.0
201- # feedforward_accel = -3.0
202- # f_delta = 0
203-
204-
205185 output_accel = self .pid_speed .advance (e = desired_speed - speed , t = t , feedforward_term = feedforward_accel )
206186
207- # self.brake_cmd.f64_cmd = maxbrake
208- # self.accel_cmd.f64_cmd = 0
209-
210187 if component is not None :
211188 component .debug ('curr pt' ,(curr_x ,curr_y ))
212189 component .debug ('curr param' ,self .current_path_parameter )
0 commit comments