Get Started with ROS for Embedded Robotics
Tags: ros, ai, robotics, tinyml
Published: 2022-02-12 18:52:50

## Introduction

Robotic systems are built to have both software and hardware parts. While the hardware is easier to build, the software — which is responsible for adding intelligence to the robot — is not as easy.

To make the development process less cumbersome and more efficient, an ex-Google researcher built the ROS framework. This article provides fundamental knowledge required to learn about ROS and Robotics, and to apply ROS in projects.

# On Robotics

## What are Robots?

A robot is a machine built to execute one or more tasks automatically with speed and precision. IEEE defined a robot as “An autonomous machine capable of sensing its environment, carrying out computations to make decisions, and performing actions in the real world.

## Anatomy of a Robot

### Sensors

Robots have sensors for the eyes and for gathering information. There are different types of sensors for other tasks. For example, the ultrasonic sensor is used for obstacle detection and avoidance, while the PIR motion sensor is used for motion detection. LiDAR stands for Light Detection and Ranging and uses laser pulses. LiDAR is used for obstacle detection and avoidance and object recognition due to its scanning and 3D mapping functionality. 

Robots use cameras and AI algorithms to identify and recognize objects. An example of an AI algorithm used by robots is the YOLOv5.

### Actuators

Robots use actuators to carry out mechanical action (motion) based on the feedback data gotten through sensors.

### Mobility

Mobility is achieved in a technically complex way. It involves the use of Navigation processes (like the ROS Navigation Stack), Sensors (like IMU, Encoders, and LiDAR), software algorithms like (Obstacle Detection and Avoidance algorithms), motors and wheels of different kinds, 3D Cameras, and Mechanical Arms for Spatial Manipulation.

As mentioned, wheels provide translational motion for robots. They come in different forms and sizes for different terrestrial settings and tasks.

Motors are responsible for spinning the wheels. An engine is a device that converts electrical energy into mechanical energy. 

Encoders allow you to measure the speed of a motor dynamically. 

Microcontrollers are the brains of the robot. All the codes and machine learning workflows required to automate the robot — to tell it what to do — lives embedded inside these microcontrollers. Examples include the Arduino and Raspberry Pi microcontrollers. 

### Communication

Communication is achieved with 4G or 5G WiFi Modules. 

# The ROS Framework

For Route Planning and Navigation, robots can make use of the ROS. ROS provides the Software Development Kit needed to configure the robots to navigate their motion. Being software, ROS requires hardware to run. The hardware is in the form of a computer. Examples of computers that are suitable to run ROS include:

- NVIDIA’s Jetson Nano
- Raspberry Pi computers
- Laptops and PCs

### ROS Tools and Syntax

Tools used include the following:

- RVIZ
- Gazebo
- RTQ

RVIZ is a visualization tool provided by ROS. It is a GUI interface that lets you visualize big data from sensors and ROS Topics. It also allows the roboticist to create a real-time map of a given space.

Gazebo is a virtual prototyping tool that roboticists can use to simulate their robotics project without having to spend on acquiring or using hardware. This makes robotics development even more cost-friendly as it nullifies the need for Rapid Prototyping. It helps minimize errors, and maximize accuracy and efficiency in robotics development.

The RQT Tool is used to visualize the communication between Nodes in a ROS program. With this tool, you can plot messages for communication, monitor data created by a Node on other Nodes. 

ROS programs are broken down into:

- Nodes and child nodes
- Topics
- ROS Master

ROS nodes are written in C++ and Python; hence a roboticist must know both languages.

## Getting Started with ROS

The best resources for getting started in ROS installation and setup are available on the [official ROS website](https://www.ros.org/blog/getting-started/). Every new ROS version is given a new name: at the time of this writing, Foxy Fitzroy is the name for the latest version.

Follow the guide in the link above to install ROS for your specific operating system.

## Navigation Stack in ROS

ROS navigation makes it easier for robots to carry out translational motion without issues. Sensors publish information using Nodes and Topics. Nodes interchange information with each other using Topics. ROS provides Nodes that manage the movement of robots using the navigation stack. This is achieved in three steps:

1. Perception - collecting data/information using sensors as mentioned above
2. Decision Making - the making of decisions using information gotten from the perception stage, based on algorithms
3. Actuation - carrying out motors’ decisions to move at specific speed and direction.

The Navigation Stack has a more profound and more complex process than is explained here, like Mapping, Sensor Transforms, and Odometry.

### Who uses ROS and why?

ROS is a set of software libraries that provide tools to build robot applications. It covers the need for drivers, algorithms, dev tools, and visualization/data monitoring tools.

Companies that use the ROS framework include — but are not limited to — NVIDIA, PAL Robotics, INTEL, AWS, ROBOTIS, FETCH Robotics, DJI, CLEAR-PATH.

### Where to learn about ROS and Robotics

**1. Online Robotics Programs in Northwestern University**

The Modern Robotics Program is online and free and is taught by Professor Kevin Lynch. The specialization includes topics in the following categories:

- Foundation of Robot Motion
- Robot Kinematics
- Robot Dynamics
- Robot Motion Planning
- Robot Manipulation and Wheeled Mobile Robots
- Capstone Project

**2. Online Robotics in University of Pennsylvania**

The courses are taught by 6 lecturers, including Vijay Kumar and Daniel Koditschek. The topics in the specialization include:

- Aerial Robotics
- Computational Motion Planning
- Mobility
- Perception
- Estimation and Learning
- Capstone

**3. Wiki ROS**

The [ROS wiki page](http://wiki.ros.org) has in-depth and helpful tutorials on ROS. It is the most important website for ROS learning because it has tutorials, examples, and projects.

Others include MIT Open Courseware on Robotics, MIT’s Introduction to Deep Learning, Robot Programming in the Queensland University of Technology by Peter Corke, and Udacity’s Basics of ROS Applied in Self-Driving Cars.

## Conclusion

Now that you have understood what robots are and how the ROS software development kit is useful for developing robotics software applications, you should go on with developing your knowledge of Robotic systems if you haven’t already while learning and applying the ROS framework.

You can find and build open-source projects on linorobots.org, Arduino.cc, or automaticaddison.com.

Cheers.