A comprehensive guide to programming wheeled robots in Python — from motor control and kinematics through sensor fusion, path planning, and full autonomous navigation pipelines.
This book provides a ground-up treatment of wheeled robot programming using Python 3.10+. Rather than relying on a robotics middleware stack such as ROS, every algorithm is implemented from first principles so you understand exactly what is happening at each layer. The platform used throughout is a four-wheeled differential-drive robot equipped with an IR line-detector array, an HC-SR04 ultrasound sensor, and a camera mounted on a pan servo — a low-cost but representative hardware setup that generalises to more capable platforms.
The book is divided into five parts. Part I establishes the physical and mathematical foundations: robot taxonomy, motor control, kinematics, and PID feedback. Part II covers sensing: odometry, line following, ultrasound ranging, and camera-based perception. Part III develops navigation algorithms: reactive methods, grid-based planning, and sampling-based planning. Part IV addresses system-level topics: mapping, SLAM concepts, state machines, and sensor fusion. Part V closes with a capstone chapter that wires everything together into a complete autonomous navigation pipeline.
Part I — Foundations (Chapters 0–4) Covers the physical and mathematical groundwork: robot taxonomy, the hardware platform used throughout the book, motor driving, forward and inverse kinematics for three drive families, and PID feedback control.
Part II — Sensing (Chapters 5–8) Covers the three sensor modalities available on the platform — wheel encoders (odometry), IR line array, ultrasound ranger, and camera — including signal processing and perception algorithms for each.
Part III — Navigation Algorithms (Chapters 9–11) Develops reactive navigation (potential fields and Bug algorithms), grid-based path planning (Dijkstra, A), and sampling-based planning (RRT and RRT).
Part IV — System-Level Robotics (Chapters 12–14) Covers occupancy grid mapping, a conceptual introduction to SLAM, finite state machines and behaviour trees for structuring robot behaviour, and sensor fusion using complementary and Kalman filters.
Part V — Capstone (Chapter 15) Integrates all preceding topics into a complete autonomous navigation pipeline: mapping an unknown room, localising within it, planning a collision-free path, and executing the path with closed-loop control.
All code is Python 3.10+ and has been written to run both on embedded hardware (Raspberry Pi or similar) and in a lightweight desktop simulation. GPIO calls are wrapped in try/except ImportError blocks so that every module can be imported and unit-tested on a laptop. No external robotics framework is required; the only dependencies are NumPy, SciPy, OpenCV, and matplotlib — all installable with pip.
Mathematical notation uses $...$ for inline expressions and displayed equations where needed. Where formulas are given, worked numerical examples with realistic hardware parameters follow immediately.