3. ros - arieldo/MorBot GitHub Wiki

Welcome to the MorBot ROS Wiki! Here you can find everything you need to get up and running with ROS on your MorBot .

Before we jump into ROS Melodic on Ubuntu 18.04 and Creating a ROS Workspace for MorBot to taking over the world , let's talk about some Linux first.

What is Linux?

Linux is an operating system (OS) that is used to control and manage computer hardware. It is similar to Windows and Mac OS, but it is different in many ways. Linux is free and open source, which means that anyone can use it, modify it, and share it with others. Linux is also very secure, which means that it is difficult for hackers to break into your computer and steal your personal information.

So if you dont feel ready to conquer the ROS installation qvest yet please check linux Tutorial wiki .

Table of Contents

  1. Introduction to ROS
  2. Prerequisites
  3. Installation
  4. Workspace

What is ROS

Imagine you have a super cool video game that you want to play on your computer. But to play the game, you need to install it first. Installing the game means putting all the necessary files and settings onto your computer, so the game can run smoothly.

Now, let's talk about ROS (Robot Operating System) Melodic and Ubuntu 18.04.

Ubuntu 18.04 is like the computer you're using, and ROS Melodic is like the super cool video game you want to play, but in this case, it's a set of tools to help you build and control robots.

Installing ROS Melodic on Ubuntu 18.04 means putting all the necessary files, tools, and settings onto your Ubuntu 18.04 computer, so you can start building and controlling robots using ROS Melodic. Once ROS Melodic is installed, your computer will be ready to help you create awesome robots and make them do amazing things!

Prerequisites

Before installing ROS Melodic, make sure you have the following prerequisites:

OR

  • Ubuntu 18.04 Desktop PC
    • If you don't have an ubuntu 18.04 machine , you can easily start one via VirtualBox.

note:If you like to play with ROS on a Desktop pc , All Ros Wiki Tutorial including ->

ROS 101 --> Creating New Packages in ROS --> ROS PubSubPy --> Ros turtlesim

Can be done both on a Desktop pc and on the Jetbot,

Ros Workshop can be done ONLY on the jetbot

Installation Steps

Follow these steps to install ROS Melodic on Ubuntu 18.04:

  1. Configure your Ubuntu system to accept software from packages.ros.org. First, add the ROS repository to your system's list of package sources:

But first let's understand what is a ROS repository!

Imagine you have a big library filled with books on many different topics. Each book contains knowledge and information about a specific subject. The library is organized so that you can easily find the book you're looking for when you need it. This library is a place where you and others can visit to learn new things, share knowledge, and discover exciting ideas.

In the world of computers, a repository is like that big library. It's a place where people store and organize computer code (which is like the knowledge in books) for a specific project or a collection of projects. These projects could be about anything, like building robots, creating websites, or making video games.

A repository helps keep all the code organized, and it also allows people to work together on projects more easily. They can add new code, make changes to existing code, and even track the history of the changes made. This way, everyone can learn from each other, share their work, and create amazing things together!

So, a repository is like a big library for computer code, where people can store, organize, and share their work with others to create awesome projects.

run the following command:

```
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu bionic main" > /etc/apt/sources.list.d/ros-latest.list'
```
  1. Next, add the ROS public key to your system:

    sudo apt install curl
    curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
    
  2. Update your system's package index and install the ROS desktop-full package:

    sudo apt-get update
    sudo apt-get install ros-melodic-desktop-full
    
  3. Set up your environment variables to use ROS. Add the following lines to your .bashrc file:

Never heard about the mighty .bashrc file ?? No Worries !

Imagine every time you enter your room, you have a special list of things to do, like turning on the lights, opening the curtains, and setting the room temperature. This list helps you make your room comfortable and ready for any activities you want to do.

In your computer, there's a special file called .bashrc. This file is like that list of things you do in your room. Every time you open a terminal (which is like entering your room), the computer looks at the .bashrc file to know what to set up and prepare. The file contains instructions and settings that help your computer get ready for you to work on different tasks, like building robots with ROS.

By adding instructions to the .bashrc file, you're telling your computer to always remember certain settings, like where to find your robot pieces (packages) in your catkin workspace. This way, you don't have to remind your computer every time you open the terminal, and it's always ready to help you work on your robot projects.

```
echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc
```
  1. Initialize rosdep, a tool for installing system dependencies required by ROS packages:

dependencies?? what are dependencies?

Imagine you're building a really cool treehouse with your friends. To build the treehouse, you need different things like wood, nails, and a ladder. These items are important because, without them, you can't build your treehouse. In this situation, the wood, nails, and ladder are called "dependencies" because they are necessary for you to complete your project.

