Connected vehicles & Self-driving cars with Kafka

How’s the form?

The term connected vehicles refer to applications, services, and technologies that connect a vehicle to its surroundings. A connected vehicle includes the different communication devices (embedded or portable) present in the vehicle, that enable in-car connectivity with other devices present in the vehicle and/or enable connection of the vehicle to external devices, networks, applications, and services.

Self-driving cars are vehicles capable of sensing their environment and operating without human involvement.

So today I want to show a simple demo where I can stream car data in real-time using Kafka. Because I don’t have a real autonomous car and came with the idea to use Anki Car or Anki Overdrive.

Anki Overdrive is an intelligent battle racing system that lets you explore the power of artificial intelligence (AI). You can see a nice overview, all the new features explained.

All naming rights for Anki, Anki Drive and Anki Overdrive are property of Anki.

With the standard Anki Overdrive Kit, you get two cars, some road pieces to construct simple road maps and a charging platform for the cars. It is all you need to start playing around with.
Check the driver-sdk.

Using a Bluetooth Low Energy (BLE) API you can connect and disconnect from Anki, change some settings and of course you can get some real-time information.

I found this anki-drive-python-sdk that uses Python and node to get the real-time data using BLE

Here is the info that I can get.


{'location': 17, 'piece': 36, 'offset': 67.5, 'speed': 390, 'self_speed': 400, 'clockwise': 7, 'notification_time': datetime.datetime(2018, 8, 25, 21, 9, 33, 359248), 'is_clockwise': False}
{'location': 23, 'piece': 57, 'offset': 67.5, 'speed': 422, 'self_speed': 400, 'clockwise': 71, 'notification_time': datetime.datetime(2018, 8, 25, 21, 9, 32, 229689), 'is_clockwise': True}

Piece uniquely identify the type of road piece (curve, start, stop, intersection, straight), speed is the speed recorded by the vehicle, self_speed is the “theoretical” speed as set by our command, offset identifies the “lane” (see a visual explanation below), and the location is an incremental integer (see a visual explanation below).


A simple Raspberry PI demo where I can get the Anki Car data in real-time and send it to Kafka. I can explore the data after with some graphics or some data analyses.

You can check the “create_track_image.py” and create your track map.

With the map you can start thinking in some analyses, E.g, can I make the car go faster? I can do some analyses in my track and determine where the car can speed up and where should slow down,

You can buy an extra Anki Collision Kit, which includes an intersection and try to create a Collision Prevention Algorithm.

Now we have a basic, but functional setup to run experiments and collect data from our small cars, but there are indeed a lot of interesting data questions we could try to answer.

  • how can a vehicle learn the best “driving policy” given a track configuration?
  • What will change when we introduce other vehicles? We could, for example, have them compete against each other, or we could use the second vehicle to learn cooperative behavior (e.g. avoid collision).
  • Can we add Traffic Light. Unfortunately I don’t have this hat.
  • Can we condition the learning process on variables other than the track configuration?
  • How smart can the vehicle be with the current sensors? As we saw already with position, sensors are pretty basic and won’t allow a fine-grained control: what can we do to be smarter with what we have (e.g. interpolate position?) and what can we easily add to give us more dimensions to play with (e.g. webcam with object recognition)?
  • Anki Overdrive has the Supertrucks as well. What can we do differently with the truck?

And many more, this is not an exhaustive list.

Similar ideas










Leave a Reply

Your email address will not be published. Required fields are marked *