Naive-L-Shape fitting wrong assertion
Required information:
- Operating system and version:
- Ubuntu 18.04
- Autoware installation type:
- Source
- Autoware version or commit hash
- 1.12.0
- ROS distribution and version:
- Melodic
- ROS installation type:
- From original repos
- Package or library, if applicable:
- lidar_naive_l_shape_detect
Description of the bug
When I feed it with detections from euclidean clustering, it gives the following error.
lidar_naive_l_shape_detect: /---/src/autoware/core_perception/lidar_naive_l_shape_detect/nodes/lidar_naive_l_shape_detect/lidar_naive_l_shape_detect.cpp:274: void LShapeFilter::getLShapeBB(const DetectedObjectArray&, autoware_msgs::DetectedObjectArray&): Assertion `p_ind >= 0 && p_ind < (cloud.size() - 1)' failed.
Why it is happening and how to fix it
The line is like this:
assert(p_ind >= 0 && p_ind < (cloud.size() - 1));
And it should be one of the following instead:
assert(p_ind >= 0 && p_ind < cloud.size());
OR
assert(p_ind >= 0 && p_ind <= (cloud.size() - 1));
Otherwise the random number generated for the index will be within the acceptable limits yet will trigger the assertion error and crash.