Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Mastering ROS for Robotics Programming

You're reading from  Mastering ROS for Robotics Programming

Product type Book
Published in Dec 2015
Publisher Packt
ISBN-13 9781783551798
Pages 480 pages
Edition 1st Edition
Languages
Concepts
Author (1):
Lentin Joseph Lentin Joseph
Profile icon Lentin Joseph

Table of Contents (19) Chapters

Mastering ROS for Robotics Programming
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Introduction to ROS and Its Package Management Working with 3D Robot Modeling in ROS Simulating Robots Using ROS and Gazebo Using the ROS MoveIt! and Navigation Stack Working with Pluginlib, Nodelets, and Gazebo Plugins Writing ROS Controllers and Visualization Plugins Interfacing I/O Boards, Sensors, and Actuators to ROS Programming Vision Sensors using ROS, Open-CV, and PCL Building and Interfacing Differential Drive Mobile Robot Hardware in ROS Exploring the Advanced Capabilities of ROS-MoveIt! ROS for Industrial Robots Troubleshooting and Best Practices in ROS Index

Chapter 7. Interfacing I/O Boards, Sensors, and Actuators to ROS

In the last two chapters, we discussed different kinds of plugin frameworks that are used in ROS. In this chapter, we are going to discuss interfacing of some hardware components, such as sensors and actuators to ROS. We will see interfacing of sensors using I/O boards such as Arduino, Raspberry Pi, and Odroid-C1 to ROS, and also discuss interfacing of smart actuators such as Dynamixel to ROS. Following is the detailed list of topics we are going to cover in this chapter:

  • Understanding the Arduino-ROS interface

  • Setting up the Arduino-ROS interface packages

  • Arduino-ROS ,example—Chatter and Talker

  • Arduino-ROS , example—blink LED and push button

  • Arduino-ROS , example—Accelerometer ADXL 335

  • Arduino-ROS, example—ultrasonic distance sensor

  • Arduino-ROS, example—Odometry Publisher

  • Interfacing a non-Arduino board to ROS

  • Setting ROS on Odroid-C1 and Raspberry Pi 2

  • Working with Raspberry Pi and Odroid GPIOs using ROS

  • Interfacing Dynamixel actuators...

Understanding the Arduino–ROS interface


Let's see what an Arduino is first. Arduino is one of the most popular open source I/O boards in the market. The easiness in programmability and the cost effectiveness of the hardware have made Arduino a big success. Most of the Arduino boards are powered by Atmel microcontrollers, which are available from 8-bit to 32-bit and clock speed from 8 MHz to 84 MHz. Arduino can be used for quick prototyping of robots and we can even use it for products as well. The main applications of Arduino in robotics are interfacing sensors and actuators, and communicating with PC for receiving high level commands and sending sensor values to PC using the UART protocol.

There are different varieties of Arduino available in the market. Selecting one board for our purpose will be dependent on the nature of our robotic application. Let's see some boards which we can use for beginners, intermediate, and high end users.

Figure 1 : Different versions of Arduino board

We will...

What is the Arduino–ROS interface?


Most of the communication between PC and I/O boards in robots will be through UART protocol. When both the devices communicate with each other, there should be some program in both the sides which can translate the serial commands from each of these devices. We can implement our own logic to receive and transmit the data from board to PC and vice versa. The interfacing code can be different in each I/O board because there are no standard libraries to do this communication.

The Arduino-ROS interface is a standard way of communication between the Arduino boards and PC. Currently, this interface is exclusive for Arduino. We may need to write custom nodes to interface other I/O boards.

We can use the similar C++ APIs of ROS used in PC in Arduino IDE also, for programming the Arduino board. Detailed information about the interfacing package follows.

Understanding the rosserial package in ROS

The rosserial package is a set of standardized communication protocols...

Interfacing Dynamixel actuators to ROS


One of the latest smart actuators available on the market is Dynamixel, which is manufactured by a company called Robotis. The Dynamixel servos are available in various versions and shown in the following image are some of the different versions of Dynamixel servos:

Figure 27 : Different types of Dynamixel servos

These smart actuators have complete support in ROS and clear documentation is also available for them.

The official ROS wiki page of Dynamixel is http://wiki.ros.org/dynamixel_controllers/Tutorials.

Questions


  1. What are the different rosserial packages?

  2. What is the main function of rosserial_arduino?

  3. How does rosserial protocol work?

  4. What are the main differences between Odroid-C1 and Raspberry Pi?

Summary


This chapter was about interfacing I/O boards to ROS and adding sensors on it. We have discussed interfacing of the popular I/O board called Arduino to ROS, and interface basic components such as LEDs, buttons, accelerometers, ultrasonic sound sensors, and so on. After seeing the interfacing of Arduino, we discussed how to setup ROS on Raspberry Pi 2 and Odroid-C1. We also did few basic examples in Odroid and Raspberry Pi based on ROS and Wiring Pi. In the end, we saw the interfacing of smart actuators called Dynamixel in ROS.

lock icon The rest of the chapter is locked
You have been reading a chapter from
Mastering ROS for Robotics Programming
Published in: Dec 2015 Publisher: Packt ISBN-13: 9781783551798
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}