Tinkering with ROS & YDLidar: Setting up your Workspace

Amnah Ebrahim
4 min readAug 24, 2023

--

In this tutorial, we will look at how to use ROS, with YDLidar while utilising hobbyists’ favorite tool: the raspberry pi! Most specifically:

  • What you’ll need
  • What ROS is in Layman Terms
  • Choosing the appropriate OS image to flash the Micro SD Card
  • Installing ROS Noetic

What you’ll need:

You’ll need:

  • Raspberry pi 4 (RPI4) preferably with 8GB RAM.
  • USB-C to power the RPI4
  • Micro SD Card and SD Card Reader to flash the OS image into the SD Card (Anything from 8GB to 32GB)
  • Keyboard and Mouse
  • Monitor and micro-hdmi to hdmi cable
  • YDLidar

I am personally using a kit that comes with all things required for setting up and hooking up the RPI(micro-hdmi to hdmi cables, power supply, Micro SD Card, USB MicroSD Card Reader, Raspberry Pi 4 Case with Integrated Fan Mount, and a set of Heat Sinks). If you’re interested it’s this one!

But before we start we need to familiarise ourselves with ROS.

What’s ROS in Layman Terms and Why Do We Need It?

Robot Operating System (ROS) is a software framework or platform that helps robotic devices communicates. It provides a set of tools, and libraries, that make the development of robotic applications simple.

ROS acts as a middleman between robots, allowing for exchange of data, commands, and information easily and in a standardized way regardless of their hardware or software differences. It abstracts the complexities of robot hardware and provides a uniform interface for different devices.

YDLidar has their own driver named “ydlidar_ros_driver” which simply is a new ROS package for ydlidar devices in the ROS environment.

Ros has mulitple releases, the one we are most interested in is the ROS Noetic Ninjemys which we will use in these tutorials.

ROS Noetic Ninjemys

To use ROS Noetic Ninjemys which is the latest ROS 1 LTS (Longterm support) Release, our raspberry pi’s SD card must be flashed using the the Ubuntu 20.04 (Focal) release image or Debian Buster (10). Other systems are supported to varying degrees but we don’t need to complicate things for ourselves more than enough.

32 bit vs 64 bit?

Raspberry Pi 2 only supports 32 bits. However, when dealing with the Raspberry Pi 3 and 4, we must understand that they are are 64-bit boards. According to the Raspberry Pi foundation, with the Pi 4, the 64-bit version should be faster. However it should be fine to use the 32-bit too!

You can download Ubuntu 20.04 Focal Fossa here. Please download the image named “Desktop image”.

For Debain 10, download the zip file from here. It’s the one with:

Raspberry Pi OS (Legacy) with desktop

  • Release date: May 3rd 2023
  • System: 32-bit
  • Kernel version: 5.10
  • Debian version: 10 (buster)

Through the Raspberry Pi Imager you can flash your SD card with the image. Watch this video if you’re new to this:

When you’re done, you can plug your Mirco SD Card into the PI, and turn on the power supply. On the corner of the board next to POWER are two tiny LEDs, one should be RED, and the other labelled ACT is green. If the ACT LED doesn’t blink then the PI doesn’t see the files on the card, which can be due to many reasons. To better understand the issue visit this website .

I had trouble with the Ubuntu OS, so I am using Debian 10.

ROS Noetic installation

For the OS you’ve chosen to use you can follow the ROS Noetic Installation Instructions here. I will be following the Debain installation instructions that I found in the website below and I recommend you do the same:

And that’s a wrap!

If you followed the tutorial to the end of it, well done! You are one step closer to building and learning more on the interesting world of robotics and lidar! In the next tutorial we will look at how we can install YDLidar’s SDK onto your Pi and get started.

Sources:

--

--

Amnah Ebrahim

Electronics engineer passionate about electronics, machine learning, autonomous robotics, and natural language processing!