- Podcasts
- CyberSecurity Summary
- Learning Robotics using Python: Design, simulate, program, and prototype an autonomous mobile robot using ROS, OpenCV, PCL, and Python
Learning Robotics using Python: Design, simulate, program, and prototype an autonomous mobile robot using ROS, OpenCV, PCL, and Python
CyberSecurity Summary
- July 21, 2025
- 33 min
About this episodeA comprehensive guide to designing, simulating, programming, and prototyping autonomous mobile robots using ROS, OpenCV, PCL, and Python…
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/-/en/Learning-Robotics-using-Python-autonomous/dp/1788623312?&linkCode=ll1&tag=cvthunderx-20&linkId=d676017a8308b1dcf669abf00f061a6b&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: Design, simulate, program, and prototype an autonomous mobile robot using ROS, OpenCV, PCL, and Python
Our journey takes us deep into the pages of learning robotics using Python second edition, and our mission for this deep dive is to quickly and thoroughly extract the most important insights, maybe some surprising facts too, about constructing a mobile robot like our chef bot. We want to give you a shortcut basically to being truly well informed without all the usual information overload.
Means you rarely have to reinvent the wheel for common stuff like controlling a motor or reading a specific sensor. Another huge benefit is language independence. How so well you can write these notes in Python C plus plus OS even less, and they'll all communicate seamlessly within ROS doesn't care what language they're written in.
Well, I mean, nothing's perfect right. While it simplifies a lot, the learning curve can be a bit steep at first. There's just a lot to the ecosystem, but for complex systems, the advantages usually outweigh that initial hump. And to really get how ROS manages this distributed control, it helps an understand its organization. It's sort of structure on three.
The fundamental units are packages which contained everything source code, libraries, configuration files, you name it. Each package has a special file the manifest file. It's called package dot xml, which details what's in the package and what other packages it depends on dependencies. Okay, right, and then you have message dot MSG and service dot SRV types. These are like blueprints defining the data structures for how different parts of the robot will communicate, what kind of data they'll send back and forth.
Great question? Once connected nodes primarily communicate using ROS topics and messages. Think of topics as dedicated radio channels, maybe named channels for one to many communication. It's asynchronous asynchronous meaning meaning a node just publishes data onto a topic whenever it has data to is in, and any other nodes that are subscribed to that topic will receive it eventually. They don't have to be perfectly synced up.
The third level is simply the ROS community level. This isn't software, it's the ecosystem around ROS, things like ROS distributions, specific versions like ROS Kinetic, which the book uses, online code repositories like GitHub, the huge ROS wiki for documentation, mailing lists, and ROS answers, which is basically stack overflow just for ROS questions. So a big network, a huge, vibrant and really helpful network. It's key to ros's success.
A key concept here is the instantaneous center of curvature or ICC. That's the imaginary point the robot is pivoting around as it turns. Calculating this involves the wheel speeds, the wheel radius, the distance between the wheels, and it relies heavily on center data like from wheel encoders that track how much each wheel has turned.
But the good news is you can achieve complex maneuvers by combining very simple fundamental actions like what you well, Moving perfectly straight just means spinning both wheels at the exact same speed, okay, and rotating perfectly in place means spinning the wheels at the same speed, but in opposite directions.
Absolutely, that budget constraint shapes everything. So for the mechanical design, they confirmed using that differential drive system we talked about. They did detailed calculations to figure out the required motor rpm turns out it was about eighty rpm and then necessary torque around eighteen kilogram centimeters based on the target speed payload and a chosen wheel diameter of nine centimeters.
They leaned heavily on free and open source CAD tools. They use libracad for the two D drawings needed for manufacturing parts. For three D modeling, they use Blender, which is amazing. It's mostly known for animation, but it's a capable modeler. They even use Python scripting within Blender to automate some design tasks, which is pretty slick.
Very Those encoders are vital, providing data on both how much each wheel has turned and in which direction, crucial for tracking movement accurately. To control these motors, they used to Polo duel VNH two SP thirty H bridge. That's the motor driver chip. It takes simple signals direction and speed and provides the actual power to the motors. Speed is controlled using PWM pulsewidth.
It acts as the central hub for all the low level hardware. Now really crucial practical detail here they needed a three point three volt to five volt bi directional level shifter level shifter. Why because the TVC launch pad runs at three point three volts, but many common robot components like that motor driver and some sensors like the ultrasonic ones, they need five volts if you connect them directly.
Budget, definitely not so. This little level shifter board is essential to let the three point three V micro controller talk safely to the five ve components and vice versa. It's an easy detail to overlook, but absolutely critical for making the hardware actually work together without damage right.
For vision, they use a three D vision sensor, either a Microsoft Connect the older Xbox three sixty one is popular in robotics, or an orbec Astra. These are brilliant because they capture not just a regular color image, but also depth information for every pixel. They output a three D point.
Oh, absolutely huge. This virtual prototyping is invaluable, especially on a tight budget. Now, once you move to the real hardware, you need that bridge between the low level micro controller and the high level ROS system. That's the job of the ROS Python driver, which is part of a package called chefbot.
This Python node runs on the main PC the nu SE and communicates with the launchpad, usually over a serial connection like USB. It reads the raw sensor values the encoder counts the ultrasonic distance is the IMU data that the launch pad sends, gets the raw data yes, and then it converts that raw data into standardized ROS messages and publishes them onto the appropriate ROS topics like well wheel or wheel ultrasonic distance emute data.
They take the target wheel velocities calculated by the higher level navigation logic and convert them into the precise motor commands, like the PWN values needed to make the wheels actually spin at those target SPADs, compensating for friction load, battery voltage changes, etc. They ensure the robot executes movements.
Why do that because many of the most mature and robust algorithms for mapping and localization in ROS were originally developed for and expect input from two D laser scanners. This package lets the chef bot use those powerful, well tested algorithms even though it only has a cheaper depth camera.
Okay, super smart work round. So the chef bot now has better odometry, it can control ease wheels precisely, and it has this fake laser scan of its immediate surroundings. But how does it then figure out where it is within the whole hotel, build a map of that hotel and plan how to get from say, the kitchen to table five, all by itself.
SLAM algorithms like the g mapping package, which is commonly used in ROS and mentioned in the book, do both things at the same time as the robot moves around using its sensors like our fake laser scan and the improved odometry. G mapping incrementally build a two D grid map of the environment and simultaneously estimates the robot's most likely position within that map. They refine each other over time.
AMCL takes the known pre built map and the robot's current sensor readings again laser scans and odometry, and uses a probabilistic method called a particle filter to figure out the robot's most likely current position and orientation within that map. It's very robust, even if the robot gets a bit lost or kidnapped temporarily.
That is the job of the main navigation planner and execution node, which in ROS is typically the move based node. This is really the autonomous navigation brain. Move base the brain. Yeah, it brings everything together. Yeah, it takes the map from the map server. It takes the robot's current precise pose from AMCL and it takes a target goal location like the coordinates for a table five that you.
And then it starts executing that path, continuously sending the appropriate speed commands those target linear and angular velocity. As we mentioned down towards the robots motors via the PID controllers and the driver, it constantly monitors progress, replans as necessary if obstacles appear, and guides the robot autonomously to the goal.
It really is, Yeah, but it's amazing to watch it work, especially when you use our viz, that ROS visualization tool. You can see the map, the robot's position, the sensor data, the path it's planning, even internal things like its cost maps areas it calculates it should avoid due to proximity to obstacles. It gives you a fantastic window into the robot's mind.
Well, the main purpose is exactly what you said, create a simple control panel, abstract away all that underlying ROS complexity for users who aren't robotics experts. For chef Bought, the developers chose QT. Yeah. Qt is a very powerful, widely used framework for building cross platform graphical user interfaces, and crucially it has excellent Python bindings, specifically pi qt or sometimes piside.
Right. A slot is simply a Python function that you write. You then connect a specific signal to a specific slot. So you connect the buttons clicked signal to your Python function, say handleg button click when the button's clicked, its signal was emitted, and QT automatically calls your connected slot function.
So you design the look in U designer, which saves it as a dot UI file. You then use a command line tool POK four or piside two WIC to automatically convert that dot ui file into Python code that creates the GUI elements. Then you take that generated Python code and you add your own logic. You write the slot functions that actually do things with the robot when signals are emitted.
So the GUI the client takes the pre defined map coordinates for table five it's xy position and maybe the orientation of the robot should face when it gets there, bundles them up into a move based goal message and sends this goal to the move based note we talked about earlier. In this interaction, move base is acting as the action lib server.
This action lube architecture handles all the communication. The server move base accepts the goal, starts executing the navigation, and can send feedback periodically back to the client the guy like how far along the path it is, and the client can also send a cancelation request if needed.
And maybe most relevant to navigation, there's often an integrated r viz plug in sometimes called the Navigation Viewer or similar that lets you embed that powerful three D visualization right inside your RQ window. You can see the map, the robot, the sensors, the planned path, all alongside your console and topic monitors.
Okay, so stepping back, we've taken quite a deep dive, haven't we, into this journey of creating an autonomous service robot, the chefbot. We went from the foundational software the Robot Operating System ROS, through the nitty gritty of mechanical and electrical design into sophisticated simulation. Intelligent navigation algorithms like SLAM and AMCL and finally even building a user friendly graphical interface. We've really seen how all these complex engineering pieces have to come together to build a functional, intelligent machine.
It highlights that building advanced robots isn't about expertise in just one area. It's about this seamless integration of so many different fields mechanical engineering, electrical engineering, software engineering, control theory, AI. And what's really enabling this convergence, I think, is the modularity offered by frameworks like ROS, and the incredible accessibility of powerful open source tools, from the OS and ROS itself to CAD software, simulators and life libraries. It means creating these complex systems is genuinely more achievable now than ever before for students, hobbyist startups, not just huge corporations.
Well, consider this as robots like the chef Butt become more and more commonplace, moving around us in hotels, hospitals, warehouses, maybe even our homes. And as they move beyond just simple, repetitive tasks towards more complex interactions, what new ethical and social considerations start to emerge?
How will the transparency here maybe a lack thereof, in their design and decision making processes shape our trust in them? And how much will the simplicity or maybe the complexity of their interfaces how we interact with them influence our acceptance of these increasingly intelligent autonomous systems sharing our daily lives. Something to chew on
