Installing Player/Stage on the Raspberry Pi

The Raspberry Pi board
The Raspberry Pi board

The Player/Stage software is used in robotic research. The advantage is a very small footprint and very easy code to understand and implement yourself. In this post I explain how the Player project can be installed on the Raspberry Pi. In combination with a robot (I used a Pioneer 3DX for my Master Thesis) you can easily control the robot and do various tasks like mapping/localization/object detection and so on.


Before installing Player on the Raspberry Pi, certain dependency packages must first be installed. The easiest way to install these packages is by logging in the Raspberry Pi and type the following command:

sudo apt-get install cmake g++ swig libboost-dev libboost-all-dev libltdl-dev libjpeg-dev libgstreamer0.10-dev libstatgrab-dev libusb-dev libasound2-dev libgsl0-dev libxmu-dev libxi-dev libfltk1.1-dev libopencv-contrib-dev libcv-dev freeglut3-dev

This will take some time to complete, after installing all the dependencies create a directory to hold your Player source code.

cd ~
mkdir PlayerStage
cd PlayerStage/
Continue to Article →

Meta Programming rails views for context aware loading

Code that writes it self
Code that writes it self


At my company we have a gigantic Ruby on Rails application that manages everyone that enters a festival. We keep track of everyone in the festival and check if users has access to a certain area, can pay for his/her drinks with NFC technology and has a valid entrance ticket.

For today will focus on an analogy to make things a bit easier. So let’s assume I’m the owner of a zoo and in my application, I would like to know when/how/who feeded my animals. Naturally I would have a animals table which links to an animal_foods table.

The problem

My zookeepers, administration personal, me and the visitors should all get a custom view of the animal_foods table. For example I’m more interested in the joint relation between the animal_foods table and the zookeepers table to know who feeded the animal and if they did their job (being a tyrant of a boss cough). But my other zookeepers don’t need this information, they are more interested in the relation between the animal_foods table and the animal_health table.

From the above problem description we clearly see that I need a way to change my view based on the context. And this is where Rails fails, because views are way to static for the object oriented ruby. There is a gem that implements a more object oriented view approach, be sure to check it out. For my work I decided to implement my own solutions since learning something new (and extremely cool) is quite fun.

Continue to Article →

From Ubuntu to MacOSX

Linux is Dead
Linux is Dead

I started as a Ruby Software Developer at PlayPass a month ago. They develop a complete system for managing every person that enters/leaves an event. Belgium is quite know for there awesome festivals (like Rock Werchter, Tomorrow Land, pukkelpop,…). Having a system that can determine if a visitor has:

  • access to the area
  • has privileges
  • is able to pay for his drinks
  • is part of a band that performs and needs catering
  • is responsible for inviting his co-workers to the event because they sponsor it

Managing everyone is quite difficult and requires some very cool software written in Ruby on Rails.

Original picture from Tim Heuer

Coming from Linux

When my boss asked if I wanted a Linux or Mac, I decided to go for Mac. I never used a mac for a long time, so my initial opinion was quite biased. During my migration from Linux to Mac I discovered some new tricks and some serious setbacks.

Continue to Article →

Github Style code Highlighting for OctoPress

Code highlighting allows a reader to quickly skip over the code. Octopress has a syntax highlighting module but I really didn’t like the way it looks and it has a limited set of supported languages. After some Google I came across the following blog post.

Added Value

I started from the original concept of Kat’s CodeRay plugin. I’ve added a new option so line numbers can be turned on or off. I also cleaned up the style and melted everything together in a nice GitHub plugin. All credits go to the original author of course.

I noticed one problem, CodeRay would number the lines wrong. It would always add an extra number, for no reason at all. Diving into CodeRay I noticed that the count start from 0 but the numbering from 1 (a typical human-to-computer-translation-error). This problem only happens when the plugin is used in Octopress not when I call CodeRay on an external project. I fixed this error with some clever CSS, but some investigation is needed for solving this issue.

