Compile the lsx10 Package
- Copy the
lsx10package into thesrcdirectory of your Catkin workspace (this example uses a workspace for an Ackermann mobile robot platform). - Install required dependencies:
sudo apt-get install libpcap-dev
- Navigate to the root of your Catkin workspace, first compile the message definitions:
catkin_make -DCATKIN_WHITELIST_PACKAGES=lslidar_msgs
- Compile the LiDAR driver package:
catkin_make -DCATKIN_WHITELIST_PACKAGES=lslidar_driver
Install CH9102 Serial Driver
- Download the CH343 USB serial driver archive from https://github.com/WCHSoftGroup/ch343ser_linux, then extract the downloaded files.
- Check for and unload the conflicting
cdc_acmkernel module: Runlsmod | grep cdc_acmto verify if the module is loaded. If output is returned, unload it with:
sudo rmmod cdc_acm
Skip this step if no matching module is found. 3. Compile and install the driver:
- Navigate to the
driverfolder inside the extracted archive, then runmaketo build the kernel module. - Load the compiled module:
sudo make load
- Install the module to system directories:
sudo make install
- Add the module to system startup to auto-load on boot: Edit
/etc/moduleswith:
sudo gedit /etc/modules
Add ch343 to the end of the file, save and exit, then reboot your system.
- Verify the module is loaded after reboot:
lsmod | grep ch343
Run the N10 LiDAR Driver
- Connect the LiDAR to your Ubuntu machine. Confirm the device is recognized as a serial port with:
ll /dev | grep ttyCH343USB
The detected port will typically be named ttyCH343USB0; you can create a persistent symlink to rename it for easier access (this example uses wheeltec_lidar as the alias).
2. Configure the ROS launch file:
Open lsx10/lslidar_driver/launch/lslidar_serial.launch in a text editor (VS Code is recommended for easy navigation). Update two key parameters:
- Set
lidar_nametoN10(valid options includeM10,M10_P,M10_PLUS,M10_GPS,N10,N10_P,L10) - Set
serial_portto/dev/wheeltec_lidar(or your custom symlinked port name)
- Start the LiDAR driver:
roslaunch lslidar_driver lslidar_serial.launch
- View LiDAR data:
- Print raw scan data to the terminal:
rostopic echo /scan
- Visualize point cloud data using RViz:
rviz
In RViz, set the Fixed Frame to laser, then click Add > LaserScan to load the scan visualization.
Troubleshooting Common Errors
Error 1: Failed to Load ch341 Kernel Module
Error Message: insmod: ERROR: could not insert module ch341.ko: Invalid module signature
Cause: Secure Boot is enabled, blocking unsigned kernel module loading.
Solution:
- Install
mokutil:
sudo apt-get install mokutil
- Disable Secure Boot validation:
sudo mokutil --disable-validation
- Set an 8-digit temporary password (this example uses
00000000). - Reboot your system. When the MOK Manager menu appears, select
Change Secure Boot state, enter the 8-digit password when prompted, confirm the change, then reboot again. - Re-run
sudo make loadto load the kernel module.
Error 2: Failed to Open Serial Port
Error Message: [ WARN] [timestamp]: open_port /dev/wheeltec_lidar ERROR ! followed by the driver process exiting cleanly.
Cause: The serial port symlink is missing or misconfigured, or the port name does not match the launch file settings.
Solutions:
Method 1: Create Persistent Serial Port Symlink via Udev Rules
- Identify the kernel port path for your LiDAR device:
udevadm info --attribute-walk --name=/dev/ttyCH343USB0
Locate the KERNELS value under the third parent device entry (example value: 1-10.2.4).
2. Create a udev rule file:
sudo gedit /etc/udev/rules.d/99-usb-serial.rules
- Add the following line to the file, replacing the
KERNELSvalue with your own:
KERNELS=="1-10.2.4", MODE:="0777", GROUP:="dialout", SYMLINK+="wheeltec_lidar"
- Save and exit the file, then apply the new udev rules:
sudo udevadm trigger
- Verify the symlink exists with
ll /dev | grep wheeltec_lidar, then re-run the launch command to start the LiDAR.
Method 2: Grant Serial Port Permissions
Grant global read/write access to the detected serial port (works for some single-device setups):
sudo chmod a+rw /dev/ttyCH343USB0