HOW TO ROBOT

Robot Operating System

Theory and Getting Started

What is ROS?

ROS is a framework for developing software for robotic systems. It allows for parallel execution of many different programs, called nodes, that communicate with each other by publishing and subscribing to topics. ROS also comes with simulation tools, such as Gazebo and RViz, which help simulate an actual robot and help visualize sensor data (respectively).

How does ROS work?

ROS uses a publisher-subscriber (pub-sub) system to enable communication between parallel programs called nodes. Nodes can publish and subscribe to multiple topics. Shown below is an example of how ROS would work on an SCR robot:

The first thing you'll notice in the above image is all of the nodes. Some nodes take in sensor data (either through a topic like the collision avoidance node, or through electrical connection like the sensor fusion node). Nodes can output messages to a topic, like with the path planning node sending the next goal position to the navigation node. Nodes can run on embedded systems, like the arduino node, and can output commands to actuators.

Oftentimes, a device with a real-time operating system is used to collect sensor data, and then sends it to a sensor fusion system on a more powerful board. We do this in SCR as well, so instead of the sensor fusion node connecting directly to the sensors, it can communicate with an Arduino that sends it sensor data over one topic. The format of this data is called a message. Here is an example of a message:

float64 gps_lat
float64 gps_lon
float64 vel
float64 accel_x
float64 heading
float64 steer_ang

Message data is read by a subscriber node every time a topic gets a new message from a publisher node, so nodes don't have to wait on each other as much. This way, we can execute path planning activities (which are time consuming) without blocking the execution of navigation or obstacle avoidance (which both need to be quick so we don't crash).

Why do we use ROS?

There are a few reasons we use ROS:

Parallel Execution

Since ROS nodes all execute in parallel, we can develop modular code for handling specific tasks. For example, we can figure out where the robot is (localization) in parallel with planning a path. This is really powerful because it would be sub-optimal to figure out where you are, and THEN plan a path. Your robot would have to stop, figure out its location, plan and then move. With ROS, we can do that essentially all at once.

Parallel Development

Since all of these ROS nodes are their own programs, we can give project ownership to more than one software developer. Instead of writing one big application for the entire system, the process can be broken out into different parts and programmers can work on things aligned with their strengths or interests easier. In the above diagram, we can easily have five programmers working on five completely different components of the project without interfering with each other. At the same time, the software architecture gets adequate attention, because everything is set up in a distributed manner.

Helpful Packages and Features

ROS has a lot of default packages that speed up development time considerably. For example, RViz is a useful tool that comes with ROS that allows you to visualize perception data (camera/depth camera, LiDAR, etc.) in real time, and do advanced things like SLAM, which would otherwise require significant effort to implement on your own.

Additionally, there is a ton of community support for ROS. A lot of sensors have ROS drivers, and there are open source packages provided by the community to help do different things. If you ever run into trouble with something, you should see if there is a ROS package that can do it for you. There often is a package for the problem you are trying to solve.

Industry Standard

ROS is growing in adoption, and is becoming a go-to tool in the tech industry when it comes to automation and robotics. At SCR, we want to give our members the most important skills that will help them in their future careers. If you want to work on robot software professionally, ROS is a key framework to understand and be able to work within. Even if you are more interested in other areas of software development, ROS has other benefits, such as understanding the importance of software architecture.

Who else uses ROS?

The following is a non-exhaustive list of companies that use ROS.

  • Amazon
  • Aurora
  • AutoX
  • Boston Dynamics
  • Clearpath Robotics
  • Cobalt Robotics
  • Cruise Automation
  • DoorDash
  • Exyn Technologies
  • FarmWise
  • Fetch Robotics
  • General Motors
  • Houston Mechatronics
  • Iris Automation
  • Kaarta
  • Locomation
  • Maidbot
  • Marble
  • Neato Robotics
  • NVIDIA
  • Open Robotics
  • Pick-it
  • RE2 Robotics
  • Samsung
  • Simbe Robotics
  • Torc Robotics
  • Udelv
  • Vecna Robotics

