Book Image

Python Robotics Projects

By : Prof. Diwakar Vaish
Book Image

Python Robotics Projects

By: Prof. Diwakar Vaish

Overview of this book

Robotics is a fast-growing industry. Multiple surveys state that investment in the field has increased tenfold in the last 6 years, and is set to become a $100-billion sector by 2020. Robots are prevalent throughout all industries, and they are all set to be a part of our domestic lives. This book starts with the installation and basic steps in configuring a robotic controller. You'll then move on to setting up your environment to use Python with the robotic controller. You'll dive deep into building simple robotic projects, such as a pet-feeding robot, and more complicated projects, such as machine learning enabled home automation system (Jarvis), vision processing based robots and a self-driven robotic vehicle using Python. By the end of this book, you'll know how to build smart robots using Python.
Table of Contents (24 chapters)
Title Page
Packt Upsell
Contributors
Preface
Index

Making the robot safe


In the previous part of the chapter, with our multiple attempts, we have been able to find the maximum positions for each of the servos. Now it's time to use these values. In this chapter, we will be programming the servos for what its absolute maximums are. In this program, we will make sure that servos will never need to travel even a degree beyond the defined parameters on both the sides. If the user gives a value beyond it, then it will simply choose to ignore the user inputs instead of causing self damage.

So, let's see how to get it done. There are some parts of this program, where the numeric values have been bold. These are the values that you need to replace with the values which we have noted in the previous section of this chapter. For example, for servo 1, the values noted down are 23 and 170 as the maximum values for either side. Hence, the change in the code will be from if a[0] < 160 and a[0] > 30 to ifa[0] < 170 and a[0] > 23. Similarly, for...