LD20 - Raspberry pi 3b+

Hello, I’ve been trying to set up the LD20 on my raspberry pi 3b+. I have been following the directions from the wiki:
https://wiki.youyeetoo.com/en/Lidar/LD20
and I am currently on step 3.3.5: “Run the program”. After running “roslaunch ldlidar_sl_ros ld14.launch” I get the following error:
[ERROR] 1738181438.877934215]: ldlidar point cloud data publish time out, please check your lidar device.

I can’t find resources online for similar issues and am trying to finish this task ASAP since it is only one part of a larger project. I don’t have a lot of experience with raspberry pi as a whole so I’m sure there is a mistake somewhere on my end. Please let me know if you need additional information to diagnose this problem. Help would really be appreciated.

step 0: get LiDAR ROS Package

cd ~

mkdir -p ldlidar_ros_ws/src

cd ldlidar_ros_ws/src

git clone  https://github.com/ldrobotSensorTeam/ldlidar_sl_ros.git

step 1: system setup

Connect the LiDAR to your system motherboard via an onboard serial port or USB-to-serial module (for example, CP2102 module).

Set the -x permission for the serial port device mounted by the radar in the system (for example, /dev/ttyUSB0)

In actual use, the LiDAR can be set according to the actual mounted status of your system, you can use ‘ls -l /dev’ command to view.

cd ~/ldlidar_ros_ws

sudo chmod 777 /dev/ttyUSB0

Modify the port_name value in the Lanuch file corresponding to the radar product model under launch/, using ld14.launch as an example, as shown below.

<?xml version="1.0"?>
<launch>
<arg name="laser_scan_topic_name" default="scan"/>
<arg name="point_cloud_2d_topic_name" default="pointcloud2d"/>
<arg name="frame_id" default="base_laser"/>
<arg name="port_name" default="/dev/ttyUSB0"/>
<arg name="fix_to_base_link" default="true" />

<!-- LDROBOT LiDAR message publisher node -->
 <node name="ldlidar_publisher_ld14" pkg="ldlidar_sl_ros" type="ldlidar_sl_ros_node" output="screen">
  <param name="product_name" value="LDLiDAR_LD14"/>
  <param name="laser_scan_topic_name" value="$(arg laser_scan_topic_name)"/>
  <param name="point_cloud_2d_topic_name" value="$(arg point_cloud_2d_topic_name)"/>
  <param name="frame_id" value="$(arg frame_id)"/>
  <param name="port_name" value="$(arg port_name)"/>
  <param name="serial_baudrate" value="115200"/>
  <!-- Set laser scan directon: -->
  <!--    1. Set counterclockwise, example: <param name="laser_scan_dir" type="bool" value="true"/> -->
  <!--    2. Set clockwise,        example: <param name="laser_scan_dir" type="bool" value="false"/> -->
  <param name="laser_scan_dir" type="bool" value="true"/>
  <!-- Angle crop setting, Mask data within the set angle range -->
  <!--    1. Enable angle crop fuction: -->
  <!--       1.1. enable angle crop,  example: <param name="enable_angle_crop_func" type="bool" value="true"/> -->
  <!--       1.2. disable angle crop, example: <param name="enable_angle_crop_func" type="bool" value="false"/> -->
  <param name="enable_angle_crop_func" type="bool" value="false"/>
  <!--    2. Angle cropping interval setting, The distance and intensity data within the set angle range will be set to 0 --> 
  <!--       angle >= "angle_crop_min" and angle <= "angle_crop_max", unit is degress -->
  <param name="angle_crop_min" type="double" value="135.0"/>
  <param name="angle_crop_max" type="double" value="225.0"/>
 </node>
 <!-- LDROBOT LiDAR message subscriber node -->
 <!-- node name="ldlidar_listener_ld14" pkg="ldlidar_sl_ros" type="ldlidar_sl_ros_listen_node" output="screen">
  <param name="topic_name" value="scan"/>
 </node -->
 <!-- publisher tf transform, parents frame is base_link, child frame is base_laser -->
 <!-- args="x y z yaw pitch roll parents_frame_id child_frame_id period_in_ms"-->
 <node name="base_to_laserLD14" pkg="tf" type="static_transform_publisher"  args="0.0 0.0 0.18 0 0.0 0.0 base_link base_laser 50" if="$(arg fix_to_base_link)"/>
</launch>

step 2: build

install package depend

cd ~/ldlidar_ros_ws

rosdep install --from-paths src --ignore-src  -r -y
build compile
cd ~/ldlidar_ros_ws

catkin_make

step 3: run

step3.1: package environment variable settings

After the compilation is completed, you need to add the relevant files generated by the compilation to the environment variables, so that the ROS environment can recognize them. The execution command is as follows. This command is to temporarily add environment variables to the terminal, which means that if you reopen a new terminal, you also need to re-execute it. The following command.

cd ~/ldlidar_ros_ws

source devel/setup.bash

In order to never need to execute the above command to add environment variables after reopening the terminal, you can do the following.

echo "source ~/ldlidar_ros_ws/devel/setup.bash" >> ~/.bashrc

source ~/.bashrc

step3.2: start LiDAR node

The product is LDROBOT LiDAR LD14

start ld14 lidar node:

roslaunch ldlidar_sl_ros ld14.launch

start ld14 lidar node and show on the Rviz:

# if ROS_DISTRO in 'kinetic' or 'melodic'
roslaunch ldlidar_sl_ros viewer_ld14_kinetic_melodic.launch
# if ROS_DISTRO in 'noetic'
roslaunch ldlidar_sl_ros viewer_ld14_noetic.launch

The product is LDROBOT LiDAR LD14P

start ld14p lidar node:
roslaunch ldlidar_sl_ros ld14p.launch
start ld14p lidar node and show on the Rviz:
# if ROS_DISTRO in 'kinetic' or 'melodic'
roslaunch ldlidar_sl_ros viewer_ld14p_kinetic_melodic.launch
# if ROS_DISTRO in 'noetic'
roslaunch ldlidar_sl_ros viewer_ld14p_noetic.launch

step 4: test

The code was tested under ubuntu16.04 ROS kinetic、ubuntu18.04 ROS melodic、ubuntu20.04 ROS noetic, using rviz visualization.

new a terminal (Ctrl + Alt + T) and use Rviz tool,open the rviz config file below the rviz folder of the readme file directory

rviz

When I follow those instructions:

Step 1
I don’t know what to modify the port_name to. I kept it as “/dev/ttyUSB0”
Step 2
When I run “build compile” the ‘build’ command is not found.
I just ran catkin_make anyway
Step 3
I get the same error as before when I run ‘roslaunch ldlidar_sl_ros ld14.launch’
[ERROR] 1738181438.877934215]: ldlidar point cloud data publish time out, please check your lidar device.

Please try LD14P. Thanks