At the Maker Faire Bay Area 2019, we spoke with Ed Murphy, a donkey car racer and a self driving car enthusiast. He shared to us some of the components needed to build a Donkey Car and how does it works. And according to him, learning neural networks can be more fun with building a Donkey Car. One doesn’t need to have much experience about electronics to build this, you can actually put it together without any electronic knowledge and by just following the detailed instructions provided at https://www.donkeycar.com/.
Laren: We're here with Ed. And he has a neural network based robotic car that he's going to tell us about.
Ed: Yeah, so this is a donkey car. I'm a software person, Adam and Will are the actual inventors of this – I just went to a talk that they did and got really interested in it and I thought, this is a great way to learn neural networks because you can teach it to drive autonomously and it uses a neural network to do that.
Laren: Cool, so how does that work with the electronics. Can you explain that?
Ed: Sure. So this is a regular old RC that you can just buy online, right? This particular one is about $80 to $100. And then this is a Raspberry Pi, a $35 computer, it's a full Linux computer. And then there's one other little chip that’s easy to get, it’s about $10. So you put all that together, and what the car can do is 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 that you drive it around as a person and use something like an Xbox controller or 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 then it will remember what the inputs were from the Xbox controller – like what the throttle was and what the steering was. So it gets three pieces of data 20 or 30 times a second and a picture of what it sees and then what the human said that 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 a neural network. And then the neural network will look at all the pictures and the associated throttle and steering. And it will 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 a it's a kind of 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, you put the software into a mode where it takes a picture as the neural Network for throttling steering and then the Raspberry Pi puts the throttle and steering into the hardware. And now it's driving. It does this 20-30 times a second and instead of trying to remember what the human did, it tries to replicate what the human did.
Laren: 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?
Ed: Yeah, well, you often do need to clean it up because when you're driving around the track, you're generally not the only person on the track. So four times a year, once a quarter, there's a race at a company called Circuit Launch in Oakland, California for the San San Francisco Bay chapter of DIY Robo Cars. 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. Sometimes there are crashes and sometimes you're just not that good of a driver. So you get bad data and you don't want to train with bad data. The last race I went to I had about 30,000 pieces of data. There's a part of the Donkey Car open source software that has a utility where you can look at that [race] like a like a movie, like a video and find places where you did something you didn't like, and select that section and delete it. I drove for half an hour, it takes a lot longer to watch that thing carefully and go back-and-forth editing and it took me like two hours to actually remove the bad data.
Laren: So it helps if you're a really good RC car driver in the beginning?
Ed: 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 I can, and remember, it's behavioral learning, right? 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.
Laren: And how much did you know about electronics before getting into this?
Ed: I knew nothing. Absolutely nothing. And so when I first 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 almost a plug-and-play. There's wires to put between the Raspberry Pi and what's what's called an ESC, an Electronic Speed Controller, which is just kind of a standard part of an RC. And there are detailed instructions on donkeycar.com on how to do that. So I just followed the instructions and got it done. But I thought, you know, this is pretty interesting. And I started trying to learn more about: what is an ESC and how does the the Raspberry Pi actually talk to it through those wires? 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 I 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 what a Roomba does. It uses a little bit more expensive hardware than mine. I think I have $25 in parts or something to do the same thing. But I'd never even have thought of doing that a year-and-a-half ago, it was this project here that that introduced me unexpectedly to electronics.
Laren: How do you find the resources to learn about this? Is there an active community that you meet with? Is it online resources, YouTube videos...
Ed: So donkeycar.com has a set of documentation and instructions on how to use almost any RC. There's an online Slack community: donkeycar.slack.com where you can ask questions and lots of new people come and ask things like, “what kind of car do I buy” or “I was installing the software and I got this error message, what do I do?” And there's an active set of people who are answering questions every day. Sometimes, a question will be asked and answered within a minute.
Laren: That's so cool because a lot of the communities like this don't have that kind of like instantaneous communication.
Ed: Yeah, and and so DIY Robo Cars is an umbrella organization that brings together not just Donkey Car enthusiasts, but other people who build different kinds of autonomous vehicles from RCs, and gets them to do a race. At the last race, which I did not win, the table beside me was the winner. So I talked to him and his car had this big thing on the top and I'm like, "is that LIDAR," he had LIDAR on his car! And he had this big computer board like they would use in a real autonomous vehicle and this thing was more like $3,000 and he came in first place. He's a PhD student from University of California, San Diego and he did an awesome job. It was really interesting and it’s a completely different way of solving the same problem. The table to the left of me were the people that came in second place. And they were two old retired gentlemen. They just used an Arduino and a camera. Their car used a line following algorithm and their car was like $150 – and they came in second place! So this is tremendous dynamic range of what's possible. I learned a lot from those guys who just did the line following and I learned a lot from the gentleman who had the LIDAR solution.
Laren: Do you find yourself staring at your Roomba, watching it bump into corners?
Ed: I want to take it apart is what I want to do, like, how do they do that? I want to build one! These kind of projects are so great because I learned all this new stuff that kind of sprung from it and there's so much to sort of dig into. I see a lot of schools starting with projects like this, like build simple robots and use sophisticated software and teach Kids about STEM to get them interested because this project really isn’t about winning the race, it’s about doing something fascinating with new technology and learning that new technology.