pre a:last-child {
Continue to Article →

Octopress htaccess Alias plugin

I recently switched from Wordpress to Octopress, so all my URL’s are now different. This sucks because some of my posts are referenced on a lot of websites. Octopress is static and I didn’t feel like adding my own URL rewrites. Instead I looked a bit on Google and found two possible solutions: Rack Rewrite and Jekyll Alias Generator

Rack Rewrite

This is a ruby based alternative for rewriting URL’s. This means that you need to host your website as a ruby application (e.g. Heroku). Rack Rewrite looks a lot like mod_rewrite from apache and is very easy to use. Since I publish static HTML pages to my Dreamhost account I cannot use this ruby based solution.

Jekyll Alias Generator

This is a really cool plugin that will read the alias property of your post and then create a folder and index file with the redirect. This is a great will-always-work solution but also means that your public folder becomes very large. Maybe my OCD could not handle the messy directory structure.

Meet Octopress Apache Alias Generator

Instead of having a messy public folder, I decided to create my own plugin starting from the Jekyll Alias Generator. Instead of generating a folder with an HTML file that does the redirect, I would create a new Apache redirect in the .htaccess file.

Continue to Article →

The power of Google Docs

I’m using Linux which has no decent Office Word alternative that doesn’t look like crap. I’ve used Libre office and Open office but they never could replace the easy user interface of Office 2010 and the formatting features. My only solution was to use virtual box so I could have Word 2010.

Recently I had to share a document, so I used Google Drive. The document itself contains a long list of questions and answers that need to be numbered so I could easily refer to a question.

In word you can create styles and indicate they should be numbered, in Google Docs there was no option to do this. A bit disappointed I start some Googeling and found out you can program almost every aspect of Google apps!

The possibilities

The documentation is really gigantic and allows to do very interesting stuff. For example, you have your Google apps enabled website and would like to setup some fancy file permissions for a couple of users with different rights. With Google Scripting you can easily extend Google Drive to allow this kind of behavior using JavaScript-oriented programming. Another example is pulling out some Gmail statistics for your user account.

I don’t know if this will every become popular, it seems to me people now use it for personal projects and hacks. Google Scripting allows for new opportunities in the way their product can work together.

My first attempt

Back to my problem, getting the questions numbered. I used a heading 4 for all my questions and then used the following script to automatically number them (and re-number them) if needed.

Example of a Google Script
function addHeaderNumbering () {
    var pars = DocumentApp.getActiveDocument().getBody().getParagraphs();
    var index = 1;

    for(var i=0; i<pars.length; i++) {
        var par = pars[i];
        var hdg = par.getHeading();
        if (hdg == DocumentApp.ParagraphHeading.HEADING4) {

        var content = par.getText();
        var chunks = content.split('. ')

        if(chunks.length > 1) {
            par.setText(index+'. '+chunks[1]);
        } else {
            par.setText(index+'. '+chunks[0]);
            index = index +1;

Using this small piece of code my question are numbered as long as they have a Heading 4.

From Wordpress To Octopress

“My blog is death.”

That thought run through my head a couple of times the last few months, followed by a quick “I’ll write something tonight,…”

It’s been a long time since I ever felt the need for a new blog post. And I fully blame the retarded slowness of Wordpress (or my lack of inspiration). Don’t get me wrong, I really love Wordpress but not as a blogging platform, not anymore. They have changed their product from a simple “Blog-It” to “Do-Everything-It”. Which is really great for people who are familiarized with the aspects of coding Wordpress or writing layouts.

After some Google intensive research, I came across Octopress. A ruby based blogging platform that works with static pages and based on Jekyll. I’m currently active developing in Rails so a Ruby base solution is very appealing.

A blogging framework for hackers.

Brandon Mathis Octopress
Continue to Article →

Particle Filter Implementation in Player/Stage

Player/Stage has a particle filter build in called the Advanced Monte-Carlo Localization driver, I’ve done some tests with it but I’m not really happy with the results:

  • A starting position and orientation has to be given (not really a requirement but the algorithm tends to fail else)
  • Particles can move through walls or be placed on walls
  • The initial particle distribution does not fill the complete map

This makes the algorithm quite useless. I have two options concerning my Master Thesis, create my own or change it so it does work as expected. I decided to create my particle filter from scratch, later on I’ll decide if I’ll adapt the AMCL driver or create my own. The code is based on the online lessons from Udacity (by Sebastian Thrun).

Continue to Article →

Home Automation using DASH7

The goal of the project was to implement a basic Home Automation using DASH7. We had limited resources, worked in a group with 7 people and had only 8 days to finish the project.

The goal of the project

The project overview of home automation
The project overview of home automation

The idea is illustrated in the following image. A server is used and utilises a self-learning algorithm that learns preferences of the user. The user has a smart phone and can adjust the environment, these adjustments are registered on the server and used in the self-learning algorithm.

So a little example, I walk in the room and the light turns on, I find it to bright so change it to 70% from the original 100%. I do this every day for 3 days and on day 4 the light switches on, but instead of the 100% illumination, it is only on for 70%. The system learned my preference and applied it.

The smart phone communicates with the server using WiFi and the server must communicate with the application (light bulb, oven, water heater lamp, light strip…) using DASH7 technology.

We were free to choice the applications and the mobile application (dedicated, web-based universal or hybrid). There were only 8 days left and we were allowed to take short cuts (aka dirty code and tricks) to get a result. Continue to Article →

ArduinoPi v1.6 and release of ArduinoPi Python

Today a new release of ArduinoPi and the first release of the Python version. Lets start with the ArduinoPi v1.6.

ArduinoPi v1.6

Not much has changed, no new features, but if anyone has a request feel free to ask! To start, it’s now only possible to request an analog port using the right number. Using “A0″ will not work, instead use 0. A small change.

I’ve also remove the writable option in the switch statement. It’s a shame you can’t check if a serial port is writeable or not (only readable) I implemented this myself in the core libs but forgot to remove it, mea culpa.

ArduinoPi Python release

The last few months I’ve taken lessons on Python using codecademy. So I decided to convert the ArduinoPi PHP class to Python (the mother language of the RaspberryPi). The code is available in another GitHub repo (to make it easier) located here

This is my first real Python project so if there are any no-goes Python wise please say so in the comments. The functionality is rather limited, it’s possible to send digital, pwm, analog, multiple-pwm and multiple-digital commands to the Arduino.

Later on I’ll include more options in the python interface. Before using the ArduinoPi Python make sure you installed pip (sudo apt-get install python-pip).

After that you must install Flask and PySerial using the pip command as follows:

pip install Flask
pip install pyserial

Now you can just run the script using python I didn’t include an HTML example yet but you can go in your browser and type the IP address of your PI followed by port number 5000 and then use the commands from API documentation post.

The commands work the same as the PHP version, the only difference is the port number. All the responses are in JSON so you can use AJAX to make a call to a specific URL with POST or GET and get the desired result.

Stay tuned for more updates and more features!