Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
Hands-On ROS for Robotics Programming

You're reading from   Hands-On ROS for Robotics Programming Program highly autonomous and AI-capable mobile robots powered by ROS

Arrow left icon
Product type Paperback
Published in Feb 2020
Publisher Packt
ISBN-13 9781838551308
Length 432 pages
Edition 1st Edition
Tools
Concepts
Arrow right icon
Author (1):
Arrow left icon
Bernardo Ronquillo Japón Bernardo Ronquillo Japón
Author Profile Icon Bernardo Ronquillo Japón
Bernardo Ronquillo Japón
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Section 1: Physical Robot Assembly and Testing
2. Assembling the Robot FREE CHAPTER 3. Unit Testing of GoPiGo3 4. Getting Started with ROS 5. Section 2: Robot Simulation with Gazebo
6. Creating the Virtual Two-Wheeled ROS Robot 7. Simulating Robot Behavior with Gazebo 8. Section 3: Autonomous Navigation Using SLAM
9. Programming in ROS - Commands and Tools 10. Robot Control and Simulation 11. Virtual SLAM and Navigation Using Gazebo 12. SLAM for Robot Navigation 13. Section 4: Adaptive Robot Behavior Using Machine Learning
14. Applying Machine Learning in Robotics 15. Machine Learning with OpenAI Gym 16. Achieve a Goal through Reinforcement Learning 17. Assessment 18. Other Books You May Enjoy

Understanding the GoPiGo3 robot

GoPiGo3 is a Raspberry Pi-based robot car manufactured by Dexter Industries. It is intended to be used as an educational kit for learning about both robotics and programming, two complementary perspectives that clearly show the transversal knowledge you should acquire to become a robotics engineer. We'll explain what this means by letting Nicole Parrot, Director of Engineering at Modular Robotics, explain it in her own words:

"The GoPiGo originated from a Kickstarter campaign in early 2014 when the Raspberry Pi was still somewhat new. The first users were hobbyists, but soon teachers and coding club volunteers were sharing their GoPiGo with their students. This lead to various changes being made to the board to make a classroom-ready robot. It's robust, it has a full list of features, and it's still based on the Raspberry Pi! The latest iteration has been around since 2017 and is a stable platform.

A Raspberry Pi-based robot offers quite a few advantages in the classroom. It can be programmed in an array of languages, it can be independent of the school Wi-Fi while not requiring Bluetooth, and it can perform advanced applications right on the board, such as computer vision and data collection. The GoPiGo with DexterOS comes with scientific libraries all preinstalled. The GoPiGo with Raspbian for Robots allows the user to install whatever libraries and tools are required for the project at hand. It comes with two Python libraries: easygopigo3.py and gopigo3.py. Both of these offer high-level control of the robot and low-level control, depending on the user's technical skills.

The GoPiGo has become the premier go-to robot for universities, researchers, and engineers seeking a simple, well-documented robot for the Raspberry Pi."

Ready to dive into robotics? Let's go!

The robotics perspective

From the robotics perspective, you will learn how to work with the basic parts:

  • Motors, which allow the robot to move from one point to another. In GoPiGo3, we have DC motors with built-in encoders that provide a precise motion. This is one of the main upgrades from GoPiGo2, where the encoders were external to the motors and not very accurate.
  • Sensors, which acquire information from the environment, such as the distance to near objects, luminosity, acceleration, and so on.
  • The controller—that is, the GoPiGo3 red board—handles the physical interface with sensors and actuators. This is the real-time component that allows GoPiGo3 to interact with the physical world.
  • A single-board computer (SBC) Raspberry Pi 3B+, which provides processing capacity. As such, it works under an operating system, typically a Linux-based distribution, providing wide flexibility from a software point of view.

Most educational kits stop at a level-3 controller; they do not include a level-4 single-board computer. The software in the controller is a small program (only one) that is embedded in the board. Every time you want to modify the code for the robot, you have to fully replace the existing program and flash the new version from an external computer while using the serial connection over a USB port.

A classic example of this is an Arduino-controlled robot. Here, the Arduino board plays the role of our GoPiGo3 board, and if you have worked with it, you will surely remember how you needed to transfer the new program from the Arduino IDE on your laptop to the robot through a USB cable.

The programming perspective

From the programming perspective, GoPiGo3 allows you to start easy by learning a visual programming language, Bloxter, a fork of the open source Google Blockly, that was specifically developed for GoPiGo3. This is a very comfortable prerequisite when it comes to learning about the basic concepts of writing software programs.

