thisismyrobot

Littered with robots and Python code

[Instagram] Wireless robot charging station mock up #maskingtape


Successful test of RFID tag triggering charging relays


Also, the code for this project is here.

[Instagram] Close up of the final wireless charging installation


Instagram posts

Using the magic of IFTTT I'm going to be automatically cross-posting any robot-related Instagram pics and videos here - stuff like this:


A video posted by Robert Wallhead (@thisreallyismyrobot) on

Wireless charging for the Parrot Jumping Sumo


I've successfully managed to add a basic wireless charging system to my Parrot Jumping Sumo - this opens the door for self-propelled docking and charging - no human input needed. The module itself is from Little Bird Electronics.

The next step is a Pi with a docking dashboard for starting and stopping the charger, reporting on charge state etc. Below you can see it actually charging (indicated by the red LED in the top-right).


Parrot Jumping Sumo

My amazing wife bought me one of these for my Birthday and it is awesome!



That is all :)

A Forest of Sentences

Machine learning as a service is awesome!

I really like the idea of the Google Prediction API. As in really like it. I especially like that it supports both numbers and strings for the training inputs, out of the box.

I quickly found that it is a bit fiddly to set up for just playing around with ideas though, and you need to pay for some of their cloud storage for your training data.

That lead me down the rabbit hole of whether I could use RandomForest algorithms (currently regarded as pretty awesome for minimal-configuration machine learning) to perform the same sort of basic machine learning tasks as suit Google's service.

I decided to start with Google's "Hello Prediction" example which classifies sentences as being in either English, Spanish or French.

The obvious issue here is that these algorithms support input arrays of floats for training, not just my random assortment of sentences - cue rabbit hole number two.

I'd been interested in fuzzy grouping of similar sentences/strings for a long time, and had had some small successes (and epic failures) trailing an idea where I would use a set of three "landmark" sentences to "localise" a new sentence in three-dimensional space. The position in each dimension would be calculated using the Levenshtein Distance or a similar, from each landmark. I had hoped this would allow for sentence grouping and of course cool three-dimensional scatter diagrams. As I said, this didn't really work.

That work did give me an idea for creating vector representations of strings though:
  1. Randomly select a small (100-200) subset all the training inputs for a feature. In the case of Hello Prediction, this was 200 of the sentences that were in the training set. These sentences become the "landmarks" for the input array generator.
  2. For each sentence in the training data, measure the distance (I used the FuzzyWuzzy token set ratio) between the training sentence and each landmark (divided by the training sentence length). This creates a 200 element array of distances, per training data sentence, in my example.
  3. Train a RandomForestRegressor using the languages (mapped to integers) as the targets and the 200-element arrays as input features.
  4. Profit?
For each new sentence, perform the same translation to a 200 element array and pass that to the model's predict() method. This seems to work remarkably well, though it sometimes classifies Spanish sentences as French:

python forest_of_sentences.py

Loading training data... Done!
Preparing vectoriser... Done!
Preparing training data... Done!
Training RandomForest... Done!
Testing...

Hello mate, how are you? I need to find the toilet. ('English', 99)
Bonjour compagnon , comment êtes-vous? Je dois trouver les toilettes . ('French', 87)
Hola amigo, ¿cómo estás? Necesito encontrar el inodoro. ('Spanish', 89)

Done!

This worked-example code is available on my GitHub, and I'll attempt to apply it to some more difficult problems in future posts.

On GenghisIO

More than eight months have passed since I announced GenghisIO, my attempt to remove the installation barriers for real world robotics programming.

Since then the project has progressed significantly. Unfortunately progress has now slowed significantly.

The long and the short of it is that with a full-time job and family I simply don't have the time to commit to developing such a large undertaking. It has also become clear that whilst I am solving some "really cool technical problems" with this platform, my sales pitch was actually more of a 10-minute sales show-and-tell/essay.

This was making it very hard to convince people of the project's worth, which in turn was making it really hard to keep motivated. Frankly, if the "need" of this project is so hard to explain, maybe it doesn't exist as much as I'd like it to.

With all that in mind, GenghisIO is going on the back burner for now and I expect I will shortly opensource the development done so far so others may benefit.


Announcing GenghisIO

For the last twelve months I've been working on a "secret" project that's got me very, very excited! Even better, it's finally at a point where I can show you all something substantial.

The aim of the project, GenghisIO, is the development of a web-delivered platform for no-installation interactive robotics programming, using Android and iOS devices to bridge the gap between your software and your robot.

The targeted platforms are currently Sphero, LEGO NXT and IOIO, with "more to come" of course.

The video below shows the current test app UI, with a simple program driving the Sphero 2.0 around in a square pattern. The scrolling text shows real time serial communications with the Sphero.


GenghisIO is extremely alpha, but if you're interested in finding out more, I recommend following GenghisIO on Twitter where I'll be posting previews, updates, beta invites etc etc.

Happy robots!

Simple Python Turing machine implementation

I've always been a fan of using problem-solving to learn, over the years I've found it far more effective that rote learning or being lectured. Recently I came across this interesting implementation of a Turing machine. I'd obviously heard of Turing machines but I had never sat down and thought about how to "build" one.

Feeling inspired I cooked up this fairly simple Python example of a Turing machine*, using a rule set that counts up in binary on the "tape": This example counts up to 64 in Binary, printing out the tape each time the head resets to the start position.

* In this case, the "infinite tape" is only infinite for values of infinity less than the roughly 3 GB of free RAM that my laptop had at the time :)