26 Feb 2025 Blog

LiDAR with Single-Board Computer

Introduction

This tutorial will guide you through setting up and using the Livox Avia LiDAR sensor with the Radxa X4 single-board computer (SBC). The goal is to help you integrate LiDAR for applications such as mapping, obstacle detection, and real-time 3D data collection.

Prerequisites

Before you begin, ensure you have the following:

  • LiDAR Sensor: Livox Avia
  • Single-Board Computer (SBC): Radxa X4
  • Operating System: Ubuntu 22.04 LTS
  • Power Supply: Sufficient for both LiDAR and SBC
  • Peripherals: Monitor, keyboard, and mouse (optional for headless setup)
  • Software: Livox SDK, necessary dependencies

Step 1: Setting Up the Radxa X4

1.1. Install the OS:

  • Radxa X4 has N100, Intel® Atom® X7000E Series (Alder Lake N)
  • Download Ubuntu 22.04 LTS from Ubuntu.
  • Create bootable USB with Rufus, for Volume label, File system etc., use the default selections when loading the image on Rufus.
  • Plug the USB on to the Radxa X4 and turn on power, press F7 key to enter boot selection.
  • Select bootable USB device on the list and follow the instructions.

1.2. Set Up Network:

  • Connect to Ethernet for package installation and updates.
  • Enabling Wi-Fi takes few more steps. Radxa X4 has Realtek RTL8852BE
  • If running Ubuntu 22.04 and down.
sudo apt install linux-oem-22.04d

Step 2: Installing Livox SDK

2.1. Update and Install Dependencies:

sudo apt update && sudo apt upgrade -y
sudo apt install git cmake build-essential libusb-1.0-0-dev

2.2. Clone the Livox-SDK Repository

Livox Tele-15/Mid-70/Avia/Horizon uses SDK, which only officially supports up to 18.04.

cd ~
git clone https://github.com/Livox-SDK/Livox-SDK.git

2.3. Modify Source Code for Ubuntu 22.04

For Ubuntu 22.04, a single line need to add in two files that are located in the base folder

#include <memory>

The location of the code are as follows.

nano Livox-SDK/sdk_core/src/base/thread_base.h

Near the top, add the missing include for <memory>. For example, modify the header as follows:

#ifndef LIVOX_THREAD_BASE_H_
#define LIVOX_THREAD_BASE_H_
#include <atomic>
#include <thread>
#include "noncopyable.h"
#include <memory>

Now open the second file:

nano Livox-SDK/sdk_core/src/base/thread_base.cpp

Place the <memory> in the following location:

#include "thread_base.h"
#include <memory>
#include <thread>

Step 3. Configure the Project

There are already ‘build’ folder in the repository, as always the location from the user root are:

cd ~
cd Livox-SDK
cd build
cmake ..

Step 4. Build the SDK

Now compile the SKD:

cd ~
cd Livox-SDK
cd build
make -j4

The -j4 flag tells make to run 4 parallel jobs; you can adjust this number is based on Radxa X4’s CPU core counts, in case you are on any other system, you can put higher accordance number to your CPU core counts.

If you make any source changes after the first configuration, it’s a good idea to clean your build directory:

cd ~
cd Livox-SDK
cd build
make clean
rm -rf *
cmake ..
make -j4

Step 5. Test the Installation

you can run samples in sample folder.

cd ~
cd Livox-SDK
cd build
cd sample
./sample

Let’s explore how to connect the LiDAR device on other posts.

Leave a Reply

Your email address will not be published. Required fields are marked *