Many robotics research institutions also use ROS

Getting Started with ROS

To get started using ROS, it is best to install it(see below). Then, with the above concepts in mind, take a look at the following tutorials and resources to get started learning ROS:

List of ROS Tutorials and References
ROS Tutorials: ROS/Tutorials - ROS Wiki
Make sure to follow the catkin part of the build process, as that is the most recent build tool
Also, there are some good code examples for writing publishers, subscribers, services, and much more
CS 4023 - Intro to Intelligent Robotics: CS 4023/5023 - Intro to Intelligent Robotics - Spring 2019
If you want to learn ROS, the best way is by doing a project in it. Try to do Project 1 (located in Assignments) and if you can get that to work, then you'll be on your way to being a master of ROS
You'll need to use Homework 2 to help get the turtlebot stuff set up correctly
Reference the project1 branch of the Yeetbotics code if you run into difficulty
Yeetbotics D*Lite: GitHub - jkleiber/intro_robotics_ws: Intro to Intelligent...
This was a class project for CS 4023 - Intro to Intelligent Robotics. It is a ROS project and you can see how it is set up to get inspiration for your own things
If you take this class in the future, make sure to cite this code if you use it, or else you will get flagged for academic misconduct
ROS C++ Style Guide: CppStyleGuide - ROS Wiki

Official SCR ROS Getting Started Tutorial Assignment

Coming soon!

Installation

Installation Basics

As of 2019 in SCR, we use ROS Melodic (In the past we used ROS Kinetic). To install this, you'll need a Linux OS - a lot of our members have experience with Ubuntu, so the choice operating system for ROS Melodic will be Ubuntu 18.04

Details about how to install ROS Melodic are on the ROS website. Check out the Linux Dual Booting guide for help with Linux installations if you haven't dual booted your computer before.

Legacy Instructions

We used to use ROS Kinetic, but once ROS Melodic got enough traction to support all the ROS packages we like, we made the switch to the newer version. The below instructions are out of date, but still can be useful for personal projects or understanding how we use ROS

Installing ROS Kinetic on the Raspberry Pi

Raspbian Strech Image w/ ROS and OpenCV

Here is a link that will lead you to an image for installing ROS Kinetic on a raspberry pi. It also has a guide, which is linked further below.

Installation Instructions Link

This is the link to instructions on how to install the above image. Read below to understand how to do particular steps in the process

  • Use dd if="location-of-rosbots-info-file.img" of="/dev/xyz" to install the image to SD card. This might take a while and there probably won't be any output until it's done
  • Add a file named "ssh" to the boot partition after the above installation completes
  • Boot up like the instructions say
  • To connect to the pi, use an ethernet cable. On Ubuntu, click on the wifi icon and click Edit Connections.... Find the Wired Connection and edit it. Change the IPv4 setting from Automatic (DHCP) to Shared to other computers.
  • Next, we need to find the IP address. Do this by running the arp command on Ubuntu (install if needed).
  • Follow the link's instructions from step 6 onwards
  • Stop before you get to the "Setting up a new Raspberry Pi" step. Only read that if you want to make your own image or something

Helpful Packages and Cheatsheet

Package List

ROS has many helpful packages for our robots. When you find one that is cool, just list it below! Also, please post a link if the package is hard to find by its name

  • rosserial - package for serial communication across devices

Cheatsheet

ROS has a lot of terminal commands, some of which are **extremely useful **for debugging. A list of the most useful ones is below, along with a short description of what they do.

Regular ROS commands
  • roscore - starts a master session of ROS
  • roslaunch - starts a master session of ROS, while also launching a particular launch file (which acts as a script to launch the many nodes in a program)
Elite Debugging Commands
rqt_graph - shows a diagram of all the nodes and topics currently running, as well as how they are connected, if they are a dead sink, or if they are not even being used
rostopic - gets topic information from the ROS master
rostopic list - shows a list of all the topics currently running
rostopic show [topic] - shows the message a specific topic has
rosnode - gets node information from the ROS master
rosnode list - shows a list of all the nodes currently running
Join Our Mailing List