Slamtec / rplidar_ros

BSD 2-Clause "Simplified" License
485 stars 527 forks source link

RPLiDAR Node Crashes with `std::bad_array_new_length` #136

Open grwells opened 9 months ago

grwells commented 9 months ago

Hi I am working through the iRobot Create3 LiDAR SLAM tutorial and have run into the issue that when the rplidar composition node is running, no data is published to the /scan topic (partly because waiting for subscriber). Then, as soon as the topic is subscribed to, the rplidar node crashes with:

[rplidar_composition-2] [INFO] [1696367215.051876111] [rplidar_node]: RPLidar running on ROS2 package rplidar_ros. RPLIDAR SDK Version:2.0.0
[rplidar_composition-2] [INFO] [1696367215.102402199] [rplidar_node]: RPLidar S/N: B8D285C1E8839EF5C8E49BF668672B03
[rplidar_composition-2] [INFO] [1696367215.102533110] [rplidar_node]: Firmware Ver: 1.20
[rplidar_composition-2] [INFO] [1696367215.102564163] [rplidar_node]: Hardware Rev: 2
[rplidar_composition-2] [INFO] [1696367215.153908247] [rplidar_node]: RPLidar health status : 0
[rplidar_composition-2] [INFO] [1696367215.154012062] [rplidar_node]: RPLidar health status : OK.
[rplidar_composition-2] [INFO] [1696367215.154041670] [rplidar_node]: Start
[rplidar_composition-2] [INFO] [1696367218.303152989] [rplidar_node]: current scan mode: , sample rate: -2147483648 Khz, max_distance: 0.0 m, scan frequency:10.0 Hz, 
[rplidar_composition-2] terminate called after throwing an instance of 'std::bad_array_new_length'
[rplidar_composition-2]   what():  std::bad_array_new_length
[ERROR] [rplidar_composition-2]: process has died [pid 23925, exit code -6, cmd '/opt/ros/humble/lib/rplidar_ros/rplidar_composition --ros-args -r __ns:=/ --params-file /home/user/Documents/U_of_I/Robotics/create3_examples_ws/install/create3_lidar_slam/share/create3_lidar_slam/config/rplidar_node.yaml']. 

Comments

  1. Running ros2 launch create3_lidar_slam sensors_launch.py
    • node launches, no errors, and reports RPLiDAR health status: OK
  2. Subscribing with ros2 topic echo /scan

I am running Pop!_OS, ROS2 Humble, RPLiDAR ROS2 flavor of rplidar_ros repo, and have replicated these results on several different machines including my desktop and the RPi 4 I am using on the Create3.

As far as I can tell, this is an error internal to the rplidar_ros package, in the source code, but debug information is insufficient for someone unfamiliar with the project to trace. Some research indicates this is an array related error, but documentation in the code is scarce enough I would welcome any input before swimming through the code.

grwells commented 9 months ago

Notes after further research and discussion in #138:

  1. I found more related issues in sllidar_ros2. These indicate that the potential solution is downgrading the SDK version.
  2. Alternatively, upgrade to a newer hardware revision, the A2M12 in my case.

Conclusion: fixing this bug is not a priority/doesn't have maintainer attention yet, so path of least resistance is to shell out for a new lidar.