Hackdays, Gesture Control, Drones and Minority Report

On Slideshare’s 7th birthday, the engineers at Slideshare were treated to Slideshare’s special treat: the Internal Hackday. If you have been anywhere near Slideshare’s Hackdays before, you know that they are a breed of their own. There are people pulling all nighters, there are others struggling to, but succumbing to fatigue and sleep. There are people who lock themselves in a conf room and yell at anyone who tries to feed them food. And there are those who like to walk around dispensing product advice. But one thing is for sure, you know something is up when you look at the haggard, unkempt bunch with a frenzy in their eyes. Plus the sales at the cigarette shop at the corner goes up as worried geeks pace puffing anxiously. What I am trying to say is that the energy at these Hackdays has to be seen to be believed. This one was the same as teams began their pre Hackday brainstorming, shortlisting ideas and discarding them before finally settling on one they thought would win them the prizes.

I have been in a few of Slideshare’s hackdays before and decided another one with a script/server wasn’t going to be fun. Decided I wanted to do something different. A few ideas later, i began to tend towards getting an ARDrone for this hack. The fact that I encountered demos at both rubyconf and jsfoo about the ARDrone probably helped. Also, the past year has seen much more support in various language for the ARDrone. Add to it the fact that the past few months had been colleague after colleague unboxing LeapMotion devices and it doesn’t take long for a nerd’s mind to make the leap. I named the project ‘Minority Report’, pulled up the submission form and signed on the dotted line.

While I had grand plans to have the ARDrone detect faces, recognize people and shoot nerf ammo at them, the reality of a two day hackday meant that I had to trim it down a much leaner and sweeter MVP.

As the gong rang, I lugged my ARDrone into the office and the surprise on my colleagues’s faces set the mood for the hackday. The fact that they were worried about competing with something that made them drool made it all the more fun. I spent an hour playing with it and amusing them (boys will be boys eh?) and then settled down to code.

Turns out that writing coding to interface with real life devices has its own unique challenges. Who imagined that I would have to go get a muscle relaxant spray after a couple of hours because my shoulder began to ache painfully because of me holding my arm over the LeapMotion? Or that you always had to be prepared to duck when the drone was a meter away? Or that you had to factor in an hours recharge time after a 15 minute flight? Or that you had to include a safety instruction slide in your demo pitch so that people knew what to do if you drone decided to fly into them?

Well, as I said, interesting. And tough. I had initially wanted to use opencv for face detection and facial recognition, but turns out what you want to do and what you can get done are two different things entirely. After struggling a few hours with compile flags, 32bit vs 64bit compile modes and commenting out lines .h files I decided that trying to compile opencv at 3 am in the morning while still working through the actual product’s ruby code the next day wasn’t going to be practical. Time to fall back to plan B.

The hack started off well as getting gesture information into the ruby program was simple. The setup was quick and the packaged software was reliable and smooth. The problem however, was sensitivity. The LeapMotion is sensitive, let me tell you. Since it can detect a few predefined gestures, i had initially planned to hook into Leapmotionā€™s swipe gestures to control the drone. A few minutes of swiping later, it was obvious that it wasn’t going to cut it. For one, getting the gestures right was difficult. If your gestures aren’t smooth enough, LeapMotion doesn’t pick it up. Or you swipe up and you bring your hand back down to swipe up again, LeapMotion detects a swipe down gesture as well. You don’t really want to be struggling with your LeapMotion gestures when your drone has decided to careen towards the demo audience, right? So I settled for the hand objects that LeapMotion provided data about and wrote my own gesture detection code with gestures thresholds and so forth.

Once I had a decent setup going for how to control the drone, I hooked the drone up. Worth knowing that the setup for the drone is a bit tricky. You need to connect to the Ardrone’s wifi network. Since it is on udp, you can’t really be sure your drone is receiving your signals. In any case, coding the drone was fairly simple. I tried using artoo-ardrone, but finally settled on using argus directly. The drone has a bit of a lag from the time you give it a command to when it actually executes it. Just a second or so, but it is obvious and is a bit disorienting when you are waving your hands about trying to get it to stay away from a wall. Again, one of those things about the real world.

drone on table 2

The drone’s battery also runs only for about 15 minutes and has to be recharged for an hour. I should probably have gotten some spare batteries. Would have been able to test out the program in much more detail.

It took a few hours to get the code right, add in the necessary checks to ensure that the program would not crash due to a wrong gesture or any of the obvious edge cases and then it was time to write something relevant to the hackday host. The camera seemed interesting so I set up some code to pick up some image frames from the video feed and upload it to slideshare. Here are a few of those slides. Hack done! Time to make the presentation and finally demo it.

vishu drone photo

IMAG0280

The demo was great. We cleaned out a large area towards the front, and set the drone on a disassembed table tennis table. A few safety slides later, the drone was up. The audience actually enjoyed the demo. Turned out to be one of those cool hacks and when the judges asked what the audience though would with the first prize, the unanimous vote was for the drone. But since it didn’t really have much to do with slideshare itself, the judges had to pass. Here is a demo of the hack

I probably need to spend some time cleaning up the code a little bit and working on the face detection part. Maybe in a week or so. Feel free to look at the code over at Github. And do check out the official blog post on the hackday.

I got a Mac!!

