Visualizing RPLiDAR on Raspberry Pi with RViz via VM

Step-by-Step Guide: Visualizing RPLiDAR on Raspberry Pi with RViz via VM

Author: Techwith Reddix

Date: December 2025

Introduction

RPLiDAR sensors are widely used for SLAM, mapping, and autonomous robotics. Visualizing LiDAR data directly on a Raspberry Pi can be slow. This guide shows you how to run RPLiDAR on Raspberry Pi and visualize the scan data on RViz running on a VM, creating a lightweight and fast workflow.

  • Raspberry Pi ROS Noetic setup
  • RPLiDAR driver installation and launch
  • Network setup for ROS master / remote VM
  • TF setup for proper visualization
  • RViz configuration

By the end, you’ll have a live, rotating LiDAR scan displayed in RViz.

Prerequisites

  • Raspberry Pi (Ubuntu 20.04, ROS Noetic)
  • RPLiDAR sensor (A1, A2, or A3 series)
  • Ubuntu VM (Ubuntu 20.04, ROS Noetic, RViz installed)
  • Ethernet/Wi-Fi connection between Pi and VM

Step 1: Raspberry Pi Setup

  1. Install Ubuntu 20.04 using Raspberry Pi Imager.
  2. Enable SSH:
    sudo systemctl enable ssh
    sudo systemctl start ssh
  3. Update system packages:
    sudo apt update
    sudo apt upgrade -y
  4. Install Python3 and essential tools:
    sudo apt install python3-pip python3-venv git -y

Tip: Do not auto-start ROS nodes yet. All nodes will be launched manually to avoid conflicts.

Step 2: ROS Noetic Installation

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu focal main" > /etc/apt/sources.list.d/ros-latest.list'
sudo apt install curl -y
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

sudo apt update
sudo apt install ros-noetic-desktop-full -y

sudo rosdep init
rosdep update

echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

Step 3: Network Setup (Critical)

Configure environment variables to ensure the VM can communicate with Raspberry Pi’s ROS master.

On Raspberry Pi:

export ROS_MASTER_URI=http://192.168.31.213:11311
export ROS_IP=192.168.31.213

On VM:

export ROS_MASTER_URI=http://192.168.31.213:11311
export ROS_IP=<VM_IP_ADDRESS>

Tip: Replace <VM_IP_ADDRESS> with your VM’s actual IP. Reload .bashrc after changes.

Step 4: Start ROS Master

On Raspberry Pi:

source /opt/ros/noetic/setup.bash
roscore

Verify:

rostopic list

Only the Pi runs roscore. VM will only subscribe and visualize.

Step 5: RPLiDAR Driver Setup

On Raspberry Pi:

roslaunch rplidar_ros rplidar_a1.launch

Check scan data:

rostopic echo /scan | head

You should see continuous laser scan messages with frame_id: laser.

Step 6: TF Setup

Create a static transform between the robot base and the LiDAR:

rosrun tf2_ros static_transform_publisher 0 0 0 0 0 0 base_link laser

Check:

rosrun tf tf_echo base_link laser
  • Translation should be [0,0,0]
  • Rotation quaternion [0,0,0,1]

Step 7: RViz Configuration (VM)

  1. Launch RViz:
    rviz
  2. Set Fixed Frame to base_link.
  3. Add LaserScan display → topic /scan.
  4. Add TF display to visualize frames.

You should now see a live rotating LiDAR scan in RViz.

Step 8: Common Issues

Symptom Cause Solution
No TF data Missing static transform Run static_transform_publisher
/scan visible but not drawn Fixed Frame mismatch Set Fixed Frame = base_link
RViz lagging on Pi Hardware limitation Visualize on VM instead
ROS Master conflicts Auto-start / multiple roscore Remove systemd services & bashrc launches

Step 9: Next Steps

  • Integrate Xbox controller teleop on Pi
  • Prepare SLAM pipeline (gmapping / hector_slam)
  • Add odometry frame for mobile robot navigation
  • Set up proper static/dynamic TF tree

Conclusion

By splitting computation:

  • Raspberry Pi: handles sensor and ROS Master
  • VM: handles visualization in RViz

This keeps the system lightweight and responsive while allowing live monitoring of LiDAR data.

Screenshot Placeholders

  • Pi terminal showing /scan messages
  • RViz LaserScan visualization
  • TF tree screenshot

Comments