ebook img

Learning Robotics using Python: Design, simulate, program, and prototype an autonomous mobile robot using ROS, OpenCV, PCL, and Python PDF

273 Pages·2018·18.75 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Learning Robotics using Python: Design, simulate, program, and prototype an autonomous mobile robot using ROS, OpenCV, PCL, and Python

Learning Robotics using Python Second Edition Design, simulate, program, and prototype an autonomous mobile robot using ROS, OpenCV, PCL, and Python Lentin Joseph BIRMINGHAM - MUMBAI Learning Robotics using Python Second Edition Copyright © 2018 Packt Publishing All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book. Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information. Commissioning Editor: Gebin George Acquisition Editor: Namrata Patil Content Development Editor: Sharon Raj Technical Editor: Mohit Hassija Copy Editor: Safis Editing Project Coordinator: Virginia Dias Proofreader: Safis Editing Indexer: Pratik Shirodkar Graphics: Tom Scaria Production Coordinator: Shantanu Zagade First published: May 2015 Second edition: June 2018 Production reference: 1250618 Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK. ISBN 978-1-78862-331-5 www.packtpub.com To my mother, Jancy Joseph, and my father, C.G Joseph, for giving me strong support in making this project happen. mapt.io Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website. Why subscribe? Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals Improve your learning with Skill Plans built especially for you Get a free eBook or video every month Mapt is fully searchable Copy and paste, print, and bookmark content PacktPub.com Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details. At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks. Contributors About the author Lentin Joseph is an author and robotics entrepreneur from India. He runs a robotics software company called Qbotics Labs in India. He has 7 years of experience in the robotics domain primarily in ROS, OpenCV, and PCL. He has authored four books in ROS, namely, Learning Robotics using Python, Mastering ROS for Robotics Programming, ROS Robotics Projects, and Robot Operating System for Absolute Beginners. He is currently pursuing his master's in Robotics from India and is also doing research at Robotics Institute, CMU, USA. About the reviewer Ruixiang Du is a PhD candidate in mechanical engineering at Worcester Polytechnic Institute. He works in the Autonomy, Control, and Estimation Laboratory with a research focus on the motion planning and control of autonomous mobile robots in cluttered and dynamic environments. He received a bachelor’s degree in automation from North China Electric Power University in 2011 and a master’s degree in robotics engineering from WPI in 2013. He has worked on various robotic projects with robot platforms ranging from medical robots, and unmanned aerial/ground vehicles, to humanoid robots. Packt is searching for authors like you If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea. Table of Contents Preface 1 Chapter 1: Getting Started with Robot Operating System 6 Technical requirements 6 Introduction to ROS 7 ROS concepts 9 The ROS filesystem 9 The ROS Computation Graph 9 The ROS community level 12 Installing ROS on Ubuntu 13 Introducing catkin 16 Creating a ROS package 16 Hello_world_publisher.py 17 Hello_world_subscriber.py 20 Introducing Gazebo 22 Installing Gazebo 23 Testing Gazebo with the ROS interface 23 Summary 25 Questions 25 Chapter 2: Understanding the Basics of Differential Robots 26 Mathematical modeling of the robot 26 Introduction to the differential drive system and robot kinematics 27 Forward kinematics of a differential robot 29 Explanations of the forward kinematics equation 29 Inverse kinematics 34 Summary 35 Questions 36 Further information 36 Chapter 3: Modeling the Differential Drive Robot 37 Technical requirements 38 Requirements of a service robot 38 Robot drive mechanism 38 Selection of motors and wheels 39 Calculation of RPM of motors 39 Calculation of motor torque 40 The design summary 41 The robot chassis design 41 Installing LibreCAD, Blender, and MeshLab 42 Table of Contents Installing LibreCAD 43 Installing Blender 43 Installing MeshLab 44 Creating 2D CAD drawing of a robot using LibreCAD 44 The base plate designs 47 Base plate pole design 48 Wheel, motor, and motor clamp design 49 Caster wheel design 51 Middle plate design 52 Top plate design 53 Working with a 3D model of the robot using Blender 54 Python scripting in Blender 55 Introduction to Blender Python APIs 55 Python script of the robot model 57 Creating a URDF model of the robot 62 Creating a Chefbot description ROS package 64 Summary 69 Questions 70 Further reading 70 Chapter 4: Simulating a Differential Drive Robot Using ROS 71 Technical requirements 71 Getting started with the Gazebo simulator 72 The Gazebo's graphical user interface 73 The Scene 74 The Left Panel 74 Right Panel 75 Gazebo toolbars 75 Upper toolbar 75 Bottom toolbar 76 Working with a TurtleBot 2 simulation 77 Moving the robot 81 Creating a simulation of Chefbot 82 Depth image to laser scan conversion 84 URDF tags and plugins for Gazebo simulation 85 Cliff sensor plugin 87 Contact sensor plugin 88 Gyroscope plugin 88 Differential drive plugin 89 Depth camera plugin 90 Visualizing the robot sensor data 91 Getting started with Simultaneous Localization and Mapping 94 Implementing SLAM in the Gazebo environment 94 Creating a map using SLAM 95 Getting started with Adaptive Monte Carlo Localization 98 Implementing AMCL in the Gazebo environment 99 [ ii ] Table of Contents Autonomous navigation of Chefbot in the hotel using Gazebo 102 Summary 103 Questions 103 Further reading 103 Chapter 5: Designing ChefBot Hardware and Circuits 104 Technical requirements 105 Specifications of the ChefBot's hardware 105 Block diagram of the robot 105 Motor and encoder 106 Selecting motors, encoders, and wheels for the robot 106 Motor driver 108 Selecting a motor driver/controller 109 Input pins 110 Output pins 110 Power supply pins 110 Embedded controller board 111 Ultrasonic sensors 113 Selecting an ultrasonic sensor 113 Inertial measurement unit 114 Kinect/Orbbec Astra 115 Central processing unit 116 Speakers/mic 117 Power supply/battery 117 How ChefBot’s hardware works’? 119 Summary 121 Questions 121 Further reading 121 Chapter 6: Interfacing Actuators and Sensors to the Robot Controller 122 Technical requirements 123 Interfacing DC geared motor to Tiva C LaunchPad 123 Differential wheeled robot 126 Installing Energia IDE 127 Motor interfacing code 133 Interfacing quadrature encoder with Tiva C Launchpad 136 Processing encoder data 137 Quadrature encoder interfacing code 141 Working with Dynamixel actuators 144 Working with ultrasonic distance sensors 147 Interfacing HC-SR04 to Tiva C LaunchPad 148 Working of HC-SR04 149 Interfacing Code of Tiva C Launchpad 150 Interfacing Tiva C LaunchPad with Python 152 Working with the IR proximity sensor 154 Working with Inertial Measurement Units 157 [ iii ]

See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.