- Podcasts
- CyberSecurity Summary
- Learning Robotics Using Python
About this episodeA comprehensive guide for designing and building autonomous mobile robots. The material focuses on a specific case study of a service…
You can listen and download our episodes for free on more than 10 different platforms:
https://linktr.ee/cyber_security_summary
Get the Book now from Amazon:
https://www.amazon.com/Learning-Robotics-Using-Python-interactive/dp/1783287535?&linkCode=ll2&tag=cvthunderx-20&linkId=f855fbbf1436a75d4e99d0efe9df7948&language=en_US&ref_=as_li_ss_tl
Discover our free courses in tech and cybersecurity, Start learning today:
https://linktr.ee/cybercode_academy
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
Learning Robotics Using Python
Okay, let's unpack this because before we can even think about building our robotic waiter, we really need to define what separates a tree robot from just, you know, a complex machine. You really do, and honestly, we have to fight through a century of science fiction myths to get to a working definition.
Oh absolutely. Even the origin of the word itself sets up this expectation that engineers have been wrestling with ever since. I mean, the term robot didn't originate in an MIT laboratory. It was coined in a theater in nineteen twenty a check writer named Carol Kappek wrote a play called ru Are.
Right, because a spam filter learns, it adapts, it acts autonomously to keep junk out of my inbox. Yeah, but it doesn't live in the physical world. The data is just perfectly spoon fed to it in a stable digital environment. Right. Is the sheer chaos of a messy physical bedroom what makes building a true robot so uniquely difficult.
That is the absolute core of the challenge. A spam filter never has to worry about a sudden gust of wind, or the floor being slippery, or a dog running by exactly or the lighting in the room changing and blinding its camera. The physical world is wildly unpredictable. The friction on a carpet is different from the friction on hardwood. Sensing that unpredictable chaos, making sense of it, and then physically exerting force upon it, that continuous loop is what separates true robotics from pure software engineering.
This brings us to the fundamental anatomy of a robot. You have the physical body. You have sensors which measure the environment to create what we call a digital state. You have effectors or the motors and arms that do the actual moving and sitting between the sensors and the effectors, you have the controllers.
And giving a machine a brain that could handle physical chaos really started around nineteen sixty six with a robot developed at the Stanford Research Institute famously named Shaky. Shaky, Yeah, Shaky. It was a milestone because it didn't just execute a list of hard coded commands. It could actually reason. How So, if you gave Shakey a high level command, it could break that complex goal down into smaller, solvable intermediate steps. I mean, trying to get Shaky to navigate around literal blocks in a room actually led researchers to invent the a star search algorithm.
A spinal reflex is a phenomenal way to picture it, actually, but with one major caveat A robot's reflex is completely programmable. And if we connect this to the bigger picture of the robotic waiter we are trying to build from the source material, you quickly realize you can't rely purely on one paradigm.
Exactly that. The robot needs a hierarchical deliberative plan to note that payble four is across the dining room, to map an efficient path around the stationary booths, and to calculate an arrival time. But if a patron suddenly steps backward out of their chair holding a tray of drinks, the robot does not have three seconds to sit there and recalculate a new global map.
And the mechanical solution the book walks us through is a differential drive system. Yes, it's modeled after the turtlebot architecture. If you picture it, it looks kind of like a three tiered wedding cake made of metal plates, a base plate, a middle plate, and a top plate. That's a good visual, But the drive system is what caught my eye. It only has two powered wheels on the left and right sides, and then these unpowered castor wheels like you'd find on the bottom of an office chair on the front and back, just to keep it from tipping over.
He also uses libricad for the two D bluefrints and Blender for the three D models. But here's where I got really confused reading the source. Oh, when it's time to build the three D model in Blender, the author doesn't use the mouse. They don't drag and drop shapes. They open Blenders, Python API, the boopy module and write lines of Python code just to generate a three D cylinder.
I know it feels entirely counterintuitive until you consider the reality of iterative engineering. When you drag a mouse to draw a cylinder, you are introducing human imperfection. You might be off by a fraction of a millimeter, right, But more importantly, a hand drawn shape is static. Programmatic modeling allows you to completely parameterize your dimensions.
The math automatically recalculates, resizes the cylinder, shifts the wheel mounts, and spits out a flawless, updated three D model. Plus the script can automatically export the STL files needed for simulation without any graphical artifacts. You aren't drawing a picture, you are engineering a responsive system.
Okay. I love that the code itself becomes the ultimate precision tool. So now we have our three D model, perfectly generated by Python, sitting on as differential drive wheels, right. But to make it actually navigate a virtual restaurant, we run into the physics of driving, and this introduces kinematics.
Basically, for our robot, we have to look at its degrees of freedom or its pose on a flat restaurant floor. The robot operates in a standard X and y coordinate system like a graph, but it also has a heading the direction it's facing, which is represented by the Greek letter theta, So its pose is always defined by x, y and theta.
Car can't just slide sideways into a spot. I have to roll forward or backward based on where the wheels are pointing. I have to do this whole geometric dance of turning, reversing, and straightening out just to move a few feet to the left. Face does our robotic waiter have the same problem, like, if table four is directly to its left, can it just strafe sideways?
It absolutely cannot, and your parallel parking frustration is the exact manifestation of a non Holow constraint. The robot cannot change its position on the x or y axis without first changing its data it's heading wow. To reach of that table to its left, it must execute a specific foundational algorithm for inverse kinematics vrot vahead v rot.
Point is continually forward. Kinematics is the mes asking, given the current speed of my left wheel and right wheel, where will my X y and theta be in five seconds? In Verse, kinematics asks the much harder question, I need to be at this specific X y and theta Exactly how fast should I spin my left wheel versus my right wheel to make my ICC carve the perfect arc to get there?
It relies on wheel adometry. Attached to the motors are sensors called wheel encoders encoders Okay. The text explains that these encoders output binary signals microscopic digital clicks or steps as the physical wheel rotates. If you know exactly how far the wheel travels in one tiny step, you just count the steps.
Here's where it gets really interesting for me. The tools used for this are gazebo and ros because zebo makes sense. It's the three D physics simulator. It renders the restaurant, the tables, and calculates the virtual gravity. But ROS, the robot operating system, is what actually runs the brain, although the text makes a point to say it isn't actually an operating system like Windows or Linux. It's a meta operating system and a distributed framework.
That's a vital distinction ROS. It's on top of a traditional operating system. At its core, ROS is a communication framework. A modern robot runs dozens of separate executable programs simultaneously, one for vision, one for driving, one for mapping. ROS calls these individual programs nodes nodes. Yes, you have a central directory called the ROS master that keeps track of what nodes are running. But the actual data sharing happens through a brilliant published and subscribe model using data streams called topics.
And this decoupled architecture is what makes ros so powerful. Because the nodes are completely independent, they don't even need to be written in the same programming language. Wait really, Yeah, your wheel encoder node could be a simple Python script running on a tiny Raspberry Pie strapped to the robot's base. Meanwhile, your complex path planning node could be a heavy performance intensive C plus plus program running on a massive server in the restaurant's back office, communicating over Wi Fi. It's a decentralized peer to peer.
Right, that's the real magic code reuse. A university team in Tokyo might write a brilliant, highly optimized node for avoiding dynamic obstacles. Because their node just subscribes to standard laser scan topics and publishes to standard velocity topics. You can download their open source code and drop it straight into.
Yes, we calculated the physical torque needed to move a tray of food, parameterized a three D model using Python scripts, and solve the parallel parking geometry of non holonomic kinematics, and Finally, we plug all those independent nodes into the ros published and subscribe matrix to simulate a working waiter.
It profoundly changes how you view the machines around you. But to leave you with a final thought to mull over. Earlier we touched on the history of robotics, which the source text outlines, and you can't discuss that history without mentioning Isaac Asimov's famous three laws of robotics. Asimov's first law states that a robot may not injure a human being. It's an ethical philosophical mandate designed to keep us safe.
And this raises an important question for the future of engineering. In the reality of ros, everything is just nodes, topics, wheel encoders, and coordinate geometry. How do you map a human value onto a publish and subscribe network When our simulated waiter is calculating its instantaneous center of curvature to avoid a table, At what point does a mathematical threshold cross over into a moral decision. We know how to program a machine to understand rpm and torque, but how do we eventually program it to understand us.
