This node is a reactive algorithm for obstacle avoidance.
Steps
- Obtain laser scans and preprocess them.
- Find the closest point in the LiDAR ranges array.
- Draw a safety bubble around this closest point and set all points inside this bubble to 0. All other non-zero points are now considered “gaps” or “free space”.
- Find the max length “gap”, in other words, the largest number of consecutive non-zero elements in your ranges array.
- Find the best goal point in this gap. Naively, this could be the furthest point away in your gap, but you can probably go faster if you follow the “Better Idea” method as described in lecture.
- Actuate the car to move towards this goal point by publishing an
AckermannDriveStamped
to the /drive topic.