In the world of computers, when you're working on a project, like building a robot or creating a video game, you often need some tools or pieces of code that have already been created by others. These tools and pieces of code help you complete your project more easily and quickly. They're called "dependencies" because your project depends on them to work properly.

For example, if you're building a robot, you might need a piece of code that helps your robot move its arms. Instead of writing that code from scratch, you can use a dependency that has already been created by someone else.

So, dependencies are like the important tools and pieces of code that your project needs to work correctly. They help you save time and make your project run smoothly.

Let's run the following command:

To install this tool and other dependencies?? for building ROS packages, run:

```
sudo apt install python-rosdep python-rosinstall python-rosinstall-generator python-wstool build-essential
```

Initialize rosdep:

```
sudo rosdep init
rosdep update
source /opt/ros/melodic/setup.bash
```
  • Verify that ROS has been installed correctly by running the following command:

    roscore
    

    This should start the ROS master and display a message indicating that it is running.

Create a ROS Workspace

Now we need to Create a ROS Workspace for MorBot , so we can start developing and running ROS applications on our system.

What is ROS Workspace you ask? good question !

Imagine you have a big box of LEGO bricks, and you want to build something amazing. To keep everything organized, you would create separate sections in your box for different types of LEGO bricks. When you start building, you can easily find the pieces you need because they are all in the right place.

A catkin workspace is similar to that big box of LEGO bricks. It's a special place where you keep all the pieces (called packages) you need to build and run robots using ROS (Robot Operating System). Each package in the workspace is like a LEGO brick that does a specific job, and you can combine these packages to create a complete robot.

The catkin workspace has three main sections:

  1. src: This is where you store all your packages (LEGO bricks). You can add new packages or modify existing ones here.

  2. build: This is where the magic happens! When you want to build your robot, the catkin workspace will take the packages from the src folder and create a version that your computer can understand.

  3. devel: This is where the built packages go. After building your robot, you can use the packages in this folder to run your robot or simulate it on your computer. So, a catkin workspace is like a big, organized box that helps you build and run robots using ROS, just like you can create cool things with LEGO bricks when they are neatly organized in a box.

Let's get started !

Create a ROS Melodic Workspace

In this guide, we will create a ROS (Robot Operating System) Melodic workspace. This is an essential step for developing ROS packages and running simulations. Follow the step-by-step instructions below to get started.

Step 1: Create a Workspace Directory

First, we will create a new directory to store our ROS packages. This directory is called a "workspace" in ROS terminology. Open a terminal and run the following commands:

mkdir -p ~/MorBot/morbot_ros/morbot_ws/src
cd ~/MorBot/morbot_ros/morbot_ws
catkin_make

This will create a new directory called morbot_ws in your morbot_ros directory. The catkin_make command will build the workspace and create a devel and build directory inside the workspace.

Step 2: Source the Workspace

OK, but What is "Source the Workspace"??

Imagine you have a magic toolbox that helps you build robots. Before you start using the tools, you need to tell them where to find all the robot pieces (packages) you've prepared. By doing this, the tools know exactly where to look when you need a specific robot piece.

In ROS, "sourcing the workspace" is like telling the magic toolbox where to find your robot pieces. When you source the workspace, you're giving your computer instructions on where to find the packages you've created or collected in your catkin workspace. This way, when you work on your robot project, the computer knows exactly where to look for the pieces it needs to build or run your robot.

So, when you "source the workspace" in ROS, you're making sure that the computer knows where to find everything it needs to help you build and run your robots.

we will add the workspace to the ROS environment. This will allow us to run ROS commands from any directory. To do this, we will add the following line to our .bashrc file :

echo "source ~/MorBot/morbot_ros/morbot_ws/devel/setup.bash" >> ~/.bashrc
source ~/.bashrc

Step 3: Verify Your Workspace

To verify that your workspace has been created correctly, run the following command:

echo $ROS_PACKAGE_PATH

You should see the following output:

/home/your_username/MorBot/morbot_ros/morbot_ws/src:/opt/ros/melodic/share

Congratulations, you have successfully installed ROS Melodic on Ubuntu 18.04! You can now start developing and running ROS applications that will take you to the moon and back.

For geeks ONLY ,more information and tutorials on using ROS, check out the ROS Wiki and ROS Tutorials.

Next step - MorBot ROS Workshop and educational content

To better understand Ros concepts and build MorBot properly , we suggest following this workflow :

ROS 101 --> Creating New Packages in ROS --> ROS PubSubPy --> Ros turtlesim --> Ros Workshop . 
⚠️ **GitHub.com Fallback** ⚠️