At the end of the global_path_callback you call a function lanelet_to_waypoints, and you do it also in current_pose_callback. Currently this function does not return anything and also publishes the global_path.
It should return list of waypoints and then you can call a separate function with this list of waypoints as an argument. Then instead of calling lanelet_to_waypoints from current_pose_callback, you can call this much lighter function with just an empty list. This lighter function should have a more explanatory name like publish_waypoints and it would result in cleaner and better understanding. Currently the name lanelets_to_waypoints doesn't say anything about publishing and I need to go and see if it also publishes the waypoints.
So basically, I'm asking You to split the existing function lanelet_to_waypoints into 2 separate functions.
At the end of the
global_path_callback
you call a functionlanelet_to_waypoints
, and you do it also incurrent_pose_callback
. Currently this function does not return anything and also publishes theglobal_path
.https://github.com/jaak-peterson/autoware_mini_practice/blob/7df7b776cd80ca3a60784d6644eb98fbcd7ac4b5/practice_4/nodes/planning/global/lanelet2_global_planner.py#L74 https://github.com/jaak-peterson/autoware_mini_practice/blob/7df7b776cd80ca3a60784d6644eb98fbcd7ac4b5/practice_4/nodes/planning/global/lanelet2_global_planner.py#L83
It should return list of waypoints and then you can call a separate function with this list of waypoints as an argument. Then instead of calling
lanelet_to_waypoints
fromcurrent_pose_callback
, you can call this much lighter function with just an empty list. This lighter function should have a more explanatory name likepublish_waypoints
and it would result in cleaner and better understanding. Currently the namelanelets_to_waypoints
doesn't say anything about publishing and I need to go and see if it also publishes the waypoints.So basically, I'm asking You to split the existing function
lanelet_to_waypoints
into 2 separate functions.The small part where you create a
Lane()
message should be a separate function (task 4, point 5 and 1st bullet) https://github.com/jaak-peterson/autoware_mini_practice/blob/7df7b776cd80ca3a60784d6644eb98fbcd7ac4b5/practice_4/nodes/planning/global/lanelet2_global_planner.py#L111-L115