Artificial Intelligence: Collision Prevention for Anki Overdrive

Marius Reimer
4 min readOct 10, 2017

--

source: unsplash.com

Artificial Intelligence: Collision Prevention for Anki Overdrive

This article is about the famous Anki Overdrive battle racing system. It gives you the opportunity to build your own AI system, which acts in the real world, not just in your computer.

I’ve built a collision prevention software (call it AI), that checks whether a vehicle is allowed to pass the intersection or wait — until the road is free.

Here you can find a quick overview about the whole system.

I’m not affiliated to Anki. All naming rights for Anki, Anki Drive and Anki Overdrive are property of Anki.

First things First — Capabilities of Programming

With the standard Anki Overdrive Kit you get two cars and some road pieces to construct simple road maps. Plus: a charging platforms for the cars. The problem with that is the miss of a collision. You have to buy an extra Anki Collision Kit, which includes an intersection.

That being said, the road map can be built. The simplest possible solution to construct a collision road map, is by using six curves and one intersection in between.

But first you should update the firmware on the vehicles. This can be easily done by using the Anki Overdrive Android or iOS app. Just start a new game — and make sure that the devices are not discharged.

So what can you do by Programming?

Using a Bluetooth Low Energy API (tinyB in my case), and by having information about the communication protocol (Anki C SDK) on the other side, it is possible to program in any desired language. You then usually build a wrapper around the functionalities you need.

Here are some of the things you can do to control a vehicle:

  • Connecting and disconnecting. When a vehicle is connected, their lights get blue. A disconnected vehicle is to be recognized by green lights
  • Changing the SDK mode, to be able to control the car
  • Changing the lights and its pattern for front, mid and rear
  • Changing the speed (in mm/sec) and acceleration (in mm/sec²)
  • Changing the lane (offset) in mm from the center of the road piece
Source: anki.com

Here are some of the things you can read from a vehicle:

  • Track ID (Road piece ID), to uniquely identify the type of road piece (curve, start, stop, intersection, straight)
  • Track Position (Location ID), to identify the position on a road piece
  • Transition between two road pieces (when a road ends)
  • Entrance and exit of an intersection. Also where the vehicle is entering or leaving the intersection (four possibilities)
  • Change of its charge state. This is triggered once the vehicle is put on the charger and removed from
Source: own and anki.com

Finally, there are some things you have to request, in order to get an answer via response:

  • Battery level
  • Ping
  • Firmware Version

Second — Bluetooth Low Energy API

After all of this information, you are at least capable of letting the vehicles drive, if they are discovered and connected via Bluetooth.

As you can see — it is pretty easy to use. If you want to read more about Java and tinyB, have a look at this page.

Third — Collision Prevention Algorithm

The idea behind the implemented collision prevention algorithm is simple. At first, all vehicles (I’ve used three) must be placed beside to each other, in the same direction. Then, after they are discovered and initialized with the software, one of them is randomly chosen to scan the road map. This is necessary in order to know the current location of the vehicles.

Source: Partly anki.com

After the scan, two road pieces (both that lead into the intersection) are marked as the ‘critical sections’. That means, if a vehicle is located on the first critical road piece section (the green vehicle above), it is put into a global vehicle list. This list is used to restrict vehicles to enter the intersection, by checking if it is empty.

The green dotted line shows the trigger for checking if a vehicle can pass the intersection or must stop. Each time a vehicles leaves the intersection and empties the list, it triggers all vehicles to start driving.

Demonstration of the Final Project — At a Local University Event

My site

--

--

Marius Reimer
Marius Reimer

Written by Marius Reimer

React Native Mobile Developer since 2017 // Freelancer

No responses yet