Got a Mac at our Studio in the office yesterday. Wow, now I have used Linux, Windows and Mac. Though still can’t get it to work ok, with the projectmix i/o mixer. Seems to be a problem needing the latest 10.4.9 mac osx update. The mac doesn’t detect the projectmix i/o mixer though the drivers get installed. On trying to open the preference panel, I get the error: “Preferences error – Unable to open M-audio firewire preference panel on this computer.” The latest projectmix i/o driver seems to need 10.4.8 for working. The install file is huge and I am trying to work out someway to get the update on a CD from someone.

Will post later on how it goes.

Spice works for network inventory

Just got to install this wonderful software spiceworks. Though it was quite a big download for my network, I am impressed by this software, and whats more, it is free, thought technically I would categorize it as adware. But still, it is worth a try.

Once installed, you can set up details about your network, like the scan range and the schedule for scanning. Since I am not on a domain, I was happy with the feature to specify individual usernames and passwords for separate systems, though I would much have preferred the software to automatically try user password combos from a list, since users at my office change their ip addresses quite frequently. I don’t know how it would work in dhcp either, but in any case that would make it too similar to a password cracker, i guess (read word list dictionaries).
Once it begins scanning, it first makes a list of all ips on the network and then begins a detailed scan. It uses the wmi interface to get details such as machine specs, software installed, services running etc. You can even setup monitors that alert you if some unwanted software is installed. And as a bonus you get a helpdesk system also.

Additionally, spiceworks lets you directly add assets to your system. That can be things like UPS, stabilizers etc or printers. I guess that would be useful for me.

One bug, if you choose to download the same version that I have is that if spiceworks does a scan and finds a system for which it doesn’t have the account and password with sufficient priviledges, it gives you an authentication error. However, you can later add the account and password. But on the next scan, the software and services tab will show “This feature has not been implemented” To solve the problem, just mark it as a duplicate from the general info section and the next time spiceworks rescans, it will update the software list correctly.

All in all, I like it especially for what it does in quite a capable manner and you can’t complain about its slick interface either.

Getting Error in Oledbcommand IErrorInfo.GetDescription failed with E_FAIL(0×80004005).

A simple query like
select * from languages;
worked fine. But once I used
select language from langauges;
, i was thrown this error. A bit confused, I did a google search for the exact phrase and voila, I got this page http://www.dbforums.com/showthread.php?t=825416

Understood it and changed the query to
select [language] from languages;
Maybe access uses the language as a keyword.

Could not find installable ISAM in Visual Basic

I am just creating a small project in Visual basic, for database management of some radio related information. Tried out the visual data components in VB.NET Express Edition but they were a bit confusing. So I thought of going with oledb.
Used the Oledb.Oledbconnection class but when I tried dbconn.open, i got a could not find installable isam error.

With a google search on “Could not find installable ISAM”, the best i could get was a link from microsoft which was not useful, once i tried out all the options http://support.microsoft.com/default.aspx?scid=kb;EN-US;283881

However, just adding one vb.net to the search query gave me this from p2p.wrox.com and that had the solution http://p2p.wrox.com/topic.asp?TOPIC_ID=3381

Subscribing to the forum right away

That’s right! I missed a blasted blankspace and wasted an hour trying to locate it.
dbconn= New OleDb.OleDbConnection(“Provider=Microsoft.Jet.Oledb.4.0; Data Source=F:p1p2db.mdb”)
while the correct one should be
dbconn= New OleDb.OleDbConnection(“Provider=Microsoft.Jet.Oledb.4.0; Data Source=F:p1p2db.mdb”)

Cannot configure custom hostname in Outlook 2003

Shouldn’t software allow the user, if he really wants to, to make any necessary modifications in how it deals with data? Say I want to modify what hostname my mail client is sending to the mail server, shouldn’t I be able to?

We have a server over at Kerala to which we, at Delhi connect through VSNL VPN. It runs exchange 2003 (I guess, i never bothered to ask). Outlook works fine when connected as exchange server.

But it does take a lot of time synchronizing due to which I thought of setting my account in client as a pop3/smtp account. I thought it would be easy. But No!

I was able to download mails pretty fine but sending mails hit a snag. I was unable to send any mails. Outlook said something about the username or password being wrong, but I had just accessed the webmail through my browser and so I was pretty sure that I had the right password. Tried Check/Uncheck of all checkboxes and modifying server/connection settings trying to figure out a way to get it to work. (I use outlook 2003 by the way)

Gave up at last and fired up ethereal. And Ah! there it was. It seems the error returned was ‘ehlo domain invalid’. Took me a couple of hours researching until finally I stumbled on the smtp rfc. It seems a workaround is for the client to send the hostname to the ehlo challenge response in the format [ip.add.re.ss] or something. Telnetted to port 25 and got it to work. Why need an ehlo challenge when helo will work. And outlook doesn’t allow a custom host name, either. Is it something that the exchange server admin should do. It really would be nice if outlook allowed custom hostnames like thunderbird, but that I guess that is too much to ask from Microsoft.

Since I need to use an account that is also used by another person, who needs to view the sent mails as well (the same mails need to be shown on both systems), I guess anyway pop3 would not have worked. But I could have tried setting up other accounts through pop3 as outlook allows only one exchange connection for each profile.

So finally shifted my other two accounts on the domain to thunderbird. Once I set the custom hostname field in account settings, it worked like a charm. Thumbs up to Thunderbird.