RPLidar Set Up on Headless Rasberry Pi

In this blog, we will dive into the process of setting up an RPLiDAR on a Rasberry Pi and viewing the output remotely on a Windows PC. This is useful for applications where it is necessary to use a headless Rasberry Pi.

X11 Forwarding

X11 forwarding is the chief tool in our arsenal. It is a method used to remotely run graphical applications on a Linux system and view the output on a separate display such as a local PC.

This is achieved by running a server called an X server locally on the PC. Linux PCs have an in-built X server. Windows and MacOS PCs require the server to be downloaded. Windows systems may use Xming or VcXsrv, while MacOS systems use XQuartz.



1200px-X.Org_Logo.svg.png

Narrowing down to Windows systems, VcXsrv is more powerful and reliable than Xming and is the X server recommended to run large tasks such as RViz.

Set Up Process

On PC

  • Download VcXsrv installer and install the server on your PC.

  • Search for XLaunch and open it. It should bring up the following window:

Screenshot 2025-06-26 124304.png

 


Ensure the following options are chosen as you go select 'next':

  • Multiple Windows

  • Start no client

  • Clipboard

  • Primary selection

  • Native opengl

  • Disable access control, then select ‘Finish’.

On Rasberry Pi

  • Access the Rasberry Pi on your PC by running ssh rasberry@pi.local.

  • Open a file called sshd_config by running sudo nano /etc/ssh/sshd_config.

  • Scroll to the of the code in the file with the text #X11 Forwarding no or similar. Uncomment the line by deleting the '#' and change it to X11 Forwarding yes. Save and exit.

  • Run the command export DISPLAY=PI_IP_Address:0, replacing PI_IP_Address with your PC's IP address. You could get your PC's IP address by running ipconfig on a Windows CMD terminal. The address is usually under IP4V at Wireless LAN adapter Wi-Fi.




Screenshot 2025-06-24 113852.png

The set up should now be ready to run. Confirm this by running rviz2 on the Rasberry Pi terminal. RViz should open on the PC.

  • Clone the SLLiDAR workspace into your Rasberry Pi from GitHub by running git clone https://github.com/Slamtec/sllidar_ros2.git.

  • Source your environment and build your workspace.

  • Now connect the RPLiDAR to the Rasberry Pi. Confirm the port where the LiDAR is connected by running ls /dev/ttyUSB*. You should see the port displayed as /dev/ttyUSB0 or similar. We will use this port when launching the RPLiDAR as the serial_port.



Screenshot 2025-06-26 124156.png

Launch the RPLiDAR using the command ros2 launch ros2 launch sllidar_ros2 view_sllidar_a1_launch.py serial_port:=/dev/ttyUSB0.

RViz should open and the LiDAR output be seen on the PC.



Screenshot 2025-06-19 163451.png

References

Comments

Popular posts from this blog

ROBOT MOBILE PLATFORM

Getting Started with ROS2 Humble: Workspace, Packages, and Nodes