Artash Nath, 13 years, Toronto, Canada On 15 April 2020, I attended the “Bots & Beer” online event organized by Andra Keay of the Silicon Valley Robotics. It was an […]
Artash Nath, 13 years, Toronto, Canada
On 15 April 2020, I attended the “Bots & Beer” online event organized by Andra Keay of the Silicon Valley Robotics. It was an awesome event with a cool line up of speakers talking about robotics in a relaxed home setting because of the #COVID19. The speakers for the event included Kwabene Agyeman from OpenMV, Jillian Ogle from Remo.tv, Katherine Scott from Open Robotics, Nathan Kau from Stanford Robotics Club along with his robots (Doggo and Pupper), and Adam Conway from Donkeycar.
follow on twitter at www.twitter.com/wonrobot
Listening to Adam Conway and his talk about do it yourself autonomous cars and the large community around it introduced me to a whole new world of virtual racing and DIYRobocars. It is amazing how a month away from school because of #COVID19 sets the mind free, ambitions loftier, and time available to pursue one’s interests and take up new challenges.
I am interested in space, robotics, battle bots, and machine learning and have been building robots, rovers, rockets for the last 5 years. Since last year, I have been taking classes on Machine Learning and Reinforcement Learning at the University of Toronto, Canada to enhance my knowledge and gain skills to run supervised and unsupervised algorithms in my projects.
Virtual racing interested me as it integrated robotics, coding, and machine learning. I decided to sign up for the virtual race on 25 April 2020 and got started on reading all the documentation and coming up with a plan.
The Goal of DIYRobocar Racing
DIYRobocar is for anyone who wants to make and race DIY autonomous cars of any size, from a tiny 16th scale to full-size. However, because of the #COVID19 lockdown and the inability of people to meet physically, the event turned virtual for the first time.
The goal of this competition was to train a virtual car to automatically drive on a virtual track and then race it against a competitor. The trained car should be able to stay as close to the track as possible, and not crash into red cones placed on the side of the track.
Approaches to Training the Autonomous Car
There are two main approaches one could take to training your autonomous car.
First, you could use a Supervised Learning model, where you would manually create a training dataset by repeatedly driving a car around a track. In this case, the inputs to the model would be frames coming from the front of the virtual car, and the output would be the direction you were turning in – at the moment that frame was taken. This will train the car on which direction to turn based on what it is seeing.
The second possible approach uses Reinforcement Learning. Instead of manually creating a dataset then training it, the car learns in real-time. In this method’s training phase, the car would start by moving in random directions. Whenever it does something correctly such as avoiding an obstacle or going in the right direction, you would give it positive feedback (to reinforce the action it took). And if it does something wrong, a
negative feedback (to discourage the action taken by the car).
Over time, the car would try to maximize the feedback, and do more “correct things”, leading it to become a better driver.
As I was new to the competition and had less than 5 days to register and turn up for the race, I decided to use the default DonkeyCar framework, which ran on a Supervised Learning method. To create my dataset, I drove around the virtual track almost 100 times. This provided me with a dataset of around 70 000 data points.
For the training, I decided to increase the batch size from 128 to 256. A higher batch size means that it generalizes better as it calculated its loss based on more images. This could help to increase it’s driving accuracy on new tracks as well.
I also increased the patience of the model to 35. Patience is a parameter that can stop the training process early if there is no accuracy improvement. The patience parameter determines how many training steps will the model continue to train for if there is no decrease in loss.
My model trained for 140 epochs and reached a loss of 0.67. It took approximately an hour to train. I tested my model on the track, and it was able to complete 1 round of the track in between 22 – 25 seconds.
The Race Day
The race day organizers were Chris Anderson, Tawn Kramer, Adam Conway, and Will Roscoe. They diligently explained the rules of the race, and how the race will be played out virtually.
Almost 40 teams had registered for the virtual race. Participants had to log into the DonkeyCar server from remote to enter their cars for racing. There were participants from Japan, France, India, Canada, USA, Taiwan, Switzerland, Turkey, South Korea, Russia, Thailand, and other countries. It was amazing to see such a global presence and interest in this virtual race, considering all the different time zones. There was a mix of newbies and experienced participants which made it all the more fun.
A big hat tip to the organizers for getting information about their event far and wide and enabling the participation of so many teams.
Each race had two cars. And the cars competed with each other in completing 3 laps of the racing course. The winner then proceeded to the second level and the winners then raced among each other until only one winner remained. The winning car was Naisy and it was so cool to see the very well trained and well-behaved car winning the first virtual race.
My car did not win the race even though it won the first lap out of three laps it had to compete. After the first lap, my car hit the cone and did not recover quick enough from it. This was a known problem for me as it had happened before too. I plan to improve my algorithm to prevent this from happening in future races or train my car to quickly recover from it and get back to the track. In terms of overall track timings, my car stood 11th and I was pleased about it.
I think all cars performed very well and it was a lot of fun to chat and talk with the community.
Interestingly my sister Arushi who is 10 years and works on her own Robotics project also got interested in the racing simulations I was carrying out for the purpose of training my car. So I transferred my model to her, and she then added her own training data to it to enter the competition separately. As she did not have enough time to train the car and get familiar with the environment she ended up having problems logging her car at the start of the race. She, however, plans to keep trying and become a better competitor by the next race!
To improve my algorithm for future competitions, I want to first get better at driving the car in the virtual track so I can create more accurate training data for the car. This could include faster driving and making sharper turns.
I will also increase the complexity of the Convolutional Neural Network so that it can better collect information on its surroundings based on the input image. Finally, I would like to train the model on a larger variety of data. For example: on differently shaped tracks, and with different drivers. This will help it to gain different skills 1 person cannot provide, and allow it to perform accurately on any kind of track.
Last, I thank all the organizers and the participants for introducing me to the world of virtual racking and to a very friendly and passionate community.
I look forward to seeing everyone at the next race. Until then, stay safe, keep training!
follow on twitter at www.twitter.com/wonrobot