@@ -144,19 +144,12 @@ def detect_collision(curr_x: float, curr_y: float, curr_v: float, obj: AgentStat
144144 print ("The object will pass through our front before we drive normally and reach it" )
145145 return False , 0.0
146146
147- distance_to_move = distance_with_buffer + time_to_pass * obj_v_y
147+ distance_to_move = distance_with_buffer + time_to_pass * obj_v_x
148148
149149 if curr_v ** 2 / (2 * distance_to_move ) >= COMFORT_DECELERATION :
150150 return True , curr_v ** 2 / (2 * distance_to_move )
151- time_to_max_v = (max_speed - curr_v )/ acceleration
152-
153- if time_to_max_v > time_to_pass :
154- if curr_v * time_to_pass + 0.5 * acceleration * time_to_pass ** 2 > distance_to_move :
155- return False , 0.0
156- else :
157- if (max_speed ** 2 - curr_v ** 2 )/ (2 * acceleration ) + (time_to_pass - time_to_max_v ) * max_speed >= distance_to_move :
158- return False , 0.0
159-
151+
152+ print ("Calculating cruising speed" )
160153 return True , [distance_to_move , time_to_pass ]
161154
162155
@@ -1024,7 +1017,7 @@ def update(self, state : AllState):
10241017 deceleration = 1.5
10251018 print ("@@@@@ YIELDING" , desired_speed )
10261019 route_yield = route .trim (closest_parameter ,closest_parameter + distance_collision )
1027- traj = longitudinal_plan (route_yield , self .acceleration , deceleration , desired_speed , curr_v )
1020+ traj = longitudinal_plan (route_yield , self .acceleration , deceleration , desired_speed , curr_v , self . planner )
10281021 return traj
10291022 else :
10301023 if detected and deceleration > 0 :
0 commit comments