for i in range(len(edge_points) - 1):
            start = edge_points[i]
            end = edge_points[i + 1]

            mid = (start + end) // 2

            print("start:",start)
            print("end:",end)
            print("mid:",mid)
            segment_distances = distance_list[start:end + 1]
            segment_angles = angle_list_origin[start:end + 1]

            full_count = 0

            for j in range(len(segment_distances)):
                d = segment_distances[j]
                angle = segment_angles[j]

                if angle == 0 or (angle > 0 and segment_angles[-1] < 0) or (angle < 0 and segment_angles[0] > 0):
                    hypotenuse_dist = vetric_distance + depth_shelves
                else:
                    cos_angle = np.cos(np.radians(abs(angle)))
                    hypotenuse_dist = (vetric_distance + depth_shelves) / cos_angle

                if d < (hypotenuse_dist - 0.05):
                    full_count += 1

            total_count = len(segment_distances)
            percentage_full_count = full_count / total_count

            mid_angle = segment_angles[mid]

这段代码在第一个segment都没问题,第二个segment报错:Final Edge Points: [16, 259, 595, 798]
angle_edge_points: [16, 259, 595, 798] egde_points_angle: -48.942401382209255
angle_edge_points: [16, 259, 595, 798] egde_points_angle: -17.692600820347053
angle_edge_points: [16, 259, 595, 798] egde_points_angle: 25.51699995654883
angle_edge_points: [16, 259, 595, 798] egde_points_angle: 51.62280042592343
Average Vertical Distance: 3.269450798013846
start: 16
end: 259
mid: 137
Segment 0: Percentage full count: 84.43%
start: 259
end: 595
mid: 427
Traceback (most recent call last):
  File "/tmp1/ros_ws/install/cargo_detect_py/lib/cargo_detect_py/detect", line 33, in <module>
    sys.exit(load_entry_point('cargo-detect-py==0.0.0', 'console_scripts', 'detect')())
  File "/tmp1/ros_ws/install/cargo_detect_py/lib/python3.10/site-packages/cargo_detect_py/test01.py", line 181, in main
    rclpy.spin(lidar_storage_detection)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/__init__.py", line 222, in spin
    executor.spin_once()
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 739, in spin_once
    self._spin_once_impl(timeout_sec)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 736, in _spin_once_impl
    raise handler.exception()
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/task.py", line 239, in __call__
    self._handler.send(None)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 437, in handler
    await call_coroutine(entity, arg)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 362, in _execute_subscription
    await await_or_execute(sub.callback, msg)
  File "/opt/ros/humble/local/lib/python3.10/dist-packages/rclpy/executors.py", line 107, in await_or_execute
    return callback(*args)
  File "/tmp1/ros_ws/install/cargo_detect_py/lib/python3.10/site-packages/cargo_detect_py/test01.py", line 163, in lidar_callback
    mid_angle = segment_angles[mid]
IndexError: list index out of range
[ros2run]: Process exited with failure 1