1: Installing Prerequisites - Grantham00/rplidar_detection GitHub Wiki

Installation

This page will take you through the basics of installing ROS as well as the python dependencies required for the rplidar_detection script. The prerequisite for this guide is a working installation of Ubuntu 18.04 "Bionic Beaver", either via dual boot or virtual machine. If using a different version of Ubuntu, be sure to install the correct version of ROS.

Installing ROS

Prerequisite: Ubuntu 18.04 ("Bionic Beaver")

Note: This should already be set up on the KSU Makerspace computer.

What is ROS?

http://wiki.ros.org/ROS/Introduction

ROS stands for Robot Operating System. It is a collection of frameworks and tools for robotics software. Among other features, it has a message transport layer that is useful for our purposes. Put simply, ROS allows a sensor (or say, thirty sensors!) to continuously publish a stream of data that can be accessed by other processes. This enables the creation of more complex robot software than what can be achieved on a microcontroller such as Arduino. Read more about ROS on the official ROS Wiki.

This script is built with ROS Melodic in mind. The official installation guide can be found here. Here's the abridged version:

Start with an apt-get update and upgrade. This will ensure that the packages on your system are up to date:

Note the commands in the block below. The first command ends with "&& \ ". This tells the terminal to run the next line upon completion of the first. For ease of use, you can copy and paste all of these lines into the terminal at once. If something doesn't work, find the problematic command by pasting one line at a time.

Copy the following block and paste it into the terminal with CTRL-Shift-V.

sudo apt-get update && \
sudo apt-get upgrade

HINT: The terminal can be found in the app drawer under "Utilities". Alternatively, a terminal can be opened with the shortcut CTRL-ALT-T.

Next, install ROS. This block combines each step.

Copy the following block and paste it into the terminal with CTRL-Shift-V

sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list' && \
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 && \
sudo apt update && \
sudo apt install ros-melodic-desktop-full && \
sudo rosdep init && \
rosdep update && \
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc && \
source ~/.bashrc

Finally, we need to set up a catkin workspace. Catkin is ROS's build system. It used to compile ROS packages. See Section 1 of this ROS Wiki page for more info.

Copy the following block and paste it into the terminal with CTRL-Shift-V.

mkdir -p ~/catkin_ws/src
cd ~/catkin_ws/
catkin_make

Upon successful completion of the catkin_make command, the ~/catkin_ws/ directory should contain three folders: build, devel, and src. You can confirm this with either the ls command in the ~/catkin_ws directory, or simply navigate to the directory with the Ubuntu file explorer.

If catkin_make failed, try rebooting, using a new terminal, or rerun the command source ~/.bashrc command from the previous step.

Done!

Installing Python Packages

Prerequisite: Python (installed by default in Ubuntu)

Note: This should already be set up on the KSU Makerspace machine.

Python packages are additional libraries and extensions that can be downloaded and implemented in your code. Rospy is installed when ROS is installed. Numpy and Matplotlib are included in the Scientific Python Distribution:

Copy the following block and paste it into the terminal with CTRL-Shift-V

sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

Done!

Installing RPLIDAR ROS Driver

Prerequisites: ROS installed in Ubuntu

Note: This should already be set up on the KSU Makerspace machine.

Open a terminal and use the following command to change the directory to /home/catkin_ws/src

Copy the following block and paste it into the terminal with CTRL-Shift-V

cd ~/home/catkin_ws/src

Now using the same terminal, clone the RPLIDAR Github repository.

git clone https://github.com/robopeak/rplidar_ros.git

Now catkin_make

Copy the following block and paste it into the terminal with CTRL-Shift-V

catkin_make

Done!

Next: Download and Setup