AnishShr / autoware_mini_practice

Practice Sessions and Labs for the Autonomous Vehicles Project (Autoware mini)
MIT License
0 stars 0 forks source link

Practice 4 - solution to last task #3

Closed geopimik closed 5 months ago

geopimik commented 6 months ago

Your description to last task:

For the last task, the list of waypoints that is received once the Lane message is subscribed and the lanelet sequence is obtained, I replaced the final waypoint with the goal point that comes in /move_base_simple/goal topic.

Basically, the list of waypoints is the list of waypoints from all lanelet sequences that lead the path from the vehicle's initial position to the lanelet's final waypoint. However, when the goal is somewhere in the middle of the last lanelet, the vehicle still goes till the end of the lanelet which should not be happening. So, replacing the final waypoint with goal waypoint and stopping the vehicle once it is in distance limits will stop the vehicle somehwere near the desired goal point.

You need to adjust your solution, two examples:

  1. By placing last waypoint quite far away from the path I can create the following situation. Car will drive out of the road. Not acceptable! image

  2. Or when placed close to a lanelet beginning, but the lanelet has plenty of points, and you replace just the last one. Again, this global path is not acceptable. image

AnishShr commented 6 months ago

Adjusted solution to work in these failure cases.

From all waypoints, a new list of waypoints is created where only the waypoints whose projected distance along the path (using shapely.Linestiring.project) is less than the projected distance to the goal. The projected goal point in the path is then added to the list at the end. This ensures that the goal point will be the last waypoint and the ego vehicle does not go out of the lane as well.

Latest commit

geopimik commented 5 months ago

Will review this, once you have finished issue #4

geopimik commented 5 months ago

In general good solution. Projecting point on the path and using that to update also the goal point.

There is one tiny inefficiency In the for loop there: https://github.com/AnishShr/autoware_mini_practice/blob/5c8d1539daaad6caef1ba55738b713cf215e0ac0/practice_4/nodes/planning/global/lanelet2_global_planner.py#L89-L95

Once you find out that if d_wp_from_path_start < d_goal_from_path_start: is not true any more, you don't add more points, but the for loop still goes till the end of waypoints_list calculating the distances along the path and evaluating the if but It should not be necessary any more.

AnishShr commented 5 months ago

Once within the loop it finds out the projected distance of a waypioint to be greater than that of the goal poiint, it breaks from the loop. Added this part in the loop. https://github.com/AnishShr/autoware_mini_practice/blob/21d92c582d289c5f9fc24b477ca34f7889b10b66/practice_4/nodes/planning/global/lanelet2_global_planner.py#L92-L100

geopimik commented 5 months ago

OK