Book Image

Effective Robotics Programming with ROS - Third Edition

By : Anil Mahtani, Luis Sánchez, Aaron Martinez, Enrique Fernandez Perdomo
Book Image

Effective Robotics Programming with ROS - Third Edition

By: Anil Mahtani, Luis Sánchez, Aaron Martinez, Enrique Fernandez Perdomo

Overview of this book

Building and programming a robot can be cumbersome and time-consuming, but not when you have the right collection of tools, libraries, and more importantly expert collaboration. ROS enables collaborative software development and offers an unmatched simulated environment that simplifies the entire robot building process. This book is packed with hands-on examples that will help you program your robot and give you complete solutions using open source ROS libraries and tools. It also shows you how to use virtual machines and Docker containers to simplify the installation of Ubuntu and the ROS framework, so you can start working in an isolated and control environment without changing your regular computer setup. It starts with the installation and basic concepts, then continues with more complex modules available in ROS such as sensors and actuators integration (drivers), navigation and mapping (so you can create an autonomous mobile robot), manipulation, Computer Vision, perception in 3D with PCL, and more. By the end of the book, you’ll be able to leverage all the ROS Kinetic features to build a fully fledged robot for all your needs.
Table of Contents (18 chapters)
Effective Robotics Programming with ROS Third Edition
Credits
About the Authors
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface
Index

Using a joystick or a gamepad


I am sure that, at one point or another, you have used a joystick or a gamepad of a video console.

A joystick is nothing more than a series of buttons and potentiometers. With this device, you can perform or control a wide range of actions.

In ROS, a joystick is used to telecontrol a robot to change its velocity or direction.

Before we start, we are going to install some packages. To install these packages in Ubuntu, execute the following command:

$ sudo apt-get install ros-kinetic-joystick-drivers
$ rosstack profile & rospack profile

In these packages, you will find code to learn how to use the joystick and a guide to create our packages.

First of all, connect your joystick to your computer. Now, we are going to check whether the joystick is recognized using the following command:

$ ls /dev/input/

We will see the following output:

by-id event0 event2 event4 event6 event8 js0 mouse0
by-path event1 event3 event5 event7 event9 mice

The port created is js0; with...