jaak-peterson / autoware_mini_practice

MIT License
0 stars 0 forks source link

Practice_4 - pure_pursuit_follower - fix empty path behaviour in the follower #8

Closed geopimik closed 6 months ago

geopimik commented 7 months ago

There are a couple of fundamental issues in the follower.

  1. You can't stop vehicle form within path_callback - it is called only when new path arrives. It runs only when you receive empty path and it will come once to a latched topic.

  2. There should be no separate function for stopping the vehicle: https://github.com/jaak-peterson/autoware_mini_practice/blob/7df7b776cd80ca3a60784d6644eb98fbcd7ac4b5/practice_4/nodes/control/pure_pursuit_follower.py#L72-L78

  3. You should always publish vehicle_cmd from current_pose_callback. When ever new pose arrives we need to publish new commands

    • if the there is no path (path is None) we just set the steering and velocity to 0 and publish these
    • else we calculate the vehicle command
  4. Currently you are not setting the self.path_linestring and self.distance_to_velocity_interpolator to None in the path_callback.

    • instead you check if len(waypoints_xy) == 0 and then call stop_vehicle() - but it should not be done like that.
    • And as a result you end up calculating new driving commands in current_pose_callback
    • See also issue #2 point 3

https://github.com/jaak-peterson/autoware_mini_practice/blob/7df7b776cd80ca3a60784d6644eb98fbcd7ac4b5/practice_4/nodes/control/pure_pursuit_follower.py#L29-L46

geopimik commented 7 months ago

Almost, but need to fix the following:

  1. You need to first use the self.lock and assign the class variables to local variables. After that, you can check if the local variables are not None (this guarantees that they are not changed during the callback) and continue using them inside the callback.
  2. Currently you create VehicleCmd() in 2 places. I would leave that at the end. And in the if I would just set the steering_angle and velocity to 0 and remove the return. Then add an else block, where all the calculation is going on and at the end of callback the VehicleCmd() will be created and published.

https://github.com/jaak-peterson/autoware_mini_practice/blob/8136687018f903b9cee09250bd1b6d785b69cf3b/practice_4/nodes/control/pure_pursuit_follower.py#L54-L86

geopimik commented 6 months ago

OK