Latest / CyberSecurity Summary / Learning Robotics using Python: Design, simulate, program, and prototype an autonomous mobile robot using ROS, OpenCV, PCL, and Python
Transcript
- 0:00Speaker 1: Imagine a robot gliding silently through a bustling hotel, carrying
- 0:05Speaker 1: a delicious meal right to your table. A chef bot
- 0:09Speaker 1: sounds like something from the future, right.
- 0:11Speaker 2: Yeah, definitely.
- 0:12Speaker 1: Well, today we're kind of pulling back the curtain on
- 0:14Speaker 1: how such an autonomous marvel is actually designed and built,
- 0:17Speaker 1: you know, piece by painstaking piece from the ground up.
- 0:20Speaker 2: That's quite a process.
- 0:22Speaker 1: Our journey takes us deep into the pages of learning
- 0:24Speaker 1: robotics using Python second edition, and our mission for this
- 0:29Speaker 1: deep dive is to quickly and thoroughly extract the most
- 0:32Speaker 1: important insights, maybe some surprising facts too, about constructing a
- 0:36Speaker 1: mobile robot like our chef bot. We want to give
- 0:39Speaker 1: you a shortcut basically to being truly well informed without
- 0:42Speaker 1: all the usual information overload.
- 0:44Speaker 2: Sounds good, It's a great source for this.
- 0:45Speaker 1: So let's start with the robot's abstract brain. What exactly
- 0:49Speaker 1: is the robot operating system or ROS and why is
- 0:52Speaker 1: it considered well the indispensable backbone for building something as
- 0:55Speaker 1: complex as our chef bot.
- 0:57Speaker 2: Right, So, a crucial insight here is that ROS isn't
- 1:01Speaker 2: a traditional operating system like you'd find on your laptop
- 1:04Speaker 2: like Windows are my Coska. Think of it more as
- 1:06Speaker 2: a meta operating system, right, a flexible framework that sits
- 1:10Speaker 2: on top of a conventional OS, which is typically upon
- 1:13Speaker 2: two Linux.
- 1:13Speaker 1: Ah, okay, so it needs Linux underneath it exactly.
- 1:17Speaker 2: It's really the software architecture that elegantly ties all the
- 1:20Speaker 2: complex robotic parts sensors, motors, algorithms together.
- 1:25Speaker 1: So it's not standalone, but it's this crucial layer that
- 1:29Speaker 1: streamlines actually developing the robot. What are its main advantages then?
- 1:34Speaker 2: Precisely? One of its biggest strengths is code reuse. This
- 1:37Speaker 2: has really fostered a massive global R and D community.
- 1:40Speaker 2: Developers share these little programs called nodes and they buttle
- 1:44Speaker 2: them into.
- 1:44Speaker 1: Packages nodes and packages okay, yeah, and it.
- 1:46Speaker 2: Means you rarely have to reinvent the wheel for common
- 1:48Speaker 2: stuff like controlling a motor or reading a specific sensor.
- 1:52Speaker 2: Another huge benefit is language independence. How so well you
- 1:56Speaker 2: can write these notes in Python C plus plus OS
- 1:59Speaker 2: even less, and they'll all communicate seamlessly within ROS doesn't
- 2:02Speaker 2: care what language they're written in.
- 2:04Speaker 1: That's pretty flexible, it is.
- 2:05Speaker 2: It also includes built in frameworks for easy testing like
- 2:09Speaker 2: roast tist, and critically for handling the intense computations of
- 2:14Speaker 2: complex robots. It offers impressive scalability plus maybe the biggest
- 2:19Speaker 2: draw for many, it's free and open source.
- 2:22Speaker 1: Ah, open source always good.
- 2:24Speaker 2: Yeah, under a BSD license, so its core parts can
- 2:27Speaker 2: even be used in commercial products. That really speeds up
- 2:29Speaker 2: innovation across the whole industry.
- 2:31Speaker 1: You know, that makes a ton of sense for getting
- 2:33Speaker 1: things built faster. Are there any downsides to this metaos
- 2:37Speaker 1: approach or is it pretty much all good?
- 2:40Speaker 2: Well, I mean, nothing's perfect right. While it simplifies a lot,
- 2:43Speaker 2: the learning curve can be a bit steep at first.
- 2:45Speaker 2: There's just a lot to the ecosystem, but for complex systems,
- 2:49Speaker 2: the advantages usually outweigh that initial hump. And to really
- 2:53Speaker 2: get how ROS manages this distributed control, it helps an
- 2:58Speaker 2: understand its organization. It's sort of structure on three.
- 3:00Speaker 1: Level hiyh, three levels? Tell us more about how those
- 3:02Speaker 1: fit together.
- 3:02Speaker 2: Sure, first you've got the ROS file system. This is
- 3:05Speaker 2: basically how all the code and configuration files are organized
- 3:08Speaker 2: on your computer's.
- 3:09Speaker 1: Disc like folders and files pretty much.
- 3:11Speaker 2: The fundamental units are packages which contained everything source code, libraries,
- 3:16Speaker 2: configuration files, you name it. Each package has a special
- 3:20Speaker 2: file the manifest file. It's called package dot xml, which
- 3:23Speaker 2: details what's in the package and what other packages it
- 3:26Speaker 2: depends on dependencies. Okay, right, and then you have message
- 3:29Speaker 2: dot MSG and service dot SRV types. These are like
- 3:33Speaker 2: blueprints defining the data structures for how different parts of
- 3:36Speaker 2: the robot will communicate, what kind of data they'll send
- 3:38Speaker 2: back and forth.
- 3:39Speaker 1: So that's the structure. What's the next level, the action part?
- 3:42Speaker 2: Exactly, moving from structure to action. The second level is
- 3:46Speaker 2: the ROS computation graph. This is the real time peer
- 3:49Speaker 2: to peer network where all the actual data processing happens
- 3:52Speaker 2: as the robot.
- 3:53Speaker 1: Runs peer to peer. Interesting.
- 3:55Speaker 2: Yeah, At his heart are the nodes. These are the
- 3:57Speaker 2: individual programs, the executables doing specific jobs like processing camera
- 4:02Speaker 2: images or deciding where to move next.
- 4:04Speaker 1: And how do these nodes find each other to talk?
- 4:07Speaker 2: Ah, that's where the ROS master comes in.
- 4:09Speaker 1: Yeah.
- 4:09Speaker 2: It acts like a central directory or maybe like a
- 4:12Speaker 2: DNS server for the nodes.
- 4:14Speaker 1: Okay, yeah, I get that analogy.
- 4:15Speaker 2: Without the master, nodes can't find each other to connect.
- 4:18Speaker 2: So it's absolutely essential for kicking things off.
- 4:21Speaker 1: Right, makes sense. It's crucial for that dynamic communication you
- 4:24Speaker 1: need in a changing environment. So once they've found each
- 4:27Speaker 1: other via the master. How do they actually exchange information?
- 4:32Speaker 2: Great question? Once connected nodes primarily communicate using ROS topics
- 4:38Speaker 2: and messages. Think of topics as dedicated radio channels, maybe
- 4:44Speaker 2: named channels for one to many communication. It's asynchronous asynchronous
- 4:48Speaker 2: meaning meaning a node just publishes data onto a topic
- 4:52Speaker 2: whenever it has data to is in, and any other
- 4:54Speaker 2: nodes that are subscribed to that topic will receive it eventually.
- 4:56Speaker 2: They don't have to be perfectly synced up.
- 4:58Speaker 1: Okay, so it's like broadcasting sort of.
- 5:00Speaker 2: Yeah, and the messages themselves are built from basic data
- 5:03Speaker 2: types numbers, text, true false values. A raise of those
- 5:06Speaker 2: keeps things standardized.
- 5:07Speaker 1: And what if you need a direct question and answer,
- 5:10Speaker 1: not just broadcasting for that.
- 5:12Speaker 2: You use services that's for synchronous request reply interactions. One
- 5:16Speaker 2: node sends a request, waits and gets a direct reply
- 5:20Speaker 2: back from another node.
- 5:21Speaker 1: Got it, request reply.
- 5:23Speaker 2: And finally there's something called bags. These are really useful.
- 5:26Speaker 2: They're a file format for recording and then replaying all
- 5:29Speaker 2: the data that went across ROS topics. Great for debugging
- 5:32Speaker 2: or testing offline without the actual robot.
- 5:34Speaker 1: Oh cool, like flight recorders for robots kind of yeah, And.
- 5:38Speaker 2: The third level is simply the ROS community level. This
- 5:41Speaker 2: isn't software, it's the ecosystem around ROS, things like ROS distributions,
- 5:46Speaker 2: specific versions like ROS Kinetic, which the book uses, online
- 5:49Speaker 2: code repositories like GitHub, the huge ROS wiki for documentation,
- 5:54Speaker 2: mailing lists, and ROS answers, which is basically stack overflow
- 5:58Speaker 2: just for ROS questions. So a big network, a huge,
- 6:01Speaker 2: vibrant and really helpful network. It's key to ros's success.
- 6:04Speaker 1: Okay, so we've laid out the digital foundation, the software
- 6:07Speaker 1: brain using ROS. But like you said, a brain needs
- 6:09Speaker 1: a body. So how do we connect this abstract intelligence
- 6:13Speaker 1: to a physical robot, something that can actually move through
- 6:17Speaker 1: a hotel carrying stuff?
- 6:18Speaker 2: Right the physical side. The very first step really in
- 6:22Speaker 2: building the physical robot is understanding how it's going to move.
- 6:25Speaker 2: It's fundamental movement principles. Our chef bot uses a differential
- 6:29Speaker 2: drive system.
- 6:30Speaker 1: Differential drive what's that exactly?
- 6:32Speaker 2: It's a really common and cost effective way to steer.
- 6:35Speaker 2: Think of like a classic roomba vacuum. It has two
- 6:39Speaker 2: main wheels on the same axis, and each one is
- 6:41Speaker 2: driven by its own separate motor.
- 6:43Speaker 1: Okay, two main drive wheels.
- 6:45Speaker 2: Yeah, controlled independently yeah, then it usually has one or
- 6:48Speaker 2: more passive caster wheels just for balance.
- 6:50Speaker 1: Simple enough, two wheels a castor. But I've heard terms
- 6:54Speaker 1: like non holonomic thrown around with these kinds of robots.
- 6:58Speaker 1: What does that mean for how chef bought moves?
- 7:00Speaker 2: Ah? Yeah, that's the key concept. Differential drive robots are
- 7:03Speaker 2: non holonomic systems. Think about your car for a second.
- 7:07Speaker 2: It can't just slide sideways into a parking spot, can it.
- 7:10Speaker 2: It has to turn his wheels and follow a curve right.
- 7:12Speaker 1: Yeah, parallel parking woes exactly.
- 7:15Speaker 2: So a non holonomic system is one whose movement is constrained.
- 7:20Speaker 2: It can't instantly move in any direction. Its possible motions
- 7:23Speaker 2: are limited, unlike say a drone, which can hover and
- 7:26Speaker 2: shift left, right, forward back instantly.
- 7:29Speaker 1: Okay, so it has movement constraints, got it.
- 7:31Speaker 2: And we also need to distinguish between robot kinematics and dynamics.
- 7:36Speaker 2: Kinematics is the math of motion without worrying about forces
- 7:39Speaker 2: like mass or inertia. It's purely about the geometry the
- 7:43Speaker 2: robot's position x Y and its orientation or heading usually
- 7:47Speaker 2: called yaw.
- 7:48Speaker 1: Just the geometry of movement right.
- 7:50Speaker 2: Dynamics, on the other hand does factor in forces, mass, friction,
- 7:53Speaker 2: motor power, acceleration, That gets much more complex. Usually, for
- 7:57Speaker 2: basic navigation we often start with kinematics.
- 7:59Speaker 1: Makes sense, start simpler, Yeah, So for.
- 8:02Speaker 2: Chef bot, a critical kinematics problem is forward kinematics. The
- 8:06Speaker 2: question is, if you know the robot's current position, and
- 8:09Speaker 2: you know how fast the left and right wheels are spinning,
- 8:12Speaker 2: can you predict where it will be a moment later?
- 8:14Speaker 1: Predicting the future position based on wheel speeds exactly?
- 8:18Speaker 2: A key concept here is the instantaneous center of curvature
- 8:21Speaker 2: or ICC. That's the imaginary point the robot is pivoting
- 8:25Speaker 2: around as it turns. Calculating this involves the wheel speeds,
- 8:29Speaker 2: the wheel radius, the distance between the wheels, and it
- 8:32Speaker 2: relies heavily on center data like from wheel encoders that
- 8:35Speaker 2: track how much each wheel has turned.
- 8:37Speaker 1: Okay, so encoders tell you wheel rotation. That feeds into
- 8:40Speaker 1: calculating the ICC, which helps predict motion. What about the
- 8:44Speaker 1: other way around, that's.
- 8:45Speaker 2: Inverse kinematics, the reverse problem. If you know where you
- 8:48Speaker 2: want the robot to go, how fast you need to
- 8:51Speaker 2: spin each wheel to get it there?
- 8:52Speaker 1: Figuring out the wheel speeds for a desired goal.
- 8:55Speaker 2: Right. But here's the catch. For non holonomic robots like
- 8:58Speaker 2: chef bot. Because of those moves and constraints we mentioned inverse,
- 9:01Speaker 2: kinematics doesn't always have a single direct solution. You often
- 9:05Speaker 2: have to plan a path made of simpler segments.
- 9:07Speaker 1: Ah, So it's not as simple as just pointing and
- 9:09Speaker 1: saying go there. It requires continuous calculation and adjustment based
- 9:13Speaker 1: on those constraints precisely.
- 9:15Speaker 2: But the good news is you can achieve complex maneuvers
- 9:19Speaker 2: by combining very simple fundamental actions like what you well,
- 9:22Speaker 2: Moving perfectly straight just means spinning both wheels at the
- 9:26Speaker 2: exact same speed, okay, and rotating perfectly in place means
- 9:30Speaker 2: spinning the wheels at the same speed, but in opposite directions.
- 9:33Speaker 1: Left forward, right, backward, or vice versa.
- 9:36Speaker 2: Exactly. By sequencing these simple moves, go straight a bit,
- 9:39Speaker 2: turn in place, go straight again, the chef bod can
- 9:42Speaker 2: navigate quite effectively through complex spaces like a hotel floor.
- 9:46Speaker 1: Okay, this is where the engineering gets really interesting. I
- 9:49Speaker 1: think applying these principles directly to the chef bod, what
- 9:53Speaker 1: were the specific concrete design challenges and the hardware choices
- 9:58Speaker 1: they had to make for this service robot, well.
- 10:01Speaker 2: The chef Box project had some really specific goals and
- 10:04Speaker 2: honestly quite aggressive ones. For the budget, it needed to
- 10:07Speaker 2: carry a two kilogram payload that's about four point four pounds.
- 10:10Speaker 1: Okay, decent load for food choice.
- 10:12Speaker 2: Yeah. It needed to move at a speed between point
- 10:14Speaker 2: twenty five and point three five meters per second. That's
- 10:17Speaker 2: a brisk walking pace. It needed ground clearance over three
- 10:20Speaker 2: centimeters to get over you know, small thresholder.
- 10:23Speaker 1: Bumps important in real world floors.
- 10:25Speaker 2: Definitely, and over an hour of continuous battery life, plus
- 10:29Speaker 2: of course, robust obstacle avoidance. It needed a height between
- 10:32Speaker 2: eighty and one hundred centimeters to be practical for interacting
- 10:35Speaker 2: with tables or.
- 10:35Speaker 1: People right height.
- 10:36Speaker 2: Yeah, and the real kicker a strict budget of less
- 10:40Speaker 2: than five hundred US dollars.
- 10:41Speaker 1: Wow, under five hundred dollars for a fully autonomous service robot.
- 10:45Speaker 1: That sounds incredibly challenging. It must have forced some really
- 10:48Speaker 1: clever engineering choices.
- 10:49Speaker 2: Absolutely, that budget constraint shapes everything. So for the mechanical design,
- 10:54Speaker 2: they confirmed using that differential drive system we talked about.
- 10:57Speaker 2: They did detailed calculations to figure out the required motor
- 11:00Speaker 2: rpm turns out it was about eighty rpm and then
- 11:03Speaker 2: necessary torque around eighteen kilogram centimeters based on the target
- 11:08Speaker 2: speed payload and a chosen wheel diameter of nine centimeters.
- 11:12Speaker 1: So physics calculations drive the motor choice directly.
- 11:15Speaker 2: For the chassis, they went with a multi layered architecture.
- 11:18Speaker 2: It's similar in concept to the popular turtle Bot two robot,
- 11:21Speaker 2: which provides good stability and makes it easier to organize
- 11:24Speaker 2: all the electronic components neatly on different levels.
- 11:27Speaker 1: Smart and how do they design and visualize this without
- 11:30Speaker 1: expensive software? Given the budget great point.
- 11:33Speaker 2: They leaned heavily on free and open source CAD tools.
- 11:36Speaker 2: They use libracad for the two D drawings needed for
- 11:40Speaker 2: manufacturing parts. For three D modeling, they use Blender, which
- 11:45Speaker 2: is amazing. It's mostly known for animation, but it's a
- 11:47Speaker 2: capable modeler. They even use Python scripting within Blender to
- 11:52Speaker 2: automate some design tasks, which is pretty slick.
- 11:54Speaker 1: Python scripting in Blender nice.
- 11:56Speaker 2: Yeah, And then they use mesh lab, another open source tool,
- 12:00Speaker 2: just for viewing and inspecting the three D models. It
- 12:02Speaker 2: shows how much you can do with free tools if
- 12:04Speaker 2: you know how to use them.
- 12:05Speaker 1: It really does. Okay, So that's the physical structure. What
- 12:08Speaker 1: about the electronic brain and the senses, the parts that
- 12:10Speaker 1: make it actually do things and perceive the world.
- 12:13Speaker 2: Right. The electronics they selected specific pololu DC gear motors
- 12:17Speaker 2: that conveniently came with built in quadrature encoders.
- 12:19Speaker 1: AH encoders built in Handy.
- 12:22Speaker 2: Very Those encoders are vital, providing data on both how
- 12:26Speaker 2: much each wheel has turned and in which direction, crucial
- 12:29Speaker 2: for tracking movement accurately. To control these motors, they used
- 12:32Speaker 2: to Polo duel VNH two SP thirty H bridge. That's
- 12:36Speaker 2: the motor driver chip. It takes simple signals direction and
- 12:39Speaker 2: speed and provides the actual power to the motors. Speed
- 12:42Speaker 2: is controlled using PWM pulsewidth.
- 12:44Speaker 1: Modulation PWM right, varying the pulse width to control power.
- 12:48Speaker 2: Exactly the brain of this low level system. The thing
- 12:52Speaker 2: interfacing directly with sensors and motors is the Texas Instrument's
- 12:55Speaker 2: TVC launch pad. It's a capable little thirty two bit
- 12:58Speaker 2: AIRM microcontroller.
- 13:00Speaker 1: The micro controller handles the immediate real time stuff precisely.
- 13:03Speaker 2: It acts as the central hub for all the low
- 13:05Speaker 2: level hardware. Now really crucial practical detail here they needed
- 13:09Speaker 2: a three point three volt to five volt bi directional
- 13:12Speaker 2: level shifter level shifter. Why because the TVC launch pad
- 13:14Speaker 2: runs at three point three volts, but many common robot
- 13:17Speaker 2: components like that motor driver and some sensors like the
- 13:20Speaker 2: ultrasonic ones, they need five volts if you connect them directly.
- 13:23Speaker 1: Zap Ah Fried components not good on a five hundred dollars.
- 13:26Speaker 2: Budget, definitely not so. This little level shifter board is
- 13:30Speaker 2: essential to let the three point three V micro controller
- 13:33Speaker 2: talk safely to the five ve components and vice versa.
- 13:36Speaker 2: It's an easy detail to overlook, but absolutely critical for
- 13:40Speaker 2: making the hardware actually work together without damage right.
- 13:43Speaker 1: Making sure everything speaks the same voltage language. Good tip.
- 13:46Speaker 1: What about its senses? How does it perceive the world
- 13:49Speaker 1: around it?
- 13:50Speaker 2: So for sensors, they used a few types ultrasonic sensors,
- 13:53Speaker 2: the common HCSR zero war four model for basic short
- 13:57Speaker 2: range obstacle detection like batsy sonar are these use sound waves.
- 14:01Speaker 1: Cheap and cheerful obstacle avoidance pretty much.
- 14:04Speaker 2: Then an IMU, an inertial measurement unit, specifically the MPU
- 14:08Speaker 2: sixty to fifty chip. This combines an accelerometer and a
- 14:11Speaker 2: gyroscope on one chip.
- 14:12Speaker 1: What is the IMU add.
- 14:14Speaker 2: It significantly improves the robot's estimate of its own position
- 14:17Speaker 2: and orientation, what we call odometry. Wheel encoders alone can
- 14:20Speaker 2: slip or drift, especially on turns. The IMU data helps
- 14:23Speaker 2: correct for those errors, giving a much more accurate picture
- 14:26Speaker 2: of the robot's movement.
- 14:27Speaker 1: Betterrodometry, got it and vision.
- 14:29Speaker 2: For vision, they use a three D vision sensor, either
- 14:32Speaker 2: a Microsoft Connect the older Xbox three sixty one is
- 14:35Speaker 2: popular in robotics, or an orbec Astra. These are brilliant
- 14:40Speaker 2: because they capture not just a regular color image, but
- 14:42Speaker 2: also depth information for every pixel. They output a three
- 14:45Speaker 2: D point.
- 14:46Speaker 1: Cloud depth camera, so at season three D exactly.
- 14:49Speaker 2: And this is a very clever choice because this depth
- 14:51Speaker 2: data can be processed to mimic the functionality of a
- 14:55Speaker 2: lid ar, a laser scanner, which is usually much much
- 14:58Speaker 2: more expensive. It's key for building detailed maps of the environment.
- 15:01Speaker 1: Ah mimicking light ar on a budget smart very smart.
- 15:05Speaker 2: Now, all the sensor data and the complex planning that
- 15:07Speaker 2: requires more computing power than a little TVC micro controller
- 15:10Speaker 2: can handle. So for the high level processing there's an
- 15:13Speaker 2: Intel NUCPC on board.
- 15:15Speaker 1: The small PC running the main show right.
- 15:17Speaker 2: Running Ubuntu and the main ROS system. It does the
- 15:20Speaker 2: heavy lifting navigation, mapping, decision making, and for interacting with people.
- 15:24Speaker 2: It has speakers and a microphone for potential voice commands
- 15:26Speaker 2: and Texas speech.
- 15:27Speaker 1: Feedback talking robot potential YEP.
- 15:31Speaker 2: And finally, powering all of this is a hefty twelve
- 15:34Speaker 2: volt ten amp hour battery, either lithium polymer or sealed
- 15:38Speaker 2: lead acid, depending on costs and safety trade offs to
- 15:41Speaker 2: meet that one hour plus runtime requirement.
- 15:44Speaker 1: Okay, wow, we've basically built the hardware now, selected all
- 15:47Speaker 1: the key parts, even designed at digitally using open source tools.
- 15:50Speaker 1: Now the really big challenge, right, how do we inject
- 15:53Speaker 1: the intelligence? How do we make this chef bot truly
- 15:56Speaker 1: smart and autonomous?
- 15:57Speaker 2: Right? This is where the software sophistication really canes comes
- 16:00Speaker 2: in and it raises a super important practical question. Before
- 16:03Speaker 2: you unleash this robot in a real hotel, how do
- 16:06Speaker 2: you test its brain, its algorithms, its navigation logic safely
- 16:10Speaker 2: and efficiently.
- 16:11Speaker 1: Yeah, you don't want it crashing into guests on its
- 16:13Speaker 1: first run exactly.
- 16:14Speaker 2: This is where robot simulation is absolutely indispensable. And the
- 16:17Speaker 2: tool of choice in the ROS world is Gazebo.
- 16:20Speaker 1: Gazebo heard of it? What does it do?
- 16:21Speaker 2: Gazebo is a powerful three D robot simulator. It lets
- 16:25Speaker 2: you create a virtual world, import a model of your robot,
- 16:27Speaker 2: and test its behavior realistically. It simulates physics, sensors, everything,
- 16:31Speaker 2: and critically. It integrates very tightly with ROS.
- 16:34Speaker 1: How does that integration work?
- 16:36Speaker 2: Well, You define your robots model using RDF, which is
- 16:39Speaker 2: an XML format ROS uses to describe robot structures. You
- 16:43Speaker 2: add special Gazebo tags to this RDF file to specify
- 16:47Speaker 2: simulation properties like how much friction the wheels have, what
- 16:50Speaker 2: the robot looks like visually in the simulation.
- 16:53Speaker 1: So you describe the robot for the simulation.
- 16:55Speaker 2: Yes, and then Gazebo ROS plugins handle the magic plugins
- 17:00Speaker 2: that simulate a differential drive, depth, cameras, imus ultrasonic sensors,
- 17:06Speaker 2: and these plugins publish their simulated sensor data as standard
- 17:09Speaker 2: ROS topics, exactly like their real hardware would.
- 17:12Speaker 1: WHOA, So the rest of your ROS software doesn't even
- 17:15Speaker 1: know if it's talking to the real robot or the simulation.
- 17:18Speaker 2: Pretty much, that's the beauty of it. You can develop
- 17:20Speaker 2: and test almost your entire software stack in simulation first.
- 17:23Speaker 1: So you can essentially build and test the robot virtually
- 17:26Speaker 1: before you even I don't know, cut the first piece
- 17:28Speaker 1: of metal or a solder a single connection. That must
- 17:31Speaker 1: be a massive time and cost saver.
- 17:33Speaker 2: Oh, absolutely huge. This virtual prototyping is invaluable, especially on
- 17:38Speaker 2: a tight budget. Now, once you move to the real hardware,
- 17:41Speaker 2: you need that bridge between the low level micro controller
- 17:44Speaker 2: and the high level ROS system. That's the job of
- 17:46Speaker 2: the ROS Python driver, which is part of a package
- 17:49Speaker 2: called chefbot.
- 17:50Speaker 1: Bring up the driver node. What's its role?
- 17:52Speaker 2: It essentially acts as the translator. Remember the TVC launch
- 17:56Speaker 2: pad micro controller handling the motors and basic sensors.
- 17:58Speaker 1: Yeah, the low level brain right.
- 18:00Speaker 2: This Python node runs on the main PC the nu
- 18:04Speaker 2: SE and communicates with the launchpad, usually over a serial
- 18:07Speaker 2: connection like USB. It reads the raw sensor values the
- 18:11Speaker 2: encoder counts the ultrasonic distance is the IMU data that
- 18:14Speaker 2: the launch pad sends, gets the raw data yes, and
- 18:16Speaker 2: then it converts that raw data into standardized ROS messages
- 18:20Speaker 2: and publishes them onto the appropriate ROS topics like well
- 18:24Speaker 2: wheel or wheel ultrasonic distance emute data.
- 18:27Speaker 1: So it makes the low level data available to the
- 18:29Speaker 1: rest of the ROS system.
- 18:31Speaker 2: Exactly, and it works the other way too. It subscribes
- 18:33Speaker 2: to high level command topics from ROS, typically receiving desired
- 18:37Speaker 2: linear and angular velocities, and translates those back into the
- 18:40Speaker 2: specific motor commands that the launch pad understands and sends
- 18:43Speaker 2: them down over cereal.
- 18:45Speaker 1: Okay, so data flows up commands full down translated by
- 18:48Speaker 1: this driver node. Now, once that sensor data is flowing
- 18:51Speaker 1: nicely within ROS, how does the chef box start to
- 18:55Speaker 1: understand its own movements better and make sense of its
- 18:58Speaker 1: surroundings For navigation?
- 19:00Speaker 2: That's where the core intelligence lies within the sophisticated ROS
- 19:03Speaker 2: navigation stack. This is a collection of ROS packages that
- 19:06Speaker 2: provide the algorithms for autonomous movement.
- 19:09Speaker 1: A navigation stack. What's in it.
- 19:11Speaker 2: Several key pieces. First, it performs odometry calculation. It takes
- 19:16Speaker 2: the raw data from the wheel encoders and the IMU
- 19:18Speaker 2: and fuses them together to get a much more accurate
- 19:21Speaker 2: estimate of the robots position and orientation change over short periods.
- 19:25Speaker 2: This is its local sense of movement.
- 19:27Speaker 1: Fusing sensors for better odometry makes sense.
- 19:30Speaker 2: Then there are PID controllers, PID stands, for proportional integral derivative.
- 19:36Speaker 2: It's a classic control loop algorithm. There's usually one PID
- 19:40Speaker 2: controller per wheel.
- 19:41Speaker 1: What do the PIDs do?
- 19:42Speaker 2: They take the target wheel velocities calculated by the higher
- 19:45Speaker 2: level navigation logic and convert them into the precise motor commands,
- 19:49Speaker 2: like the PWN values needed to make the wheels actually
- 19:53Speaker 2: spin at those target SPADs, compensating for friction load, battery
- 19:57Speaker 2: voltage changes, etc. They ensure the robot executes movements.
- 20:01Speaker 1: Accurately, fine tuning the motor commands.
- 20:03Speaker 2: Got it, And here's that really a genius solution for
- 20:06Speaker 2: mapping we touched on earlier. Yeah, using the depth camera data.
- 20:08Speaker 2: There's an ROS package called depth image to Laser.
- 20:11Speaker 1: Scan right, mimicking lighter exactly.
- 20:14Speaker 2: It takes the three D point cloud coming from the
- 20:16Speaker 2: connector astra camera, Yeah, slices it horizontally at a certain height,
- 20:20Speaker 2: and converts that slice into a message that looks just
- 20:22Speaker 2: like the two D scan data you'd get from a
- 20:24Speaker 2: traditional laser scanner.
- 20:25Speaker 1: Clever trick.
- 20:26Speaker 2: Why do that because many of the most mature and
- 20:28Speaker 2: robust algorithms for mapping and localization in ROS were originally
- 20:33Speaker 2: developed for and expect input from two D laser scanners.
- 20:38Speaker 2: This package lets the chef bot use those powerful, well
- 20:41Speaker 2: tested algorithms even though it only has a cheaper depth camera.
- 20:45Speaker 1: Okay, super smart work round. So the chef bot now
- 20:48Speaker 1: has better odometry, it can control ease wheels precisely, and
- 20:51Speaker 1: it has this fake laser scan of its immediate surroundings.
- 20:54Speaker 1: But how does it then figure out where it is
- 20:57Speaker 1: within the whole hotel, build a map of that hotel
- 21:00Speaker 1: and plan how to get from say, the kitchen to
- 21:02Speaker 1: table five, all by itself.
- 21:04Speaker 2: Ah, the big picture. This is where we get into
- 21:06Speaker 2: simultaneous localization and mapping or.
- 21:08Speaker 1: SLAM SLAM heard that acronym a lot.
- 21:11Speaker 2: Yeah, it's fundamental to mobile robotics. It tackles that classic
- 21:14Speaker 2: chicken and egg problem. How do you build a map
- 21:17Speaker 2: of a place you've never seen before if you don't
- 21:19Speaker 2: know exactly where you are in that place? And how
- 21:20Speaker 2: do you figure out where you are if you don't
- 21:22Speaker 2: have a.
- 21:22Speaker 1: Map, right, it seems impossible. How does SLAM solve it?
- 21:24Speaker 2: SLAM algorithms like the g mapping package, which is commonly
- 21:28Speaker 2: used in ROS and mentioned in the book, do both
- 21:30Speaker 2: things at the same time as the robot moves around
- 21:34Speaker 2: using its sensors like our fake laser scan and the
- 21:37Speaker 2: improved odometry. G mapping incrementally build a two D grid
- 21:41Speaker 2: map of the environment and simultaneously estimates the robot's most
- 21:45Speaker 2: likely position within that map. They refine each other over time.
- 21:49Speaker 1: Wow. So it builds the map and figures out its
- 21:51Speaker 1: location iteratively exactly.
- 21:53Speaker 2: It's a probabilistic process, constantly updating beliefs about the map
- 21:57Speaker 2: and the robots post.
- 21:58Speaker 1: So practically, how do you actually create the map for
- 22:02Speaker 1: the hotel?
- 22:02Speaker 2: Typically you'd start the g mapping node, and then you'd
- 22:05Speaker 2: manually drive the robot around the entire area you wanted
- 22:08Speaker 2: to navigate, maybe using a keyboard a joystick to send
- 22:11Speaker 2: simple movement commands what's called tellyoperation.
- 22:13Speaker 1: Drive it around the hotel lobby and hallways.
- 22:16Speaker 2: Right as you drive it, G mapping builds the map
- 22:19Speaker 2: in real time. You can usually watch this happen in
- 22:21Speaker 2: a visualization tool like our viz. Once you've covered the
- 22:24Speaker 2: whole area, you save the completed map to a file.
- 22:26Speaker 1: Okay, map saved, Now what does it keep using? Slam?
- 22:29Speaker 2: Not usually for navigation. After the map is built. Once
- 22:32Speaker 2: you have a static map, you switch to a pure
- 22:35Speaker 2: localization algorithm. The common one in ROS is AMCL, which
- 22:40Speaker 2: stands for Adaptive Monty Carlo Localization AMCL.
- 22:44Speaker 1: What does that do?
- 22:45Speaker 2: AMCL takes the known pre built map and the robot's
- 22:48Speaker 2: current sensor readings again laser scans and odometry, and uses
- 22:52Speaker 2: a probabilistic method called a particle filter to figure out
- 22:55Speaker 2: the robot's most likely current position and orientation within that map.
- 23:00Speaker 2: It's very robust, even if the robot gets a bit
- 23:02Speaker 2: lost or kidnapped temporarily.
- 23:04Speaker 1: So SLAM for making the map, AMCL for tracking position
- 23:07Speaker 1: on the existing map, like the robot's indoor GPS.
- 23:10Speaker 2: That's a great analogy. Yeah, highly accurate indoor GPS using
- 23:13Speaker 2: the map and sensors.
- 23:14Speaker 1: Okay, So AMCL tells the chef bot precisely where it
- 23:18Speaker 1: is on the map. What then tells it where to
- 23:20Speaker 1: go and how to get there without hitting walls or people?
- 23:22Speaker 2: That is the job of the main navigation planner and
- 23:24Speaker 2: execution node, which in ROS is typically the move based node.
- 23:28Speaker 2: This is really the autonomous navigation brain. Move base the brain. Yeah,
- 23:32Speaker 2: it brings everything together. Yeah, it takes the map from
- 23:34Speaker 2: the map server. It takes the robot's current precise pose
- 23:37Speaker 2: from AMCL and it takes a target goal location like
- 23:41Speaker 2: the coordinates for a table five that you.
- 23:43Speaker 1: Give it Matt location goal right.
- 23:45Speaker 2: Then move Base uses sophisticated algorithms to plan a path
- 23:49Speaker 2: from the current location to the goal, making sure that
- 23:52Speaker 2: path avoids obstacles marked on the static map and any
- 23:56Speaker 2: new obstacles detected by the sensors in real time like
- 23:59Speaker 2: a person walking by.
- 24:00Speaker 1: So it plans a safe path, and then.
- 24:02Speaker 2: And then it starts executing that path, continuously sending the
- 24:04Speaker 2: appropriate speed commands those target linear and angular velocity. As
- 24:08Speaker 2: we mentioned down towards the robots motors via the PID
- 24:11Speaker 2: controllers and the driver, it constantly monitors progress, replans as
- 24:15Speaker 2: necessary if obstacles appear, and guides the robot autonomously to
- 24:18Speaker 2: the goal.
- 24:19Speaker 1: That's incredibly complex happening under the food.
- 24:22Speaker 2: It really is, Yeah, but it's amazing to watch it work,
- 24:24Speaker 2: especially when you use our viz, that ROS visualization tool.
- 24:27Speaker 2: You can see the map, the robot's position, the sensor data,
- 24:30Speaker 2: the path it's planning, even internal things like its cost
- 24:33Speaker 2: maps areas it calculates it should avoid due to proximity
- 24:37Speaker 2: to obstacles. It gives you a fantastic window into the
- 24:40Speaker 2: robot's mind.
- 24:41Speaker 1: Our vis for visualization sounds crucial for debugging too oh essential.
- 24:45Speaker 2: Now, what's really remarkable here thinking about the chefbot's purpose
- 24:49Speaker 2: is that for a robot like this to be actually
- 24:51Speaker 2: useful in a real hotel, it absolutely cannot rely on
- 24:55Speaker 2: someone typing complex ROS commands into a terminal.
- 24:58Speaker 1: In no way, the hotel staff, the waiters, they need
- 25:01Speaker 1: something simple, click and go exactly.
- 25:03Speaker 2: It is an intuitive, easy to use interface a GUI.
- 25:06Speaker 1: Right, a robot to UI. So what's the main purpose
- 25:09Speaker 1: there and what sort of tools did the book use
- 25:11Speaker 1: to build one for chef bot?
- 25:12Speaker 2: Well, the main purpose is exactly what you said, create
- 25:15Speaker 2: a simple control panel, abstract away all that underlying ROS
- 25:18Speaker 2: complexity for users who aren't robotics experts. For chef Bought,
- 25:22Speaker 2: the developers chose QT. Yeah. Qt is a very powerful,
- 25:27Speaker 2: widely used framework for building cross platform graphical user interfaces,
- 25:32Speaker 2: and crucially it has excellent Python bindings, specifically pi qt
- 25:36Speaker 2: or sometimes piside.
- 25:37Speaker 1: So you can build a GUI using Python yep, which.
- 25:40Speaker 2: Fits nicely since much of ROS development can be done
- 25:42Speaker 2: in Python. Two this combination QT with Piqute allows for
- 25:47Speaker 2: really rapid development. They even used a tool called Q Designer.
- 25:51Speaker 1: What's QT Designer.
- 25:52Speaker 2: It's a visual dragon drop tool. You can literally draw
- 25:55Speaker 2: your GUI place buttons, labels, textboxes, sliders, arrangement how you want,
- 26:00Speaker 2: and it generates the basic code structure for you.
- 26:03Speaker 1: Oh cool, So you design the look visually.
- 26:05Speaker 2: Yeah, it speeds things up tremendously.
- 26:07Speaker 1: Okay, so you can design a look, But how do
- 26:09Speaker 1: those visual elements like clicking a button that says go
- 26:12Speaker 1: to table five actually connect to the robot's ROS actions?
- 26:15Speaker 1: How does the code bridge that gap?
- 26:17Speaker 2: That's handled by Qt's core mechanism for event handling, which
- 26:21Speaker 2: is called signals and slots. It's a really elegant concept.
- 26:24Speaker 1: Signals and slots explain.
- 26:25Speaker 2: Okay, So a signal is something that a GI element
- 26:29Speaker 2: emits when an event happens. For example, a button emits
- 26:33Speaker 2: a clicked signal when the user clicks it.
- 26:35Speaker 1: Okay, button click emits a signal.
- 26:37Speaker 2: Right. A slot is simply a Python function that you write.
- 26:40Speaker 2: You then connect a specific signal to a specific slot.
- 26:43Speaker 2: So you connect the buttons clicked signal to your Python function,
- 26:47Speaker 2: say handleg button click when the button's clicked, its signal
- 26:50Speaker 2: was emitted, and QT automatically calls your connected slot function.
- 26:55Speaker 1: Ah okay, signal triggers the function the slot exactly.
- 26:58Speaker 2: So you design the look in U designer, which saves
- 27:01Speaker 2: it as a dot UI file. You then use a
- 27:03Speaker 2: command line tool POK four or piside two WIC to
- 27:06Speaker 2: automatically convert that dot ui file into Python code that
- 27:09Speaker 2: creates the GUI elements. Then you take that generated Python
- 27:13Speaker 2: code and you add your own logic. You write the
- 27:16Speaker 2: slot functions that actually do things with the robot when
- 27:18Speaker 2: signals are emitted.
- 27:19Speaker 1: So visual design gets converted to code. Then you add
- 27:22Speaker 1: the robot control logic into those slot functions percisely.
- 27:25Speaker 2: It's a very abavia of workflow.
- 27:26Speaker 1: Okay, so let's put it all together. Then for the
- 27:28Speaker 1: chef bot, how does this actual user friendly GUI the
- 27:33Speaker 1: robotw dot PI application tell a chefbot to actually go
- 27:37Speaker 1: to table five?
- 27:38Speaker 2: Right? So, the chef bok control GUI application robot dot
- 27:41Speaker 2: PII is designed to be simple. It likely shows some
- 27:45Speaker 2: buttons maybe number to zero through nine representing home base
- 27:48Speaker 2: and different tables defined in the hotel map. The user
- 27:52Speaker 2: selects a table number, say five, and clicks a go.
- 27:54Speaker 1: Button click five click go yep.
- 27:56Speaker 2: Now, internally, that GI application is acting as action lib client.
- 28:01Speaker 1: Action lib another ROS thing.
- 28:03Speaker 2: Yeah. Action lib is a standard ROS library specifically designed
- 28:06Speaker 2: for handling tasks that take time to execute, might need
- 28:09Speaker 2: to provide feedback along the way, and might need to
- 28:11Speaker 2: be canceled, like navigating to a goal.
- 28:13Speaker 1: Perfect for robot navigation exactly.
- 28:16Speaker 2: So the GUI the client takes the pre defined map
- 28:18Speaker 2: coordinates for table five it's xy position and maybe the
- 28:21Speaker 2: orientation of the robot should face when it gets there,
- 28:23Speaker 2: bundles them up into a move based goal message and
- 28:25Speaker 2: sends this goal to the move based note we talked
- 28:27Speaker 2: about earlier. In this interaction, move base is acting as
- 28:30Speaker 2: the action lib server.
- 28:31Speaker 1: Client sends goal to server, got it, and.
- 28:34Speaker 2: This action lube architecture handles all the communication. The server
- 28:39Speaker 2: move base accepts the goal, starts executing the navigation, and
- 28:43Speaker 2: can send feedback periodically back to the client the guy
- 28:47Speaker 2: like how far along the path it is, and the
- 28:49Speaker 2: client can also send a cancelation request if needed.
- 28:52Speaker 1: Ah. That's a really robust way to manage those longer tasks.
- 28:56Speaker 1: So if something unexpected happens, like a big spill blocking
- 28:59Speaker 1: the path, the staff member can just hit cancel on
- 29:02Speaker 1: the GUI.
- 29:02Speaker 2: Precisely, the GUI would have a cancel button that sends
- 29:05Speaker 2: a cancel request to via action lib to move base.
- 29:08Speaker 2: It probably also has a home button that sends a
- 29:10Speaker 2: goal for the robot's pre defined charging station or a
- 29:13Speaker 2: base position.
- 29:14Speaker 1: Makes sense, simple task oriented buttons.
- 29:16Speaker 2: Yeah, and to make it even more useful, the GOOA
- 29:19Speaker 2: can also provide real time status information. It might subscribe
- 29:22Speaker 2: to ROS topics or parameters that report the robots current
- 29:25Speaker 2: battery level or its overall status like navigating, idle charging,
- 29:30Speaker 2: and display that directly.
- 29:31Speaker 1: On the screen so the staff know what it's doing
- 29:33Speaker 1: and if it needs charging.
- 29:34Speaker 2: Very practical, exactly Now, that's the user facing GI. But
- 29:38Speaker 2: for developers or for more detailed monitoring and debugging, ROS
- 29:42Speaker 2: provides another powerful QT based tool called rqt.
- 29:46Speaker 1: Rqt. What's that?
- 29:47Speaker 2: Rqt is basically a framework for hosting various GUI plugins
- 29:53Speaker 2: within a single window. You run rqt and then you
- 29:56Speaker 2: can open up different tools as panels within.
- 29:58Speaker 1: It, Like what kind of tool?
- 30:00Speaker 2: Oh, lots of useful ones. Yeah, there's an arcut console
- 30:02Speaker 2: plug in. Unless you see all the log messages, debug info,
- 30:05Speaker 2: warning error coming from all the running ROS nodes, super
- 30:08Speaker 2: helpful for tracking down.
- 30:09Speaker 1: Problems central console. Nice.
- 30:12Speaker 2: There's an RQ topic monitor where you can see a
- 30:14Speaker 2: list of all active ROS topics, inspect the data being
- 30:17Speaker 2: published on them in real time, even see the publishing.
- 30:19Speaker 1: Rate, see the raw data flow yep.
- 30:21Speaker 2: And maybe most relevant to navigation, there's often an integrated
- 30:24Speaker 2: r viz plug in sometimes called the Navigation Viewer or
- 30:27Speaker 2: similar that lets you embed that powerful three D visualization
- 30:31Speaker 2: right inside your RQ window. You can see the map,
- 30:33Speaker 2: the robot, the sensors, the planned path, all alongside your
- 30:36Speaker 2: console and topic monitors.
- 30:38Speaker 1: Wow. So RQT is like a developer's dashboard for the robot.
- 30:41Speaker 2: That's a perfect way to put it. An incredibly flexible
- 30:44Speaker 2: and powerful dashboard for monitoring, debugging, and interacting with the
- 30:49Speaker 2: running ROS system.
- 30:50Speaker 1: Okay, so stepping back, we've taken quite a deep dive,
- 30:54Speaker 1: haven't we, into this journey of creating an autonomous service robot,
- 30:58Speaker 1: the chefbot. We went from the foundational software the Robot
- 31:01Speaker 1: Operating System ROS, through the nitty gritty of mechanical and
- 31:05Speaker 1: electrical design into sophisticated simulation. Intelligent navigation algorithms like SLAM
- 31:11Speaker 1: and AMCL and finally even building a user friendly graphical interface.
- 31:16Speaker 1: We've really seen how all these complex engineering pieces have
- 31:19Speaker 1: to come together to build a functional, intelligent machine.
- 31:22Speaker 2: Absolutely, and stepping back even further, I think this deep
- 31:24Speaker 2: dive really showcases the profoundly interdisciplinary nature of modern robotics, doesn't.
- 31:29Speaker 1: Yep, It's not just one thing, not at all.
- 31:32Speaker 2: It highlights that building advanced robots isn't about expertise in
- 31:36Speaker 2: just one area. It's about this seamless integration of so
- 31:39Speaker 2: many different fields mechanical engineering, electrical engineering, software engineering, control theory, AI.
- 31:45Speaker 2: And what's really enabling this convergence, I think, is the
- 31:48Speaker 2: modularity offered by frameworks like ROS, and the incredible accessibility
- 31:53Speaker 2: of powerful open source tools, from the OS and ROS
- 31:57Speaker 2: itself to CAD software, simulators and life libraries. It means
- 32:01Speaker 2: creating these complex systems is genuinely more achievable now than
- 32:05Speaker 2: ever before for students, hobbyist startups, not just huge corporations.
- 32:10Speaker 1: That's a great point, democratizing robot development in a way.
- 32:13Speaker 2: In a very real way.
- 32:14Speaker 1: Yes, so let's leave our listeners with something to think about.
- 32:16Speaker 1: A final provocative thought maybe okay.
- 32:19Speaker 2: Well, consider this as robots like the chef Butt become
- 32:22Speaker 2: more and more commonplace, moving around us in hotels, hospitals, warehouses,
- 32:26Speaker 2: maybe even our homes. And as they move beyond just simple,
- 32:29Speaker 2: repetitive tasks towards more complex interactions, what new ethical and
- 32:33Speaker 2: social considerations start to emerge?
- 32:35Speaker 1: Yeah, that's a big one.
- 32:37Speaker 2: How will the transparency here maybe a lack thereof, in
- 32:40Speaker 2: their design and decision making processes shape our trust in them?
- 32:44Speaker 2: And how much will the simplicity or maybe the complexity
- 32:47Speaker 2: of their interfaces how we interact with them influence our
- 32:49Speaker 2: acceptance of these increasingly intelligent autonomous systems sharing our daily lives.
- 32:54Speaker 2: Something to chew on