Feb 222017
 

It’s so long since my last post – sorry! Development of the sensor software stalled after linux changed the way it recognises devices and introduced so many bugs and difficulties I was left grinding my teeth in exasperation.

Still playing with the Raspberry Pi, however, but for now the focus is on communication over WiFi, with the aim of being able to control a car or other vehicle using a web interface. Ultimately I want to get this working with MQTT – essentially an IoT solution – but initially this will use a web server and HTTP.

A computer-controlled car – and here I’ll assume the computer is a WiFi-enabled Raspberry Pi running linux – needs to interact with the human (or other remote) controller, and needs to look after itself, i.e., check the sensors for obstacles, update the current drive settings, adjust the steering, etc. In other words, it needs to multitask. The best way to do this is via threads. It also makes sense to have an event loop.

Given all these requirements, I have created a project that implements the basic logic: wifi-py-rpi-car-controller

  • Written in Python and using threading and Queue for event management, and web.py for the web server; also NumPy, although that’s not a hard requirement at this stage.
  • Currently the web interface is written as a single non-templated HTML document with a 2D ‘slider’ written with SVG, although I’ll probably fix this to allow separate handling of linked CSS and Javascript files. A query/command mechanism is provided for passing instructions to the car controller (via the server) and receiving data from it.