LiDAR integration with ROS Noetic and Ubuntu on Raspberry Pi

This tutorial will cover how to install ROS Noetic on the Ubuntu 20.04 LTS OS and LiDAR integration with Raspberry Pi 4.

As you already know, ROS Noetic is mainly developed for Ubuntu 20.04, so Ubuntu is the recommended Linux OS for installation. This tutorial explains how to install ROS Noetic on the Raspberry Pi and how to connect your LiDAR to Raspberry Pi 4 Model B using ROS Noetic middleware on Ubuntu Server 20.04.

Prerequisites

Before you get started with this tutorial, you will need the following:

  • Raspberry Pi 4 Model B
  • RPLidar A1M8
  • A computer with an internet connection and the ability to flash your microSD card. Here we’ll be using laptop.
  • High-performance microSD card: 32GB minimum
  • MicroSD to SD adapter
  • You will need a monitor, keyboard, and mouse (at least for the initial setup)
  • ROS applications use a lot of compute resources and the heat sink may not be enough for the heat generated. Consider adding a cooling fan to your Raspberry Pi 4.
  • Some experience with ROS is helpful but not required.

So, let's get started.

Step 1: Download the Ubuntu Server image and flash it

First you have to download the OS image. Go to the download page of the Ubuntu official website.

  • Download and install Etcher from the website.
  • Click Select Image in Etcher.
  • Attach your SD card to the computer. Etcher will select it automatically.
  • Click Flash! to write the image file to the SD card.

When done, remove the SD card, insert it into your Raspberry Pi.

Step 2: Boot your Raspberry Pi

You probably already know that you need a few things to get started with Raspberry Pi such as a mouse, keyboard, HDMI cable etc.

  • Plug in a mouse and a keyboard.
  • Connect the HDMI cable.
  • Insert your MicroSD card.
  • Plug in your Ethernet cable, if you’re using one.

When everything else is set up, power it on your Raspberry Pi by plugging the power cable. After powering on your Raspberry Pi, wait for the boot process to complete and you should see the following message on window.

Login with the default user. The default credentials are:

login: ubuntupassword: ubuntu

The first time you log in, you’ll be asked to change this password.

After changing the default password, you should be greeted by a message confirming that you’re now connected.

Step 3: WiFi setup using netplan

Starting from Ubuntu 18.04 LTS, Ubuntu uses Netplan to configure network interfaces by default. Netplan is a utility for configuring network interfaces on Linux. Netplan uses YAML files for configuring network interfaces. YAML configuration file format is really simple. It has clear and easy to understand syntax.

To be able to setup Wifi on Raspberry Pi, you first need to get the name of the wifi card by showing physical components using the following command:

sudo lshw

In my case it was wlan0. Then navigate to /etc/netplan/ using the cd command

cd /etc/netplan/

Edit the Netplan YAML configuration file /etc/netplan/50-cloud-init.yaml with the following command:

sudo nano 50-cloud-init.yaml

Add your WiFi access information. Make sure not to use tab for space, use the spacebar to create the blank.

# This file is generated from information provided by# the datasource.  Changes to it will not persist across an instance.# To disable cloud-init's network configuration capabilities, write a file# /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:# network: {config: disabled}network:    version: 2    ethernets:        eth0:            optional: true            dhcp4: true    # add wifi setup information here ...    wifis:        wlan0:            optional: true            access-points:                "YOUR-SSID-NAME":                    password: "YOUR-NETWORK-PASSWORD"            dhcp4: true

Change the SSID-NAME and the YOUR-NETWORK-PASSWORD with your information. Close and save the file using ctrl+x and press yes.

Now, check whether there’s any error in the configuration file with the following command:

sudo netplan –debug try

If any error encounters then you can check with this command for detailed error information.

sudo netplan --debug generate

Apply the configuration file with the following command:

sudo netplan --debug apply

Finally, reboot your PI

sudo reboot

Step 4: Updating and upgrading software packages on your Pi

To make sure all dependencies are up to date, run the following command

sudo apt-get update

If you want to get the latest versions of software you installed already, run

sudo apt-get upgrade

This command upgrades all the software on your Pi to the latest version. It can take a while to run, so you don’t need to do it often. You have to press Y and Enter to confirm.

Source: LiDAR integration with ROS Noetic and Ubuntu on Raspberry Pi


About The Author

Muhammad Bilal

I am highly skilled and motivated individual with a Master's degree in Computer Science. I have extensive experience in technical writing and a deep understanding of SEO practices.

Leave a Comment

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

Scroll to Top