# Donkey Car – A Self Driving Mini Car | Electronics Makers

I tried to learn neural networks by just
sort of watching online things everything and I can learn that way
but this is way more fun We’re here with Ed and he has a neural
network based robotic car that he’s going to tell us about. This is a donkey car. Adam and Will are the actual inventors
of this, I’m just sort of like- I went to a talk that they did and I got really
interested and I’m a software person but I got really interested
I thought this is a great way to learn neural networks because what this car is
it you can teach you to drive autonomously It uses a neural network to do that. Cool! So how does that work with the
electronics, can you explain that? Sure So this is a regular old RC that
eighty two hundred dollars And then this is a Raspberry Pi, a thirty five dollar computer. It’s a rootful Linux computer. And then there’s one little other little chip.
It’s easy gets about ten dollars. So, you put all that together and what the
car can do is it use the Raspberry Pi to decide how fast to go and
how much to turn. And the way it works is in two phases. The first phase is you drive
it around as a person. And use like an Xbox controller or
something like that ps4 controller and drive around the track
a whole bunch of times. About 20 or 30 times a second,
the Raspberry Pi will take a picture and it won’t remember what the inputs
were from the Xbox controller like what the throttle was and
what the steering was. So it’s gets three pieces of data,
20 or 30 times a second, picture of what it sees and then what the human said,
the throttle and steering should be. So it’s remembering what the human did. And then in the second phase,
you take all those data points and maybe you’ll collect 10,000
to 30,000 data points and then you’ll feed them into a process
to calculate the neural network and then their neural net will gonna look
at all the pictures and their associated throttle and steering and it’ll
essentially calculate a function. So that if you hand it a picture,
it will give you the throttle and steering that the human would have done. It’s called behavioral cloning.
It’s a kind of a machine learning called behavioral cloning because the
idea is, it’s trying to replicate human behavior. So now when you want it to race all by
itself without you controlling it, then you put the software into
a mode where it takes a picture ask their neural network for throttle
and steering and then Raspberry Pi puts the throttle and steering
into the hardware and now it’s driving. It does 20 or 30 times a second instead
of trying to remember what the human did. It tries to replicate what the
human did and now it’s driving. That sounds like a lot of data that it’s
collecting and you layer it on top of each other and then how do
you clean that up? What does it look like? Well you often do need to clean it up
because when you’re driving around the track, you’re true generally not
the only person on the track. So we do four times a year, once a quarter. There’s a race at a company called
Circuit Launch in Oakland California for the San Francisco Bay chapter
of DIY Robocars. People will show up and they all want
to gather their data that they need to calculate their neural
network and so there might be five or six or seven cars on the track at one time
so sometimes this crashes and sometimes you’re just not that
good of a driver, So you can’t end up with bad data and
you don’t want to train with bad data. The last race I went to, I had 30,000
about 30,000 pieces of data and in it there’s a part of the donkey car,
open-source software a little utility for you to look at like a movie,
like a video and find places where you did something you didn’t like
and select that section and delete it. So you know, I drove for a half an hour.
It takes a lot longer to watch that thing carefully and then back up and
then it take me like two hours absolutely removed the data.
Remove the bad data. So it helps if you’re a really good
RC car driver at the beginning. It helps. As a matter of fact, I’m talking
to a guy now who is an RC driver because I think he could drive
a lot faster than me And remember it’s behavioral cloning,
we’re trying to replicate what a human can do. So if you have a really good human, that’s
the kind of human you want to replicate, not me. Cool and how much did you know about
electronics before getting into this? I knew nothing, absolutely nothing.
And so when I first started doing this, I wanted to learn about the neural networks
and you can actually put this together without really any electronic knowledge.
It’s sort of almost plug-and-play. There’s wires to put between the
Raspberry Pi and what’s called an ESC, an electronic speed controller
which is kind of standard part of an RC and there’s detailed instructions in
donkeycar.com on how to do that so I just follow the instructions, got it done
but I thought it’s pretty interesting and I started trying to learn more
about what is an ESC, How does a Raspberry Pi actually
talk to it like through those wires And I ended up getting into a lot more
electronics and now I can build things with Arduino and I built a robot at home
that actually has a stepper motor and some time of flight sensors on it
so it can map my whole house. It can drive around my house and map
my whole house where all my furniture is. It’s sort of like that’s what a Roomba does.
It used a little bit more expensive hardware than mine like I think I have twenty-five
dollars in parts or something to do the same thing. But I’ve never even have thought of
doing that a year and a half ago. It was this project here that introduced
me unexpectedly to electronics. How do you find the resources to learn
resources, YouTube videos? So donkeycar.com is a set of
documentation and instructions on how to take an RC, almost any RC. There’s an online community on slack, donkeycar.slack.com where you can ask questions,
lots of new people come and say what kind of car do I buy and or
I was installing the software and I got this error message what do I do and
there’s an active set of people that are answering the questions every day.
Sometimes a question will be asked, it will be answered within a minute. That’s so cool because a lot of
the communities like this don’t have that kind of like instantaneous
communication, people are kind of like silent. So DIY Robocars is an umbrella organization
that brings together, not just donkey car enthusiasts but other people that build
different kinds of autonomous vehicles from RCs and gets them to do this race
thing and then so at the last race which I did not win, but at the last race,
the table beside me was the winner and so I talked to him and he had a car
and it had this big thing on the top And I’m like is that lidar? He has lidar
on his car and he has this big computer board like they would use in
a real autonomous vehicle. He had one of these but it’s more like
\$3,000 and he came in first. He’s a PhD student from University of California
San Diego and he did an awesome job. It was really interesting, a completely
different way of solving the same problem And then the table to the left of me were
the people that came in second place and there are two old retired gentlemen
and they just used an Arduino and a camera and so they did a line following algorithm
and their car was like \$150 and they came in second and the first place car is \$3,000
so this is a tremendous dynamic range of what’s possible and I learned a lot from
those guys who just had the line falling and I learned a lot from the gentleman
that had the lidar solution. Do you find yourself just like staring at your
Roomba like watching it bump in the corners? I want to take it apart, it’s what I wanna do
like how do they do that. I want to build one. These kind of project are so great
because even I learned all this new stuff that kind of sprung from it and there’s
so much sort of dig into here and I see a lot of schools starting
with projects like this like build simple robots and use
sophisticated software and teaching kids about STEM
and getting them interested because this project really is more,
it’s not really about winning the race it’s really about doing something fascinating with new technology and learning
that new technology.