Skip to content

Commit c05d406

Browse files
committed
get_minimum_deceleration_for_collision_avoidance completed
1 parent 047f84f commit c05d406

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

GEMstack/onboard/planning/longitudinal_planning.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -193,13 +193,15 @@ def get_minimum_deceleration_for_collision_avoidance(curr_x: float, curr_y: floa
193193

194194
softest_accleration = 2 * r_velocity_y_from_vehicle * (r_velocity_y_from_vehicle * r_pedestrain_x - r_velocity_x_from_vehicle * r_pedestrain_y_temp) / r_pedestrain_y_temp**2
195195
peak_y = -(r_velocity_x_from_vehicle * r_velocity_y_from_vehicle) / softest_accleration
196+
# if the peak is within the position of the pedestrian,
197+
# then it indicates the path had already collided with the pestrain,
198+
# and so the softest acceleration should be the one the peak of the path is the same as the pedestrain's x position
199+
# and the vehicle should be stopped exactly before the pedestrain's x position
196200
if math.abs(peak_y) > math.abs(r_pedestrain_y_temp):
197201
minimum_deceleration = math.abs(softest_accleration)
198-
else:
199-
softest_accleration = - (r_velocity_x_from_vehicle**2) / (2 * r_pedestrain_x)
200-
minimum_deceleration = math.abs(softest_accleration)
202+
# else: the vehicle should be stopped exactly before the pedestrain's x position the same case as the pedestrain barely move laterally
201203

202-
else:
204+
if minimum_deceleration is None:
203205
minimum_deceleration = r_velocity_x_from_vehicle**2 / (2 * r_pedestrain_x)
204206
else:
205207
pass

0 commit comments

Comments
 (0)