But if you are reading this book, we are sure you already know how to program in one of the many available languages, that is, C, C++, Java, JavaScript, or Python. Dexter Industries provides various open source libraries (https://github.com/DexterInd/GoPiGo3/tree/master/Software) that you can use to program GoPiGo3. Some of them are as follows:

  • C
  • C#
  • Go
  • Java
  • Node.js (JavaScript)
  • Python
  • Scratch

In any case, in this first chapter, we encourage you to only use Bloxter to emphasize the robotics perspective and become familiar with the hardware you have in your hands. After that, you may use your choice of language, given the many GoPiGo3 application programming interfaces (APIs) that are available.

In this book, we will focus on Python as the primary language to program in ROS. The Python language is easier to learn while still being very powerful and predominant in robotics and computer science. After going through some Python examples in Chapter 2, Unit Testing GoPiGo3, we will get started with the Robot Operating System (ROS), which isn't an actual programming language but a development application framework for robots. As such, we will show you how to adapt your Python programs with wrappers so that they can also run within ROS as pieces for building high-level functionalities.

You will appreciate the added value of such a jump to ROS when you discover how many more things GoPiGo3 can do when its Python base of code is wrapped with ROS. This software upgrade provides GoPiGo3 with a toolkit that allows students, creators, and engineers to understand how robots work. Furthermore, you should be aware that the ROS is commonly used in professional environments.

Robot kit and resources

At a high level, we can group the hardware of the robot into two sets:

  • Electromechanics: This refers to the sensors and actuators that allow it to interact with the physical world.
  • Embedded hardware: The electronic boards that allows it to acquire a signal from the sensors, convert it into a digital signal, and provide the processing logic and send commands to the actuators. Here, we typically have two types of electronic boards:
    • The controller, which serves as the physical interface with the sensors and actuators—that is, the GoPiGo3 board. The controller deals with both analog and digital signals from the electromechanical devices, transforming them into digital signals that can be processed by a CPU.
    • The computer, which provides us with the means to implement intelligent logic. In most robots, this is an SBC. In the case of GoPiGo3, this is the Raspberry Pi running a Linux OS distribution, such as Raspbian or Ubuntu.

Although you could directly connect digital devices to the Raspberry Pi through its general purpose input/output (GPIO) pins, from a functional point of view, it is better to interface all the sensors and actuators through the controller—that is, the GoPiGo3 board: keep the interface with the physical world at the controller level and do the processing and computation at the computer level.

If you are a regular Raspberry Pi user and own the board, you only need to purchase the GoPiGo3 Robot Base Kit (https://www.dexterindustries.com/product/gopigo3-robot-base-kit/). This kit includes the following:

  • GoPiGo3 board (red board)
  • Chassis (frame, wheels, hardware)
  • Motors
  • Encoders
  • Power battery pack and cable
  • Screwdriver for assembly

The following image shows all the parts that are included:

Image courtesy: Dexter Industries: https://shop.dexterindustries.com/media/catalog/product/cache/4/thumbnail/1800x2400/9df78eab33525d08d6e5fb8d27136e95/g/p/gpg3_components_rgb.jpg

The following image shows the assembled kit (without the Raspberry Pi):

Image courtesy: Dexter Industries: https://32414320wji53mwwch1u68ce-wpengine.netdna-ssl.com/wp-content/uploads/2017/05/GPG3_BaseKit_2.jpg

The batteries (8 AA 1.2 V) are not included. Although you can use cheaper replaceable units, it is strongly advised that you use rechargeable batteries. In the long term, it will be cost-effective and environmentally friendly.

Apart from the kit, you will need to add a Raspberry Pi 3 and its Micro SD card; otherwise, especially if you are new to the Raspberry Pi world, you would be better off buying the GoPiGo3 Beginner Starter Kit (https://www.dexterindustries.com/product/gopigo-beginner-starter-kit/), which includes the Raspberry Pi 3 and its accessories, as well as an orientable distance sensor equipped with a servo-motor, allowing it to cover a 180° field of view. This sensor set is composed of the following:

The following image shows the final aspect of the Beginner Starter Kit, once it's been assembled. The same result can be obtained with the Robot Base Kit by adding the Raspberry Pi and the orientable distance sensor:

Image courtesy: Dexter Industries: https://www.robotshop.com/media/catalog/product/cache/image/380x380/9df78eab33525d08d6e5fb8d27136e95/g/o/gopigo3-beginner-starter-kit.jpg

Now that we've looked at the GoPiGo3 robot, it's time to cover the technical details regarding the embedded hardware and the electromechanics.

You have been reading a chapter from
Hands-On ROS for Robotics Programming
Published in: Feb 2020
Publisher: Packt
ISBN-13: 9781838551308
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 €18.99/month. Cancel anytime