Build your first robots with Python and some cheap, basic components. This entertaining book guides you step by step!
In Build Your Own Robot you’ll learn how to:
Use cameras to capture photos and let your robot see
Track faces using computer vision and OpenCV
Control DC motors to drive your robot around
Create a web-based app to control your robot over a network
Write code for joysticks
Read QR codes with your robot to find and identify objects
Build Your Own Robot introduces you to the exciting world of robotics. Your robot isn’t just theory. Beginning in chapter 2 you’ll write code to make your robot move and respond to touch sensors. The book gives accessible advice on available hardware and free open source software that makes creating a robot fun and affordable. You’ll soon be playing with a machine that can take photos, fetch items, search for a QR code, and more!
about the technology
There’s nothing quite like watching your code come alive in the real world. Robotics is a fun, fascinating discipline that lets you do just that. In this guide, you’ll build some fun robotic toys that will teach you serious robotics engineering skills like computer vision, networking, and computation.
about the book
Build Your Own Robot is a DIY guide for bringing your first Python-based robots to life. Start with the basics, teaching your new friend how to spin, move around, and find its way. You’ll then quickly progress to controlling your robot remotely using your phone, computer, or joystick. You’ll even set up a camera to broadcast what it sees right to your computer screen. Clever computer vision tricks will get your bot tracking faces, looking for QR codes, and maybe even fetching some snacks.
about the reader
For Python programmers. No previous experience in robotics required.
Author(s): Marwan Alsabbagh
Publisher: Manning Publications
Year: 2023
Language: English
Pages: 147
Build Your Own Robot MEAP V02
Copyright
Welcome
Brief contents
Chapter 1: Building robots with Python
1.1 Why robots are amazing
1.1.1 Robots move
1.1.2 Robots can see
1.1.3 Robots can find
1.1.4 Robots we command
1.1.5 Robots from any distance
1.2 What you can do with Robots
1.2.1 Prototyping
1.2.2 Teaching
1.2.3 Production ready
1.2.4 Limitations
1.3 Our approach to making robots
1.3.1 Learning from failures
1.3.2 Who is this book for?
1.3.3 What will you gain?
1.4 The robot building blocks
1.5 What are robots made of?
1.5.1 Servos and DC motors on a Raspberry Pi
1.5.2 Hardware Stack
1.5.3 Python and Linux
1.5.4 Software Stack
1.6 Summary
Chapter 2: Getting started
2.1 Introducing our Robotic Hardware
2.1.1 Raspberry Pi
2.1.2 Adafruit Crickit HAT
2.2 Configuring the software for our robots
2.3 Changing NeoPixel colors
2.4 Checking touch sensor state
2.5 Controlling DC motors
2.6 Controlling motors with the touch sensor
2.7 Summary
Chapter 3: Driving the robot
3.1 What’s a Robot Chassis Kit
3.2 Hardware Stack
3.3 Software Stack
3.4 Writing a move forward function
3.5 Using environment variables for configuration
3.6 Controlling the speed and duration of movements
3.7 Moving backward
3.8 Turning right
3.9 Moving left and spinning in either direction
3.10 Refactoring by finding common logic
3.11 Refactoring by using functools
3.12 Summary
Chapter 4: Creating a robot shell
4.1 What’s a REPL or shell
4.2 Hardware Stack
4.3 Software Stack
4.4 Creating the robot shell
4.5 Handling command arguments
4.6 Adding a speed argument
4.7 Running robot shell scripts
4.8 Summary
Chapter 5: Controlling robots remotely
5.1 Hardware Stack
5.2 Software Stack
5.3 Controlling robots over SSH
5.3.1 Creating the server side script
5.3.2 Running the script remotely
5.3.3 Creating the client side script
5.4 Creating web services for robots
5.4.1 Creating our first web service
5.4.2 Creating web services to perform robot movements
5.5 Calling web services from Python
5.5.1 Using the REPL to call web services
5.5.2 Creating a basic web service client
5.5.3 Creating a web service client with persistent connections
5.5.4 Measuring client performance
5.6 Summary
Chapter 6: Creating robot web apps
6.1 Hardware Stack
6.2 Software Stack
6.3 Moving robots forward and backward over the web
6.3.1 Creating a basic web application
6.3.2 Detecting failed requests
6.3.3 Moving robots forward with web apps
6.4 Creating a full movement web app
6.4.1 Creating the full movement application
6.4.2 Web Interface Design
6.4.3 Measuring application performance in the browser
6.5 Summary
Chapter 7: Joystick controlled robots
7.1 Hardware Stack
7.2 Software Stack
7.3 Joystick Events
7.4 Reading joystick events using Pygame
7.4.1 Detecting events in Pygame
7.4.2 Detecting joystick events
7.5 Reading Linux joystick events
7.5.1 Exploring the Linux input subsystem
7.5.2 Unpacking joystick events
7.5.3 Mapping joystick events
7.5.4 Working with axis events
7.6 Measuring the rate of joystick events
7.6.1 Calculating the event rate
7.6.2 Calculating the level rate
7.7 Moving robots with joysticks
7.7.1 Creating the joystick client
7.8 Summary
Appendix A: Hardware purchasing guide
A.1 Raspberry Pi components
A.2 Motors and chassis kits and joystick controllers
A.3 Power and cabling
A.4 Optional Purchases
Appendix B: Configuring the Raspberry Pi
B.1 Setting up the Raspberry Pi
B.2 Setting up the Adafruit Crickit HAT
B.3 Activating the Python virtual environment
Appendix C: Robot assembly guide
C.1 Building a mobile robot
C.2 Building a servo camera robot
C.3 Building a pusher robot
C.4 Creating a track for the pusher robot