apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Apollo fails to drive forward when vehicle starts on top of the stop line

Open YuqiHuai opened this issue 2 years ago • 0 comments

Describe the bug When the ego vehicle approaches the stop sign, it goes through pre_stop, stop, creep and intersection_cruise stages, and resumes moving after stopping before the stop line. However, if I initialize the scenario by placing the ego vehicle on top of a stop line, the planning module does not recognize it is in one of the stop sign stages, and never begins moving to complete any routing request.

To Reproduce

  1. Start Dreamview
  2. Modify the parameter passed to send_localization to 0, -1, -2, or -3 in the provided script. (under "Additional Context" section)
  3. Run provided script to send localization to Apollo.
  4. Turn on SimControl, planning, routing.
  5. Send a routing request to make the vehicle go straight, by clicking on a point across the junction, and "Send Routing Request" button.
  6. Observe routing produced trajectory but no planning trajectory, thus vehicles stops indefinitely.
  7. Turn off Sim Control.
  8. Repeat step 2-6, but changing the value in Step 3 to -4 or -5. Observe vehicle completes routing request.

Expected behavior Although the scenario started with the vehicle on top of the stop line, the vehicle should recognize its current scenario being stop_sign/unprotected/stop, or some other scenario and resume moving forward to complete the routing request.

Screenshots Expected routing request on Borregas Avenue image

Routing will be completed if the vehicle's head was behind the stop line image

Routing will not be completed if the vehicle's head has passed the stop line image

Dreamview when reproducing the bug. image

Additional context provided_script.zip

Scenario manager is calling reference_line_info.FirstEncounteredOverlaps() to check for stop sign overlap, and reference_line_ starts from the head of the vehicle. So if the head of the vehicle has passed the stop line, Scenario manager will fail to recognize there exists a stop sign overlap.

https://github.com/ApolloAuto/apollo/blob/9367741c57753e07c753bad82e1eac09876b344a/modules/planning/common/reference_line_info.h#L334-L339

From the planning log, I see messages like

E0805 19:05:17.417805 24312 st_bounds_decider.cc:316] No valid st-boundary exists.
E0805 19:05:17.417834 24312 lane_follow_stage.cc:177] Failed to run tasks[ST_BOUNDS_DECIDER], Error message: No valid st-boundary exists.
E0805 19:05:17.418452 24312 lane_follow_stage.cc:373] Use last frame good path to do speed fallback
E0805 19:05:17.418457 24312 lane_follow_stage.cc:288] Speed fallback due to algorithm failure
E0805 19:05:17.418460 24312 speed_profile_generator.cc:38] Fallback using piecewise jerk speed!
W0805 19:05:17.418464 24312 speed_profile_generator.cc:41] init_v = 0, init_a = 0
W0805 19:05:17.418471 24312 speed_profile_generator.cc:47] Already stopped! Nothing to do in GenerateFallbackSpeed()

To fix this bug I believe there are 2 options:

  1. Extend the reference line to include the length of the vehicle. So reference line starts from the back of the vehicle. I am not sure if this is a good idea if other modules are implemented assuming reference line starts from the head of the vehicle.
  2. Modify how overlap is calculated, to consider the length of the vehicle. https://github.com/ApolloAuto/apollo/blob/9367741c57753e07c753bad82e1eac09876b344a/modules/map/pnc_map/path.cc#L494

YuqiHuai avatar Aug 06 '22 02:08 YuqiHuai