What a year!

What a crazy year this was! In 2013 many important events happened in my life that would make this a very busy year.
To start, I began the year looking for a new job after 4 years working for Igalia. This meant that I had to travel a lot and move (with Helena) from the place I felt like home (the city of Coruรฑa), having to say good bye to many good friends.

This search also took me to the U.S.A. for first time where I met a very interesting company and people. Since Helena and I didn’t do our traditional travelling this year, going to San Francisco was definitely the most interesting trip of the year for me. I really want to visit it again some day together with Helena.
Then I ended up joining Red Hat, where I kept working with GNOME technologies — mainly on the Wacom related pieces — together with some of the best Open Source developers in the world. I also moved to Berlin, the city I am in love with, which meant fulfilling a dream we had for a few years. My dear friend Chris Kรผhl helped make this move smoother so I have to thank him here again.

After just a few months in Berlin, I received the positive result of an application to CERN that I had done before all this and I had to make yet another decision. We decided to do it and we moved out of Berlin just shortly after knowing that we will become a family of 3 next year! Our little girl Olivia will be born next March and we cannot express how excited we are about it!

Life in this region is very different from Berlin’s (not bad, just different) but CERN is a very unique place and I am enjoying the experience.
Our arrival here was also easier because of Quim and his wife Ana Marta, a couple of friends from University who really couldn’t have helped us more. Together with our good friend Nacho, they are really “5 stars” as we say in Portuguese ๐Ÿ™‚
I need also to mention my parents who not only helped us with moving out of Spain but also drove all the way from Portugal to France in order to visit us and bring us our stuff.

Technically, I live in France, in a small town called St Genis Pouilly, close to CERN on the French side of the border but it’s really still Geneva’s area. A curious thing about Geneva is that its largest foreign community is the Portuguese. I hear more people speaking Portuguese at the supermarkets in here than in Algarve ๐Ÿ™‚
One of the things I miss from Berlin is the possibility to easily ride a bike anywhere. In here it is dangerous (drivers are crazy and there’s no bike lanes) and less convenient (Berlin is flat, here it isn’t) but I found another physical activity to compensate a bit my sedentary job: I started playing squash and I love it!

As a result of all these changes, my personal projects got a bit neglected. I released only one new version of Skeltrack and OCRFeeder (actually I got a new version of OCRFeeder almost ready to ship) and I did a couple of quick hacks with the Leap Motion Controller.
The number of books I read was also lower than ever this year. I read a couple of books by Cory Doctorow and a spy thriller called The Shanghai Factor.

Not all things in 2013 were as great as my words might indicate. My grandmother (to whom I was very close) passed away a month ago. It was a very sad event, but she lived a long life and had her family beside her in every moment.

About 2014, my biggest wish is that everything goes well with the baby and Helena. I think I will probably have to miss some of the Open Source events I usually attend but I got a good excuse, right?
I hope it’ll be a quieter year than 2013 in terms of moving and that I can still dedicate time to my personal projects.

2013 was a year I will surely remember all my life. I am a lucky person to have had the opportunity of different experiences, to have friends in many places and to have my wife and family supporting me all the time.

I wish you all an excellent 2014!

Olivia in Helena's belly!

Playing GTA V on a PS3 with Leap Motion

I have a PlayStation 3 and I love working with new types of user input so, as my last hack of the year, I wanted to use the Leap Motion Controller to play some game on the PS3.
The Leap Motion Controller is obviously not compatible with the PS3 so the plan was to use a regular computer, interpret the gestures from the Leap Motion, and send the respective controls to the console.

For the game, I chose GTA V because it involves many different actions such as running, jumping, driving or shooting… and it’s awesome!.

Here is the video of yours truly using this script to do some disastrous driving but having a lot of fun with the Leap Motion and GTA V:

The reason why the big video has such a low quality and the tiny one is fine is that they were recorded with my Nexus 5 and my Canon S95, respectively, and my living room was very dark.

How it works

As seen in the video, it is also possible to control the PS3 menu and choose the game from there. The player’s actions I chose to implement were walking, running, jumping, driving and enter/leaving a vehicle. All of those were easy to implement except for the driving. The thing is that I can easily get the angle for the imaginary steering wheel that a user does with the Leap Motion device but I could only simulate turning the left analog stick fully to the left or to the right. This makes it kind of difficult to steer a car, as can be seen in the video, but it’s still fun to do it.

For the communication with the PS3, it uses the GIMX project which makes it possible to simulate a SixAxis game pad from a computer and send its actions over bluetooth to the PS3. GIMX has some nice utilities, being its main one the emuclient which detects key events and uses a configuration file to map them to the actions of the SixAxis. It would be much more elegant to send the commands to the PS3 directly from the script I wrote but it was simply faster to instead simulate the key events and let GIMX do the rest with the right configuration file.

As with the Leap GNOME Controller, this is a small script rather than a big project. To know how to use the project, please refer to the README file that ships with it. Hopefully someone will like to try it out and improve the current gestures or make new ones.

Get the source at GitHub and have a great 2014!

Controlling GNOME with Leap

When I explained how the Leap Motion device could be used on Fedora 19, I mentioned how I had one of those early prototypes. Well, Leap Motion was extremely kind and sent me an actual device as a thank you for starting the thread asking for Linux support. Now that GUADEC is over and I am spending my vacation in Portugal, I had a little time to play with my fancy new device and wrote a relatively small script to control GNOME with it. I call it the รผber original name of: Leap GNOME Controller!

For those who don’t care about technical details, here’s the video showing what can be done with Leap, GNOME and this script. Technical details follow below the video:

The two videos that compose the one above were recorded with an HD camera and GNOME Shell’s screencast recorder. I tried to sync them the best I could but a certain delay can be noticed, especially at the end of the video.

The code

Leap Motion provides a “close source” shared library and a high-level API with the respective documentation for the many bindings it has. To code it quickly, I used the Python bindings and Xlib to fake the input events.

Leap Motion’s APIs make it really easy for one to simulate a touch-screen. It even offers a “screen tap” gesture that should be the obvious choice when mapping a finger touch/tap to a mouse click. However, this didn’t work very well. The problem is that if we are tracking one finger to control the mouse movement, when performing the “screen tap” gesture, the finger (and mouse) will of course move. Making it as frustrating as seen on ArsTechnica hands-on video.

I came up with a solution for this by dropping the “screen tap” gesture and using the “key tap” instead. The “key tap” is a simple, quick down-and-up finger movement, like pressing a key. This is much more precise and easier for a user to do than the “screen tap”. Of course that when the finger moves for performing the gesture, the mouse pointer would move as well, so I came up with a little trick to work around this: when the mouse pointer doesn’t move more than a couple of pixels for half a second, it will stop and only move again if the user makes it move for more than 150 pixels. This allows for the user to stop the pointer with precision where it needs to be and perform the gesture without making the pointer move.

Future

The Leap device offers a lot of possibilities for adding many gestures. Ideally they should be implemented per application but being able to control the shell is already pretty useful, so it would be wonderful to fine-tune the current gestures and add new ones. I also wish the library’s source code were open because I ran into small issues and I wish I could take a look at the source code, instead of trying to fix it based on the theories of what might be wrong.

I haven’t explored the AirSpace appstore yet so I don’t know if it is worth adding (or possible to add) this script there but I will check it out.

Have fun with Leap and GNOME!