Modern cars have become mobile computer systems with many small computers running millions of lines of code.
On this episode, we plug a little Python into those data streams.
You'll meet Shea Newton, who is a Python developer and who has worked on autonomous cars and is currently at ActiveState.
This is Talk Python to Me, episode 255, recorded February 25th, 2020.
Welcome to Talk Python to Me, a weekly podcast on Python, the language, the libraries, the ecosystem, and the personalities.
This is your host, Michael Kennedy. Follow me on Twitter where I'm @mkennedy.
Keep up with the show and listen to past episodes at talkpython.fm.
And follow the show on Twitter via at Talk Python.
This episode is sponsored by Datadog and Clubhouse.
Please check out what they're offering during their segments. It really helps support the show.
Shea, welcome to Talk Python to Me.
Hi, thank you for having me.
It's great to have you here. And by have you here, I mean literally have you here.
I've done a few recordings on location in Portland, but this is live from the Talk Python studio, right?
Yeah, great setup. I'm happy to be here.
Yeah, thanks. I'm really happy to have you here as well.
It's going to be a lot of fun to talk about cars.
When I grew up, cars were these like dirty, greasy things.
I hated work on cars.
Like probably I would have done different stuff with my life if I didn't hate working on cars so much.
I actually used to race motorcycles and we would rebuild engines and we would take them apart.
And it was ridiculous.
Those things had to be rebuilt like every month the way they worked.
Luckily, it was not very expensive, the parts.
So I didn't really hate mechanics, but I don't know, I always just would bang my hand.
Yeah, yeah.
I just didn't like working on cars. I always admired people who could, but I was really good at computers.
And now cars are computers?
Yeah, yeah.
Is that how it is?
Yeah, I think people are out there hacking in the grease and in the computer of their car too.
Yeah.
Yeah, yeah.
Super cool.
Yeah, absolutely.
So that's the topic for the show today is to talk about talking to your car with Python, which I think is going to be real fun actually.
Yeah, yeah.
Nice.
Now, before we get to that, of course, let's start with your story.
How did you get into programming in Python?
Yeah, I went to the University of Idaho for a computer science degree.
It was just something that was itching the back of my brain that I wanted to learn how to do.
And yeah, I jumped straight into it.
Today, I work for ActiveState as a developer advocate, and I'm actually just kind of out spreading the word a little bit about what cool things that they're working on.
Yeah, well, tell us what a developer advocate does.
Yeah, good question.
Yeah, so some of the day-to-day for me is reaching out to open source communities, maintainers, just about ways that ActiveState can work with them, about the cool things that they're doing.
Developer advocate, reach out, talk to the community, talk to open source maintainers.
My impression is that there's like these different roles that developer advocates play, and they can vary really dramatically.
Sometimes that's giving speeches at like conferences or user groups.
Maybe it's like, I'm going to travel on site to a customer site, and they're trying to adopt some technology, and I'm going to sit with them, almost be like a drop-in consultant expert.
There's also the ones who maybe write blog posts or whatever, like all of the above.
I don't know what you're doing.
Yeah, a little bit of all that.
There's some blog post writing.
I was just at the Developer Week 2020 conference in Oakland.
I'll be at Interop in Austin later this year.
Yeah, just kind of toes in a lot of the communication sides of the work.
Yeah, it's not the main topic, but what do you think the qualifications are?
And also, I should maybe just throw out there, back in episode numbers, escaping my mind, I did an episode with Paul Everett, Matt McKay, Cecil Phillip, about being a developer advocate for their different companies.
So if people really want to dive into it, they can go check that out.
But what do you think the qualifications are?
How do you go from, yeah, I can get this code to compile, or I can write a website in Blask.
Now I'm representing the company as like an expert.
Yeah, yeah.
In a public forum.
In a public way.
I think part of it is an empathy for the developer.
I think there's the technical know-how, but there's two sides of like what even developer advocate might mean.
So there's advocating to the developer from the company, but there's also advocating for the developer internally.
Almost being a channel from the community back to the team.
Yeah, and saying this is the kind of thing that's important.
This is the kind of thing that people are actually needing to use it for, the problems that they've come up against.
And I think that that's something that I like to bring to the job.
Well, it sounds like a really fun job.
Thanks, yeah.
Now, you told us you got into programming at Idaho, University of Idaho.
What, University?
Yeah, University of Idaho.
University of Idaho.
Okay, cool.
And how about Python?
How'd you come to that?
So even kind of in the earliest days, so that curriculum was kind of based on C and C++.
But as I moved through the program, Python just showed up as the glue that held things together along the way.
And quick scripts, rapid development for things that we were working on outside of class, independent projects.
And the longer I was in the world of programming, the more Python showed up as this glue between things.
And sometimes I was able to devote a whole project to it.
And sometimes it was just one-off things that I learned as I went.
This is an interesting take.
I definitely think that Python is much more applicable because it can consume or glue together these other things, right?
Yeah.
I was just talking to somebody and they were talking about, it's really cool that we can take Python and we can then hide away really old Fortran code for linear algebra.
Or we can hide away the C library that nobody really wants to work with.
But we can use the C API to create a package around it and no one has to know.
But it's like 50-year-old tested code that nobody can get to work, but it doesn't matter.
I think that's so powerful.
Yeah.
I think that another thing that's interesting is, well, my sort of hypothesis is that companies that say that they develop in maybe Go or C or some other language, if you ask them if they are also using Python, I'm almost certain that they'll all say, oh yeah, Python 2.
You know?
Right.
Yeah.
It's just there.
It's just so ubiquitous.
Nice.
Yeah.
It's very cool.
So you just saw it showing up everywhere.
You're like, I probably need to know this.
Yeah.
I need to get much better.
Yeah.
A little bit like you have to know JavaScript if you're going to work on the web.
Yes.
Yeah.
Absolutely.
Super cool.
Okay.
So that's a little bit about you.
There's a couple of angles I want to take here all around talking to cars with Python.
First, let's start with science fiction.
Yeah.
That's kind of not science fiction.
Sure.
I mean, it feels like science fiction.
So to me, when I was in school, when I was in college, you know, I took just a couple of
programming classes for some requirements, not a CS degree, but to me, it felt like artificial
intelligence.
It was people working in Lisp and they were trying to pass the Turing test.
Like if you have a chat, literally a text chat with my program and you are tricked into
thinking it's a real human, well, then it must be real.
Right.
Yeah.
And that, you know, never really worked very well.
One.
Two, it was not very impressive.
Right.
And then, you know, it felt like AI was never really going anywhere.
And then all of a sudden, you know, we rented a Tesla, not too long, just for a few days.
And it was just driving around on its own in traffic.
Like that is really far from.
Yeah.
It's incredible.
I can have a text chat.
That kind of works.
Yeah.
Right.
It's so that's why I say science fiction, because I feel like, you know, that part of science
fiction is kind of arrived.
Yeah.
We're seeing a lot of incredible advances.
And I think that machine learning and artificial intelligence is accelerating that.
Absolutely.
Yeah.
And you think Python is.
It's the de facto way to go about that for sure.
Really?
Yeah.
In my mind.
Yeah.
For yeah.
handling data for machine learning.
I mean, the libraries are out there.
It's just super powerful tool for that.
Now, you did a little bit of work around this kind of stuff.
Can you give us a sense of just like what kind of libraries might be involved or like what
kind of even just what kind of code do we better write?
What kind of sensors are there?
Like what's that world look like as a developer?
Oh, yeah.
For cars specifically.
For Python, there's a layer on top of Ross called Rosspy, which is an incredible platform
for talking to sensors and collecting data.
So sensor data, get a view of the world around you or actuating controls on a robot that Python
has.
So Ross is the robot operating system.
Yeah.
And Rosspy is the Python API for talking to Ross.
Yes.
So part of the way this might work is you just treat the car like a robot.
Yeah, absolutely.
I think that we can, as our cars, like you said, get more and more like computers.
And as we want computers to drive them, they're just robots.
Yeah.
Well, you know, jumping just a little bit ahead to some of the stuff, we'll come back to this
self-driving a bit more maybe.
But we were talking earlier about just can we quantify how much this is true or not true
about whether cars are like computers.
And if you go by lines of code, it's definitely in the realm of computers.
Absolutely.
Lots and lots of lines of code.
Random modern car, what would you say?
Yeah.
Too many to count.
Too many for one person to manage.
So I did a quick search earlier.
And I, you know, according to Google, I'm not sure exactly what it's basing this on.
But it says that the modern car with their infotainment and their cloud stuff and all
that sort of thing, it says uses basically a hundred million lines of code.
That's boggling.
Yeah.
So that apparently comes from Wired.
So to give you a sense, that's 5% as much code as all of Google as a company, like all
of their services.
Yeah.
That's wild.
We also looked, and if you look at Windows 10, Windows is not typically accused of being
like a thin, bloat-free operating system.
I mean, neither is macOS either, really.
But it's definitely not considered like a lightweight, like mini operating system, right?
Yeah.
It's the real deal.
Well, Windows 10 has 50 million lines of code.
So the modern car, we're not talking self-driving Tesla or nothing.
We're talking like Kia or something, right?
Yeah, absolutely.
A hundred million lines of code.
That's a serious bit of programming.
Yeah.
It's the, yeah.
Incredible effort of decades.
Yeah.
So it's pretty interesting just to think of how much computation is going on.
Also, I think I heard somewhere that there's not just like a central computer, but there's
a bunch of little micro computers and they need to interact with each other, right?
Yeah, absolutely.
Absolutely.
Little computers all over the car that are talking to each other in their own sort of protocol
or the CAN protocol, which is the premise for that.
I wonder if car technology had been adopted later.
You know, how much would this just look like microservices with discovery?
Yeah.
Great, great question.
Right.
Because it's not JSON buzzing around the wire, is it?
No, no.
No, it's just raw bytes.
Yeah.
Which is fine for performance and stuff, but I have no idea what the connectivity, like the
network cabling between these little micro computers are.
But there's a ton of computation going on in these cars, right?
Yeah, absolutely.
Every, I mean, from the big stuff, like pushing the brake pedal to the little stuff, like turning
on an overhead light, everything is in a modern car is letting it so, the car's aware of it
in many places when you do things like that.
Right.
I mean, traditionally, older cars, maybe there's some little micro controllers in like an eight
set, eight track cassette player or something.
But when you push on the brake, that pushed directly on a lever, which pushed on some hydraulics,
which then pushed on a cap, the brake cap, whatever they're called.
See, I don't work on cars.
And it makes it stop, right?
Creates friction, heat goes in the air, car stops.
But now, not so much.
I mean, it's like all the stuff that you do, turning on windshield wipers, like my car is
fly by wire, right?
Yeah.
Like I push on the brake, I push on the gas, and it interprets what that should mean for
it to go.
Yeah, absolutely.
It does.
So there's a lot of data zooming around, right?
Oh, yeah.
Yeah.
So you gave a talk on this at Portland PDX Python meetup, right?
Yeah, yeah.
Yeah, that's cool.
And I'll definitely link to the video that was recorded there.
And I'll link to that video there.
But you had this graph of like all the data going along as just a Kia, some kind of Kia
Nero or something.
It was accelerating, right?
Yep, yep.
Just the data that you have to, the noise you have to filter through.
And just what the bytes look like as you're looking at activity grow.
Yeah.
Right.
Yeah.
Super cool.
Let's talk about that for a while.
Let's talk about talking to cars.
Surprising, not surprising?
I don't know.
It's a little surprising to me, I guess.
But cars generally have the same architecture for like their communication protocols and their
hardware and stuff, right?
My understanding is that cars at least have to have an interface for this OBD2 port, whether
that's an international or a federal standard, I can't remember.
But a way for things like emissions tests to plug in and pull the vehicle for data, very
specific data.
So there's that.
And most cars are still using this CAN protocol and this CAN bus.
I think that that's pretty much the standard over these things.
Right, right, right.
And I suspect that's largely due to the suppliers and the OEMs.
If you're going to make a car, you don't make the brakes from scratch necessarily.
Maybe you buy them from Bosch or you buy them somewhere else.
And those things will have to be interoperable.
And they do.
And there's also a history of things already having safety qualifications.
So the work that's involved in having a new technology brought into a car is incredible.
And so if something already exists that has the safety rating for it, it can be very cost
effective to just maintain.
Right.
It's almost like medical, right?
It's like once this thing's approved, it's a huge barrier to dethrone it or whatever because
you've got to take anything new.
I can imagine that.
So OBD, onboard diagnostics, if you get your registration renewed in a lot of places in Oregon,
where we are in California and probably places in Europe, you've got to yearly, every couple
of years, have your car evaluated to see how well it's doing.
Yeah.
So those places, when I had a car that burned fuel, I don't know anymore, but I did.
We would go there and they would plug it in and they would put me in this little closet
thing and say, wait, wait for five minutes.
So the car would like run and stuff would happen.
And then they would unplug it and they would say, okay, you can go or you can't.
You know, you got to go get this thing fixed or whatever.
So that's kind of some of the stuff that we're talking about, right?
They're plugging into the same thing that we could talk to you with Python.
Yeah, absolutely.
So the talk that you mentioned was specifically about using that OBD port to pull your vehicle
for information, unpack and get a better look at it.
Things like your emissions tester is plugging into that port using the accessible data.
There's also, I think the insurance companies are doing some driver monitoring.
Yeah, absolutely.
My daughter recently went through this.
She's going to be 20.
She's 19 now.
And she bought her own car and her insurance was surprisingly expensive for her.
She's like, whoa, this is pricey.
But her insurance company did offer like, we will send you this dongle thing.
You can plug into your car and it will monitor all sorts of things.
It'll monitor your braking rate, your acceleration rate, your turning and like all these things.
And then we'll give you a price based on analytics.
Yeah.
How well do they think you drive?
To me, I was like, there's no way that's going in my car.
Yeah.
Like, forget this.
Like, I'm an adult.
I don't need that thing.
But it turns out it was only there for two months.
And then they said, okay, we've got enough information.
You can return it now.
Okay.
So it's like a-
Evaluation or something.
An evaluation period.
It's not like you permanently, at least for her company, you didn't permanently install it.
But yeah, they were plugging, I guess, into the same data.
Yeah.
That's my impression.
There's a lot of applications for it.
I think just looking at the Wikipedia page or something, it's a little, makes my eyes glaze
over a little bit because it's so specific and particular.
But there's also companies, there's one that I remember called Kama AI, I think that gives
you a tool to plug in there and it helps visualize and represent that data in a little less eye
glaze over way.
Yeah.
Okay.
Yeah.
Super cool.
This portion of Talk Python To Me is brought to you by Datadog.
Let me ask you a question.
Do you have an app in production that's slower than you'd like?
Is its performance all over the place?
Sometimes fast, sometimes slow?
Now here's the important question.
Do you know why?
With Datadog, you will.
You can troubleshoot your app's performance with Datadog's end-to-end tracing.
Use the detailed flame graphs to identify bottlenecks and latency in that finicky app of yours.
Be the hero that got that app back on track at your company.
Get started today with a free trial at talkpython.fm/Datadog.
If we're going to talk to it, it's one thing to get a package, a little IoT thing from whatever insurance company.
They say, find the hole that looks like this and jam it in.
It would do crazy things.
It would beep at you if it detected a bad driving experience.
You're like, beep, beep, beep.
Oh, no.
There goes money permanently.
Anyway, instead of that, if we want to talk to it, when I'm thinking OBD2 or CAN bus, I'm not thinking USB-C or Bluetooth or wireless as the plugin.
So how do I plug in something that talks Python into this?
Yeah.
So basically with the right cables, you can set it up to just go from the USB on your computer.
When I developed this program, it was just using Ubuntu 18 Linux machine.
Plugs to, what is it, RS-232, something like that.
Like the serial port equivalent.
Yes.
And then that converts to the specific OBD2 port.
And from there, my kind of half joke is that talking to the car with Python is as easy as any other IO.
Like if you've ever written to a file, opened a file and written to it and read from it, that's the equivalent of what you have to know how to do for communicating with your car.
Okay.
Once you get that all connected, that sounds pretty easy.
You just open up something different to talk to the port that it's on or something.
Exactly.
Yeah.
So in Python, the way you talk to files, create a with block.
Open, you give it the file name.
What is it, like with car?
Or like, how do you do it?
Yeah.
What's the libraries for talking to the car?
Yeah.
So talking to the car, there's just a library called Python Can that's made to interface with Can Networks.
And you just call open on it.
Yeah.
Okay.
Awesome.
So it really is kind of similar.
Open, right.
Yeah.
And then is it kind of like streaming data?
You just say I'm reading from it and as soon as it sees a byte, it just kicks it out?
Or how does it work?
Something like that?
You can pull for specific information or you can listen to streaming data and grab, I think it's called a PID.
I'm not sure if that's the same process ID or not.
But yeah, you can ask it for information and you can listen for information.
So the example program that I'd written up asks for the standard, the version number of the standard that you're looking at in your vehicle.
I see.
Yeah.
So you got to figure out what the communication protocol version is.
Yes.
So you know what the message is.
Because things change.
Yeah, for sure.
And when you're dealing with the low real estate of bytes packed on the wire, things are subject to change in ways that break the math to unpack them.
So you have to be careful.
Okay.
Yeah.
So a lot of what's exchanged are hand data frames.
Is that what they're called?
Yeah.
So these are like eight byte packets and you just have to figure out what they mean?
Yeah.
That's where kind of the standard comes in handy.
So typically it will say you have these eight bytes and in order to do what you need to get out a floating point number, there's a bit shift operation and a division and some scalar to multiply it by.
The first two bits indicate the message type.
Yeah.
The second two bits indicate like where it's or something like that.
Yeah, totally.
Where you got to go and like it's ultra packed.
Yeah.
Okay.
I'm telling you, if this was created today, this would just be Jason.
Yeah.
But it's built in a time.
I don't know when this first came out, but it's got to be like 80s.
Oh, I think it goes back further than that.
You think so?
Okay.
Yeah.
The computing power, they probably like, you know, we can't send the name over.
We can send a bit.
Yeah.
That's where we're going to set the bit.
Interesting.
So there's probably some higher level APIs and packages as well that given one of those frames or information.
There are.
My example was just the program I'd written was just a hands-on go do it yourself.
Hack on your car or listen to what your car is saying.
Python does have an OBD package for doing this stuff specifically.
If you want to level up and start collecting that data or writing your own applications for it.
Right, right, right, right.
Well, that sounds pretty awesome.
I can imagine a bunch of fun use cases.
Now, you said that maybe Tesla doesn't work with this format because some of the, at least it maybe doesn't have one of these ports, for example, potentially, because the purpose is gather like emissions data.
Yeah.
If you don't have emissions, you're like, well.
I remember some press coming out a while ago about at least one model of Tesla that people noticed that there wasn't an OBD2 port for.
And yeah, from what I could understand is that they didn't have to pass emission standards.
So there was no reason to enforce it.
Right.
That they had that where other cars do.
But I think recent Teslas, they've decided to incorporate it back.
I see.
Just to have some compatibility.
I'm sure the native internals in Tesla are probably much more modern.
Yeah.
There was some company, I think Japan, did like a teardown of a Model 3.
It was like a car OEM manufacturer.
Like they made transmissions or brakes or something.
And they realized that for Tesla cars, there were many, many more parts that were from Tesla rather than third party parts.
Interesting.
And basically their self-driving technology was all like Tesla chips and whatnot.
And they were basically concluding like Tesla is like six to seven years ahead because instead of waiting for all these OEMs to come along, there's like, no, they're just building it.
And there's nobody they depend upon.
That's why we are built like on this house of cards type of thing for all of our suppliers.
So yeah, yeah.
Pretty interesting.
I'm sure there's different ways you can talk to Tesla as well.
But these car companies, they don't like you to talk to their software.
So some are pretty protective.
There's the public CAN bus that's easy to tap into that has the OBD2 port.
And then there's private CAN networks that are a little more invasive to get into.
Okay.
They're not publishing in easy to find places how to unpack those bites.
But there are cars like I think Lincoln has a car called the MKZ that you can buy a kit for.
And I think it's actually like supported by Lincoln or they, yeah.
Endorsed somewhat.
And it's for by wire control.
It's for just hooking it up for autonomous vehicle testing.
So at least Lincoln has seemed to have opened the door to this kind of stuff.
Wow.
That's pretty interesting.
I guess you have to have something that will actually do the steering on the steering wheel.
Like it's got to have a little bit of like lane assist or something.
Yeah.
That's an interesting thing.
Or how else are you going to make it like turn the wheel and press the brakes?
There's one of the two organizations in Europe is doing, or last time I checked, was doing testing with actual robots in the car.
So like an actual kind of humanoid shaped thing that would turn the.
It pushes its leg.
Yeah.
It pushes the gas.
Yeah.
It rotates the arm where there's a rotating front thing.
Yeah.
There's a lot of approaches to it.
I think a lot of people are getting creative on how to do it, especially in cars where they don't necessarily have permission by the manufacturer to do it.
They're like, you know.
We don't need to get some of those expensive cars.
We're going to get used, whatever, and just put the robot in it.
Yeah.
And it'll be fine.
Well, it sounds kind of crazy, but at the same time, right, that cars are meant to be operated that way.
Yeah.
And so pretty high fidelity for driving.
Interesting.
Yeah.
Well, I remember when I bought my car, we had to sign that we would not affect or modify or attempt to circumvent any bit of the software.
Yeah.
So if you change this, one, your warranty is voided.
Two, we're going to be real angry.
Yeah.
The anti-lock brakes, the lane assist, the airbags, all that stuff.
They're like, stay away.
Oh, yeah.
It's a big, big do not try at home kind of situation.
Like, the stakes are very high.
Yeah.
But there's some stuff, like, definitely reading the data, it seems like it's kind of okay.
Oh, yeah.
So as far as do not try at home, trying to affect a change in your car or, you know, cutting a cord and tapping into the private canvas or something like that's something I wouldn't recommend as an at-home thing, right?
But, yeah, the data from the OBD2 port is just public access.
It's just read data or request something specific.
But, yeah, it's your data.
It's something that they're doing, that they're obligated to do.
Yeah.
And it's yours to take.
Yeah, I mean, obviously, the insurance companies are doing it without real permission.
So what kind of use cases do you see here?
Like, there's the diagnostic side of things.
There's the insurance side of things.
But I feel like there's probably some fun data science that you could do there.
Yeah, it's got to be.
Yeah, it does seem like for the data curious, there's a lot of interesting data to collect.
About your own driving patterns, about the fuel efficiency of your car.
I just learned about some communities of people that are just trying to maximize their car for fuel efficiency with interesting fins and that kind of thing.
And probably the data around how your car is behaving from something like this port would give you a little more insight into optimizing for things like that.
Yeah, I would think so.
I mean, that's definitely one of the first use cases I imagined was, well, maybe we could create our own little dongle that would create that data.
Then we'd throw it into pandas and we'd start answering interesting questions and maybe even some ML models to say, people who drive like this, like, this is the most important thing for fuel efficiency.
Yeah.
Besides not just stomping on the gas, stomping on the brakes, right?
But, like, maybe there's something that people are not totally clear about for certain vehicles.
Or, I don't know, it just seems like a fun little research project.
Yeah, I agree.
I'd be fascinated to see where that stuff, where a project like that would go.
It seems like often when you set machine learning to a task, the things that it finds for you are wild and surprising.
Yeah, they can be totally surprising.
So, yeah, I think it'd be fun to do some data science.
What do you think about IoT type stuff?
Like, what kind of devices could we build and then stick on that port, right?
Like, Raspberry Pi, maybe?
Well, with the right cables, you can hook up a Raspberry Pi for sure.
I mean, like I said, that Linux computer I had, you can...
You have power in the car, so you just wire that, like, to your, you know, maybe to a fuse or over to just, like, plug it into the cigarette lighter.
Yeah, yeah.
Who uses those anymore.
One of the incredible things about Python is that basically it just works everywhere, right?
I mean, it's the community and the development of the language has been awesome, and it's multi-platform.
And so, if Python can run on it, you can listen to what your car is doing.
I wonder if you could get MicroPython or CircuitPython to work.
That's a whole other level of small.
That goes from Raspberry Pi to $5 microcontroller.
It seems to me like one obvious requirement, which I honestly haven't done enough with, but I think it would work, is if you just had USB support for that adapter, right?
Yeah.
And, you know, I have a CircuitPython, I don't know, it's laying right here somewhere, and it has a little micro USB to, like, communicate with the computer and, like, to, like, write code on it and stuff.
So, potentially.
Yeah, yeah.
Potentially.
Yeah, something to collect on.
Yeah.
Okay.
Well, yeah, I think it would be super fun.
I'm not sure I want to mess with my car or not, but it definitely sounds like if I was looking for a cool little IoT project, you know, this is something that it might be really cool to plug into.
Yeah, yeah.
I think just listening, getting a feel for what the data looks like, just at that level, is kind of fascinating to me.
But then starting to unpack and look at the way your vehicle talks.
But, yeah, then taking it to an application would be, yeah, could be a great direction.
You know, if people are looking for, like, a science fair project.
Oh, yeah.
Or something, like, all right, well, we're going to ask, you know, some of the parents to install this on their car.
Well, so you don't have to install anything.
So you don't have to put software on your car.
No, I mean, like, just plug in the thing into the port.
Oh, gotcha.
Yeah, yeah, yeah.
Just that on its own is a little spooky, like, yeah.
Yeah.
You're like, I don't really want to put that in my car.
I'm sure there's some parents, though.
They're like, but my kid wants to do data science.
Yeah.
We'll plug this into the car and see what happens.
I heard something a while ago that it might be spookier to plug a USB into your car sometimes.
I don't remember what vehicle it was, but somebody installed Doom to play on their little console.
On their little infotainment console?
Yeah, because you could just put something that said runmecar.exe or something.
Yeah.
Yeah, it must be like a specific infotainment center or a specific car.
Yeah.
That was some easy, quick way.
Yeah.
So just plugging in anywhere in your car has some, your car's listening and it's trying
to decide if it's something it needs to do something about.
A lot of times it figures out, is it like some sort of audio device it can play and put
up on the screen or whatever?
And if it has a runme.exe and it's going to run it, that's a little confusing.
Yeah.
I bring that up just because I think that plugging in and listening to the port for your diagnostics
is like no more invasive than it would be to...
I would suspect it's less, right?
If that port is read-only.
Yeah.
Right?
As opposed to...
It's a really good point.
I mean, it's definitely a little nerve-wracking to plug any USB thing into anything else.
Yeah.
Because you don't know, right?
It could have, you know, Windows has that, like, it'll try to like boot up certain types
of things if it's in there and probably Mac does as well.
And yeah, you don't want to put that in untrusted places.
Super cool.
So let's maybe dive into a little bit more about the RossPi stuff.
So with the diagnostics thing, you can definitely, you know, see what's happening, right?
The brakes were applied, the car did this or that and so on.
With RossPi, it's more like, like we said, like kind of like a robot, right?
Yeah.
So I think a lot of companies that are doing research and development or maybe even just
development for autonomous vehicles and robots are using Ross.
It is really powerful for data collection.
So what we've been talking about so far really is just about collecting and analyzing and visualizing
and drawing inferences from data, right?
Yeah.
But RossPi probably could also take actions.
For sure.
It could.
And I think the power of like RossPi over just Ross is the ability to kind of rapidly
develop in much shorter amount of code and also to hook into these like super powerful
machine learning and data analytics libraries.
I could write this from scratch and see, or I could pip install Terrace plus this and then
we're off to the races.
Yeah.
Do you think a lot of people out there are using like RossPi plus OpenCV, like computer
vision stuff or things like that?
Or is it got to have some sort of sensor, right?
And vision seems like some of the options.
Oh yeah.
Yeah.
I think because Ross is open source, there's a lot of people developing for specific sensors.
And so a lot of times when a new sensor is out or some new form of vision, you'll see
development and incorporating into the Ross ecosystem.
I see like LIDAR or something like that.
Yeah, for sure.
Okay.
Yeah.
Did you ever get to play LIDAR?
Yeah.
I've played with some LIDAR.
It's kind of fun.
Maybe tell people what that is.
I don't know.
Yeah.
That's a great question.
What does it stand for?
Why does it not just blind everybody around him, right?
If it's lasers?
Yeah.
That's funny.
I've had LIDARs on my desk and I've hacked around and watched myself on the visualization,
but I don't know a lot about them.
I think that it's...
So it's like basically, if I understand it, it shoots out like a spanning beam of lasers
and then it looks at the reflections on what lights up and can tell like distance and sort
of 3D sensing.
Yeah.
So the sophisticated LIDAR sensors do have multiple layers and they spin 360 degrees
and you can get these beautiful renderings of the environment.
But there's simpler ones that are more of a 2D thing.
Okay.
Or just a particular field of view that are just getting obstacle distance.
It's like 20 degrees left.
There's a thing here.
Exactly.
There's a gap for this distance, which might be all you need if you're like trying to develop
a little, like a Roomba or something.
A Roomba doesn't care.
Yeah.
Up, down or whatever, perspective or hills.
It's just like, I'm stuck on a cliff.
Like, no, you're not.
You're on a shoe, but also a hump yard.
It doesn't really distinguish a whole lot.
Yeah.
And I think that some of those sensors, LIDAR is one that can be prohibitively expensive
when you really get all the bells and whistles, but like a simple field of view sensor might
be a lot less expensive.
And so you can put it into a consumer electronics like a Roomba.
Right, right, right.
Yeah.
So if you wanted to, I guess, so if people wanted to play more with the self-driving aspect or
they don't really want to just hook this to a car and understand what the car is willing
to tell them, but they want to put on all these sensors, maybe there's smaller devices that
they could play with.
And they could probably skip the OBD altogether.
Yeah.
use straight RossPi.
For sure.
RossPi is one of their first kind of example projects, just gives you a list of the hardware
you need and some recommendations for soldering iron and a couple sensors that are affordable
to make your own self-driving kind of cardboard box with a phone in it, you know.
That's cool.
It's totally cool.
It's a pretty expensive self-driving box for cardboard.
Yeah.
The phone's the expensive part.
Exactly.
But no, it's amazing what you're able to do.
And so hacking into these other systems or creating your own like that, like that RossPi
example, you can experiment with pathfinding algorithms.
You can experiment with computer vision.
Yeah.
There's lots of fantastic stuff built in to Ross and accessible with RossPi.
This portion of Talk Python to me is sponsored by Clubhouse.
Clubhouse is a fast and enjoyable project management platform that breaks down silos and brings teams
together to ship value, not features.
Great teams choose Clubhouse because they get flexible workflows where they can easily customize
workflow state for teams or projects of any size, advanced filtering, quickly filtering
by project or team to see how everything is progressing, and effective sprint planning,
setting their weekly priorities with iterations and then letting Clubhouse run the schedule.
All of the core features are completely free for teams with up to 10 users.
And as Talk Python listeners, you'll get two free months on any paid plan with unlimited users
and access to the premium features.
So get started today.
Just click the Clubhouse link in your podcast player show notes or on the episode page.
So there's two projects maybe that are worth like giving a shout out to.
One that I recently learned about, I think it's pretty new.
It's called Donkey Car.
Oh yeah, that's a cool one.
Yeah, so it's an open source DIY self-driving platform specifically for small cars, like
little remote control cars you could pick up with your hand or even holding your hand.
So it's an RC car plus a Raspberry Pi plus Python.
In the Python side, that's Tornado, Keras, TensorFlow, and OpenCV.
Oh wow.
That looks really cool, doesn't it?
Yeah.
So if people are out there thinking of, oh, like maybe I'll try something, like that comes
with a really simple API.
And it says you can do things like make your own car that'll drive itself or drive a car
with your phone or laptop or record images or train a neural net to drive a car on different
tracks.
Like maybe you drive it, then you say, see, do that.
Yeah.
Yeah, I think that that's fantastic.
And the fact that it's kind of a nice out of box experience and you don't have to worry
about getting something wrong and wiring it yourself.
Yeah, they have a bunch of cool examples.
You know, if I was like an engineering professor or something, I'd be super excited about all
the stuff they got going on there.
So the API is pretty simple.
I looked at it.
You just import Donkey.
And then you create a vehicle and then you just like grab the camera and you tell it
to do things and stuff.
It's a really nice API.
Wow.
Another one that you brought up as we were talking before we hit record was this idea of programming
a Roomba.
Yeah.
Right.
I'm not sure everyone listening knows what a Roomba is.
Like a Roomba is one of these little self-driving, self-navigating, self-vacuuming, vacuum driving.
I think they're driving.
Yeah.
I mean as much as a vacuum drives.
Yeah.
We have one of those.
My wife loves it periodically.
It'll get stuck on stuff.
She'll ask me to like dig it out, dig it back to its home so it's okay.
But those are getting pretty sophisticated and you can control those and program them right
now?
Yeah.
I mean this is another good question of what's officially endorsed by the company but I've
had some friends.
Don't want to return it after this maybe.
Yeah.
That have hacked on it.
And it's cool because you have this baseline of performance that you're able to see with
your vacuum and how it handles the obstacles in your house.
But then you can also try out different pathfinding approaches and just see how it works.
Right.
It would be cool to put, I don't know how much of a, like a sensor array that that thing
has on it.
It feels like, I know the old ones, it was kind of a blind thing feeling its way through
the room.
It had like, it would go bonk, bonk into the wall.
Like, okay, I guess that's a chair.
We'll just like work our way.
I think the newer ones are a little more advanced because we'll get like a map of where it cleaned.
Oh, wow.
Yeah.
Like a 3D top down.
It's like, oh, here's the top down view of where it thought the table was, you know?
Oh, cool.
It's much more advanced.
So maybe you can get into those as well and get access to that information.
Oh, yeah.
I think that that, that'd be a great project.
Yeah.
Seeing where the Roombas have come, what sensors are there.
Yeah.
That'd be super fun.
So I'll link both the donkey car.
Well, that's easy, donkey car.com, but I'll link to it anyway.
And then this Roomba Python API.
So not only do you get a program it, you get a program it in Python.
Yeah.
That's, that's pretty cool.
When you think about the self-driving cars, like how computationally intensive do you have
to be just to do those types of things?
Can you have like a really, they said Raspberry Pi safe.
or a donkey car, but maybe you have to only run simple algorithms.
I don't know.
You know, do you need GPUs?
I know Nvidia is working on a self-driving car.
Yeah.
I mean, I heard that at some point.
I think it's just as much as they're able to fit.
I think that whatever's available, they'll use.
And I think that a lot of the argument for using low-level languages is trying to get as
much speed as possible.
Right.
Because if you could take a higher res image, then that means a lot for figuring out what's
out there.
Absolutely.
Yeah.
Cool.
All right.
Well, I don't know.
I'm, I'm inspired to work on something.
I'm not sure I'm going to go hack my Roomba button.
Maybe.
Yeah.
It sounds really fun.
And also now I want to know if my car has one of those ports.
Yeah.
I'll have to go check it out and see.
All right.
Well, this is really fun to talk about these things and we'll link to some of the stuff
out there.
I'll link to your talk.
Maybe just give us a quick catch up on ActiveState while you're here as well.
You know?
Yeah.
I've had a, I think it was Pete on to talk about machine learning libraries and stuff
a while ago, but I haven't talked about ActiveState for a while.
So we hear a lot about Anaconda and those types of distributions.
It feels to me like ActiveState plays kind of in that realm.
Yeah.
And traditionally, ActiveState has been distributions in the same kind of vein as Anaconda, right?
Okay.
Just a big collection of popular packages that you don't have to worry about pip installing
and that kind of thing.
Okay.
For Python and for Perl also.
But now we're putting together a self-serve version of that.
So you might think, oh, the ActivePython distribution has a lot of the great stuff I need, but there's
500 packages in it and I only need 40.
Right.
Okay.
So you can go in to the platform and say, these are my 40 packages that I'm interested in,
pre-build it, test it for these OS and architectures.
And then anybody who wants to use my project can pull it down and just have everything good
to go.
Okay, cool.
And you can pick like different versions of Python or can you even configure how say Python
is compiled or like what level?
Yeah.
So there's multiple versions of Python.
I think we're up to 3.8 or 3.9 now, like up to date with modern Python.
Thousands of packages available.
We're still in beta.
So there's some flux in what builds and the information about the combinations of builds
that you're trying is valuable to us and will make things better.
Okay.
Yeah.
It sounds like a good project.
And you're working on some ROS things there as well.
It sounds like like a village install isolated things.
ROS is something that I think is one of the powerful things about the future of this platform
that we're doing.
ROS is a project that's notoriously difficult to install and difficult to update.
I've spent multiple days getting ROS configured the way I need it.
And so the vision behind what ActiveState is doing is that configuration is done on this
builder of the ActiveState platform.
You just pull it down.
It's set up already for you.
The same way a distribution would.
Yeah.
It's a little bit like Docker.
I think of it as more of a pip amp than a full-on Docker.
Okay.
There is some runtime isolation.
Yeah.
I was thinking more of the, it comes in a way that you know that it's going to be set up
to work.
Yeah.
Not so much the isolation side of Docker.
Gotcha.
Yeah.
It is.
So the power for, some of the power behind it for ROS, I think, is the same that applies
to current things that we currently support like SciPy and NumPy that have C dependencies
that you can get tangled trying to build them on your machine.
So the builder on the platform tests and builds and gives it to you for your specific platform
so that you don't have to untangle that.
And the future of what the platform will be able to do is things like ROS, where it's just
a pull it down.
It works for you rather than having to do any of that yourself.
Well, that sounds nice.
Yeah.
I mean, it's the fun part of programming, not the unfun part.
It's funny.
Like we have this expectation that when we install things like Spotify, it just works for us,
right?
That's pre-bundled, pre-built.
But when it comes to like our developer environment, we still have to build everything from scratch.
Like there's still this funny thing where developers are just going, okay, I have to build my new
thing, right?
So I think the idea is we get to a place where your dependencies are, you can install as easily
as you could your browser.
Yeah.
Well, that's pretty cool.
When is that coming?
Or like...
Oh, so the platform's live now and we're building up our catalog of Python and Perl for macOS,
Windows and Linux.
And the package list is growing and the potential for the language list to grow too.
Yeah.
Cool.
All right.
Well, let me just close this out with a couple of high-level questions about cars real quick
here.
So I opened the whole conversation as in science fiction is like here is now just science or
engineering in some regards of self-driving cars.
But we're still not out there where just self-driving cars are cruising around.
Like I just read this morning, somebody had projected like a human onto the asphalt in the
salt.
And like Teslas were stopping that.
Yeah.
Like we're always...
There was a great article about salt circles around cars.
Yes.
I've seen like a car painted in it and it didn't get out.
I can't cross the line.
So yeah.
Yeah.
It's like the elephant that's tied down with a little tiny stake, right?
But that's where the car version...
Anyway, so having more experience than many people, what are your thoughts on this?
Like, are you just amazed at where it is?
Do you think we're going to get to the science fiction level of it or...
Yeah.
I think that I am amazed by what we're capable of with this technology.
I think for me, aside from what we're capable of in our technology, I think because this is
all so new and because there are things like 100,000 lines of code and we're coming from
a system that has a foundation in building on safety assurances, there's a question that's
still, I don't think, fully answered, which is how safe is safe enough for this new stuff?
I think that some of the auto manufacturers are concerned about that.
Certainly state and local governments are concerned about that.
Like what...
How safe is safe enough for it to be on the roads of our city, right?
And I think that those...
Right now, in my mind, that's one of the most significant challenges to AV technology.
Yeah.
And I think we might have to just get used to a different kind of safe.
Yeah.
So what I'm thinking is, if there's a person who is videoed being just run over by a self-driving
car in some horrific way, even if there are 10% fewer wrecks and 100,000 people are not hurt,
if there's a graphic example, right?
That's going to stick in people's mind.
That's going to run on news and people are going to go, cars are unsafe.
We can't have this.
And like, maybe they are unsafe somewhat, but they're less unsafe than like people driving
cars.
Potentially.
I don't know if that's true, but it just might take us a different type of...
We might have to all get used to it differently, right?
That's a really interesting point.
And I think that at the beginning, especially like when people are still trying to decide whether
or not they are willing to trust this technology.
Will you get in the car?
Yeah.
Like in that Uber that no one's in?
It's really important for the community of people developing this technology not to violate
the public's trust.
And I think that really catering or just really keeping the public in mind is an important part
of how the industry moves forward.
I think if they're going to maintain the trust of the people that they'd like to be in these
cars.
Yeah.
I also think it's a huge challenge to have a heterogeneous world, right?
It's one thing to imagine a world with really clear painted lines and tons of self-driving
cars that all communicate like, hey, I'm over here.
I'm intending to turn or whatever.
But if there's grumpy drivers at rush hour in there with them, like that's a whole different
level of complexity.
I like to think that each of the auto manufacturers with their own sort of machine learning decision
making, there's going to be like different attitudes of Fords versus, you know, GMs or
something, right?
Like the Fords are grumpy on the freeway.
The Cadillacs are super aggressive.
Yeah.
You can never merge when there's a Cadillac.
Yeah.
How interesting.
Yeah.
You know, it's probably true, right?
Like if they have different models running, they're going to make different decisions.
Yeah.
Absolutely.
Interesting.
Well, we'll see if they learn.
All right.
Well, I guess, you know, probably that's a good place to leave it for the conversation.
But I'm both somewhat hopeful for this technology.
I'm mostly just really, really impressed with it.
Although I'm not one of those people like I can't wait for self-driving cars to come because
I hate driving.
I like driving.
I don't mind it.
I actually don't have to commute that much.
So it's no big, I guess maybe that's why I don't hate it.
Yeah.
But I do think it's interesting technology and it really blows my mind coming from the
Turing test chat bot thing.
Oh, yeah.
Yeah.
I was just learning a little bit about Eliza when I, like, I think it was written in the
60s.
Yeah.
That's like, I think that was one of the ones I was thinking of.
Sure.
Nice.
All right.
Now, Shay, before you get out of here, you got the two final questions.
Yeah.
If you're going to write some Python code, what editor do you use?
Yeah.
So I'm a VS Code person and I have had great experiences with both Vim and Emacs.
And those were kind of driven by pair programming.
I like to be able to jump in and pair.
And so I've learned for the people that I was typically pairing for.
And something that is a little easier barrier to entry like VS Code makes it much easier for
me to pair regardless of preference usually.
Right.
And the tooling for Python.
It's tough to jump in on Vim or whatever if you're not familiar with it.
Yeah.
I mean, just go like, all right, now exit.
Yeah, exactly.
Exactly.
Yeah.
And the tooling for Python for VS Code is solid.
Yeah.
I've never had a complaint there.
Cool.
All right.
Good one.
And then notable PyPI package?
Yeah.
So notable in a couple of ways for me is the DocOpt package.
So it's for sure my most used library just because it takes scripts that I write and programs
that I write up to the next level of usability on the command line.
But the other thing that's incredibly notable to me is that it's like maybe a project that's
reached enlightenment.
It's been quiet for two plus years or something.
Yeah.
Like it's just stable.
But it's okay that that's happened?
Yeah, for sure.
Yeah.
Like there's like warnings out there that you shouldn't use a package if it's been quiet
for a certain amount of time, if there's not enough activity.
But I think there are some rare ones out there that are just stable.
Right.
It's done.
Yeah.
It's rare in the software world and it's kind of done.
Yeah.
Awesome.
Well, that's a very good one.
Cool.
Well, you know, thanks for being on the show.
People are excited about this.
Maybe they want to go get some diagnostics information in a car or they want to try out
some of the self-driving AI magic.
What do you say?
Yeah.
I say jump in.
Ross is a great place to start.
Talking to a robot, talking to a car isn't harder than file IO.
If you can do that, you can talk to robots.
That's pretty impressive.
Awesome.
All right.
Well, thank you for being here.
Thanks for being on the show.
Absolutely.
Thanks for having me.
You bet.
Bye.
This has been another episode of Talk Python to Me.
Our guest on this episode was Shay Newton, and it's been brought to you by Datadog and Clubhouse.
Datadog gives you visibility into the whole system running your code.
Visit talkpython.fm/datadog and see what you've been missing.
Feel throwing a free t-shirt.
Clubhouse is a fast and enjoyable project management platform that breaks down silos and brings teams
together to ship value, not features.
Fall in love with project planning.
Visit talkpython.fm/clubhouse.
Want to level up your Python?
If you're just getting started, try my Python Jumpstart by Building 10 Apps course.
Or if you're looking for something more advanced, check out our new async course that digs into
all the different types of async programming you can do in Python.
And of course, if you're interested in more than one of these, be sure to check out our
Everything Bundle.
It's like a subscription that never expires.
Be sure to subscribe to the show.
Open your favorite podcatcher and search for Python.
We should be right at the top.
You can also find the iTunes feed at /itunes, the Google Play feed at /play,
and the direct RSS feed at /rss on talkpython.fm.
This is your host, Michael Kennedy.
Thanks so much for listening.
I really appreciate it.
Now get out there and write some Python code.
I'll see you next time.
Bye.
Thank you.