This is a quick demo showing how you can use a $100 inertial measurement unit and a light weight laptop as a rough version of the Oculus Rift VR headset. A friend and I have a game idea we wish to build for the Rift but since units won't start coming until around December, and neither of us ordered one (since we didn't have the idea during the Kickstarter campaign), this is our "close enough" workaround.
Sample code for driving a Unity3D camera using an IMU is available on my GitHub page. [edit: 02/07/2013, now updated for the TinkerForge protocol 2.0]
Yesterday I finally received my inertial measurement unit (IMU). This is a tiny unit containing a gyroscope, accelerometer, and magnetometer. The gyroscope measures angular rotational velocities - how fast the unit is rotating around three axes. The accelerometer measures the accelerations along each axis - how fast the unit's speed is changing along each axis. The magnetometer measures the effect of prevailing magnetic fields on the unit - assuming the magnetic fields around the unit are non-changing, this provides a coarse measure of the unit's orientation.
All of this information is mashed together in a Kalman Filter (more specifically, Seb Madgwick's implementation of Rob Mahony's Direction Cosine Matrix (DCM) filter.) This filter integrates the gyroscopic information to determine orientation, and minimises error via feedback from the double-integration of the accelerations and the magnetometer information. This page at TinkerForge describes the IMU unit in detail, and the underlying equations can be found in Madgwick, S. O., An efficient orientation filter for inertial and inertial/magnetic sensor arrays, University of Bristol, April 2010. Overall, and especially considering it costs less than $100, this unit is awesome!
This particular IMU is actually built around a 32bit ARM processor, which does all the filter calculations onboard and processes USB commands to access the API. You simply run a daemon on your PC which translates TCP/IP commands to USB, and this then allows the manufacturer to have very simple APIs in a variety of languages, since they all just talk TCP/IP. Personally, I'm using Python because this project also makes heavy use of OpenCV which has Python bindings.
Ok, so what am I doing with it?
Well, first up, I stuck it to a laser projector. With tape.
Then I wrote some Python code to rotate and translate the image given the IMU's readings for orientation. In the image above, I'm taking my laptop's camera as the input image. I record a base orientation and then measure differences compared to this. The image gets rotated by the opposite of the change in roll. It gets moved left or right by the change in yaw, divided by the horizontal field of view angle, multiplied by the projector's horizontal number of pixels. Likewise, it's moved up or down by the change in pitch, divided by the vertical field of view angle, multiplied by the projector's vertical number of pixels.
For those readers who've not done IMU to sensor frame transformations before, this is one of the dodgiest hacks known to mankind. Despite this, it kinda sorta works.
This picture was awkward to take: My laptop is filming me. The projector is drawing the output on my wall. And I'm struggling to take the photo with my phone.
You know what - I'll just make a video... Stay tuned for part two! :-)
I've talked to a few people offline about the effect Hacker News had on the audience for my recent post. Essentially, what was written as a cathartic rant for my own sanity turned into 24000 page views and an inbox full of job offers. Sure, not all of those 24000 actually read what I wrote, but it's interesting to look at the statistics and work out just how many really did. For those of you with websites that already garner millions of page views each month, this will probably be uninteresting. If however you're like me, and this is more people reading your words than your entire academic output put together, it's worth thinking about whether it's repeatable, and how to use its powers for good (or evil...)
Overall, my post spent about 8hrs on the front page of Hacker News, reaching as high as position #5 (HN has a time-based curve - your post will only stick if it's young with a fair few points, or old with masses of them.) It eventually garnered 93 points and 38 comments. People clicked the Twitter button 101 times (which amazes me, since I didn't even bother doing that and I wrote the damn post) and Facebook 'like'd it 43 times. Clearly a bunch of people manually tweeted about it too, since there were lots of differently formatted tweets about it when I searched.
My webhost's statistics say it was viewed 23841 times and Google Analytics - which I only thought to install about an hour after posting it - tracked just under 17000 unique visitors (obviously missing the first few hours.) In an attempt to work out whether this was representative, I found a few other people discussing the effect on their posts; David Zhang of simply.io, the guys at elastic.io, and a few others. Nowhere near enough data for a representative sample, so label this inconclusive.
Of these visitors, the bounce rate (the percentage of visitors who leave without navigating to another page of the website) was 90%, and a different 90% stayed for less than ten seconds. Ouch. On the other hand, I guess that suggests that those who did actually read the article "converted" by looking over at least something else. In terms of page depth, 5.63% hit two pages, 1.57% hit three, and exponentially lower thereon. It was a long-ish post that probably took two to three minutes to read fully; roughly 1500 visitors stayed at least that long reading it and/or other pages.
More interesting than raw web statistics however are the subsequent effects, especially on my email inbox. I ended up with 26 emails from people I'd never talked to before. Of these, 14 were people thanking me for discussing a topic that resonated for them, or for bringing some reality to the tech media blanket coverage of this and that startup raising millions of dollars (and, often enough, being abandoned within six months.) Another eight were offers of collaboration from people starting their own businesses, or with technology projects in which they thought I might be interested.
The final four were preliminary job offers - I don't mean "this job pays $X and if you say yes you'll start on monday", but more like "you sound like you might be interested in and the perfect candidate for this job, let's have a chat about it". This is the valuable bit. Compared to sending your résumé into the lion's den of HR and hoping your choice of perfumed paper makes the grade, having potential employers come to you instead is a far more pleasant way to operate. I even got a free lunch out of it yesterday - they do exist!
To summarise the Hacker News effect; it's definitely valuable. HN gets ~150k unique visitors in a day. The vast majority only view the front page. Given my post was there for about 8 hours, let's assume 50k of those uniques saw it, which means nearly 50% clicked through. Of those, 90% abandoned it immediately. Of the remainder, only about 10% abandoned before finishing the article, i.e. around 9% of the total HN traffic read the whole thing. This is in agreement with a BoingBoing article that discusses the readership habits of various traffic sources (the original source is here, but the graphs are broken), concluding that HN readers stick around longer than those from any other referrer. Of the attentive HN traffic, around 50% read something else on my site, around 10% tweeted, liked, commented, or somehow promoted it on, and about 2% got in touch with me directly.
If you've read this far, you probably shouldn't follow me on Twitter because I've got very little idea why it's important.
I've learnt a lot of things since quitting my job, but by far and away the most important is how to get a decent coffee out of La Sorrentina.
For those that don't know, La Sorrentina is an Italian coffee maker, reproducing the 1946 'Atomic' design by Milanese designer Giordano Robbiati. It's occasionally denigrated as merely a high-class Moka pot, but is actually far better. Able to reach around 5 bar of pressure, it's possible to get a reasonable crema and excellent steam volume.
However, despite these strengths she's even more temperamental than the infamous Miss Silvia, and making a decent espresso requires a series of tricks, none of which are detailed in the manual. There's a few videos on YouTube (this one is terrible and you can do far better, this one is better but doesn't explain how he got there), but not much by way of a technical description. I hope this post goes some way to fill that gap.
The basic process is simple enough:
There's a lot of "right amounts" in that process, none of which are adequately explained. Chances are your first few attempts will result in some of the worst coffee you'll ever force yourself to drink because you can't possibly discard it after all that effort.
Here's tip #1 - throw away your first ten coffees. They will not be worth drinking, and you'll end up thinking it's a bad machine. It's not, it just takes a bit more care and attention than most.
The process to get a drinkable coffee is a bit more involved - not harder - just more involved.
Firstly, let's resolve those "right amounts".
The right amount of water is easy enough to find. When you empty the remaining water in step 12 of the basic process, empty it into the (cleaned!) coffee jug. Mark this level with a permanent marker or scratch. This is the minimum quantity of water you need. If you're making one espresso, add a 30mL shot more water. Add a dash more (maybe another 15mL if you want to be precise) for the steam. Two espressos, two shots, etc. Any water you add above this minimum will end up pouring through as coffee or get turned into steam. For a single shot of espresso, this extra ends up being about 2mm above the mark I made, and roughly halfway up the jug.
The right amount of coffee is also easy - however much you can fit in the damn portafilter! Yes, this is far more than the manual recommends. Yes, you'll be "wasting" coffee. Shut up. It'll taste better. Trust me.
The right amount of force is also easy. Work out how hard you intend to press down with your tamper, and be consistent. (Experts recommend 15N of force. Unfortunately, my arm doesn't come with a spring balance inbuilt.) That's it. This is now the "right amount" of force - it's right for you, and that's good enough.
The right grind is more difficult, and you will have to experiment. It is nowhere near the "medium coarse" suggested by the manual. It is much closer to "almost as fine as your grinder can get". The best strategy for finding the sweet spot is Isaac Newton's "halving the interval" method:
Start at the coarsest espresso setting and make a coffee. It'll almost certainly be weak, thin, and foul smelling. Move to the finest espresso setting. Make sure you've very firmly attached the group handle to the machine. At this fineness, it'll almost certainly blow the pressure release valve before any coffee pours at all, and you definitely want the valve to blow instead of the entire group handle flying off the machine! (Here's tip #2 - always remember to open the steam valve before removing the group handle. You'll probably have to learn this the hard way too. Trust me, you won't do it twice...) Turn the heat off, open the steam valve fully, and walk away. When the machine is cool and ready for you to try again, split the difference. If it's still weak, split again in the finer direction. If it's still blowing the pressure release, split again in the coarser direction. Repeat until you've found the sweet spot.
This description makes it sound like you'll just know the sweet spot when you see it. Chances are, you'll have a rough idea but so many gradations on your grinder that there's two or three that are all reasonable. Here's tip #3 - the sweet spot is when the pressure release valve does blow, but only after most of the coffee has already poured. Why? Well the first part of the coffee extraction process releases medium-thick, black coffee. Very aromatic, but not the best bit. What you're really after is the brown, very thick crema that comes second. Since this is thicker and less viscous, the pressure in the group head has to increase a bit more to force it out. So you're looking for the early stage pressure to be below the limit, and the later stage to be just above. The machine will be fine with this, but you should ideally be turning the heat off within 15-20 seconds or so of the valve blowing, even if you're busy frothing milk. Be aware that the machine will now be fucking hot. That's a technical term for "don't touch the metal bits."
The right amount of time is easy enough, as it's related to the right grind. From cold water you can expect it to take 5 to 7 minutes. From just boiled (my recommendation) expect around 3 to 4 minutes. You should turn off the heat before what's pouring out is no longer crema but weak thin watery coffee. Sometimes you'll get good crema after a bunch of big oily bubbles, but usually these bubbles are a sign that the crema is ending. In the ideal world the crema will pour as a thin stream, perhaps curling in on itself like a pig's tail. You'll then remove the jug, (replace it with another or a cloth - what pours out now is horrible and will foul your coffee), texture your milk, and turn the heat off either as you remove the jug or in the middle of the milk frothing process. There should be enough steam to make one person's worth of milk with the heat off, but you may need to leave it on for some of the time if making milk for two or more people.
Ok, so that's all the "right amounts" sorted. In summary:
In addition to my first three tips, here's a few more:
Ultimately, after much experimentation, you should be able to get a decent coffee. I'm a harsh critic, but the best I've done is about a 7/10. For some sense of scale, I've only ever had two 10s in my life, I consistently get 8-9s from Campos' (arguably Australia's best coffee) baristas, I could regularly make 7-9s from a $2500 dual boiler ECM Giotto or Cellini Rocket, and I usually think the average cafe coffee is anywhere from 4-6 (7 if the barista has any idea what to do.)
7/10 is pretty damn good for a $400 single-boiler machine. La Sorrentina can make a decent coffee.
If there's enough demand I can make a video of the process, but the real takeaway from all this is that it requires a bit of experimentation. Persist, and don't fall into the trap of thinking it's a bad machine. Let me know your tips or any parts of this you disagree with in the comments below.
This was my last job. That's me, in a helicopter, telling an eight-wheeled killer death robot what to do. And getting paid handsomely for the privilege.
It was awesome! So why the hell did I quit?
Well, I had an itch. I thought I wanted to start a company and ride the coming robotics revolution to fun and profit. The reality was something quite different to that, I just didn't know it at the time. Everybody I knew (and I really mean everybody) advised me that this was foolish. That I had a four month old child to support and a wife who wasn't working. That I had a mortgage to pay. That I had a seriously awesome job and an obvious career path into one of the largest and highest paying companies in the country. That the startup lifestyle is hard work, stressful, and nine times out of ten - fails.
They were all right, but I couldn't listen. I had to learn this lesson for myself.
So I started a company (well, actually, we didn't get around to incorporating it, which turned out to be a good call) with two friendly colleagues, quit my job, and didn't think much about step two. We had some plans for synchronised collaborative whiteboards, and started plotting how to get funding to make this happen. We approached a business incubator who were very keen on us, less keen on the idea, but put in a lot of their time getting us to take a customer development approach.
We did, and it was horrible. Over the next three weeks we talked to lots of potential customers - less than our advisers wanted, but more than enough to discover that our product was too expensive for the marginal improvements over related products. We moved onto product number two, followed the same approach but faster, and found the product to be less useful to people than we'd thought it would. At this point, one of my co-founders decided he'd have much more fun just building things without worrying about whether or not they'd make money, and promptly left.
Product number three actually had a lot of interest. We found a great niche of customers with a big problem, and our product would have fixed it beautifully. Unfortunately, despite the customer development process looking good here, from a product point of view we concluded we couldn't make it cheap enough. (On the up side, in a few more years time all the components should be cheaper and better, so its something worth revisiting in the future.)
After three rounds of this disappointment, my remaining co-founder lost interest and went AWOL. I can't blame him. I'd sold the vision of an awesome startup company building amazing technology and enjoying the process. Instead we'd experienced what is likely much more typical; hard work, disappointment, and not much to show for it other than the knowledge that it was better for these ideas to fail sooner rather than later.
At this point I burnt out. In true burn out fashion I didn't realize this, and kept pushing on with coding, meeting people, talking to customers, and the like until my body engaged in a cunning plan to weaken my immune system and make me get sick so I'd stop. It took a full week of not doing anything at all before I realized what should have been obvious at the outset: I don't care enough about money to run a startup business.
I want to work on cool, innovative, novel, and exciting projects with interesting, motivated, and motivating people. Provided I can earn enough by doing that (and enough isn't even that much in the grand scheme of things) I'm not too bothered whether I work for myself or for someone else.
This begs the question however; why did I quit a job that met all these criteria? The easy answer is that I knew I didn't want to be an academic. But since the job was a stepping stone to a similar, higher paying job in industry, there's a more complex answer hiding away in here somewhere. Ultimately, I think it's that I want to move a bit faster, have more opportunity for learning, and to see my work get used by real people. Academia is slow, procedural, and if more than ten people care about your work, you're probably doing well. As an example, since quitting my job, a paper I wrote eighteen months earlier has only just been accepted.
This whole post has told the story through a lens of failure, but that's not the only way to read it. I recently stumbled upon Robbie Abed's article on how to find your dream job. Roughly summarised; quit, start a company, expect it to fail, tell everyone about it, build a new network, talk up your product (not yourself), help people out, and finally "Accept Failure. Ask For Help." Sure, I didn't set out like this, but if I tell this same story through that lens instead, then I'm already up to step eight and ready to rock whatever opportunity comes knocking.
Maybe it's your company - if you need an inventive, capable, problem-solving engineer, get in touch.
It's an increasingly common refrain of the startup entrepreneur - "Patents are broken!"
Clichéd though it may be, I believe it to be completely true.
This week is my first week working on Triple Point Robotics full-time. I quit my secure, well-paying, and generally pretty awesome job to work on this because I really want to see more robotic technology available to the general public. I know how to make it happen technically, but running a company has its own share of problems which I'm rapidly discovering. I'm pretty sure patents are going to be a persistent, huge, and irritating one.
The main issue is that every obvious idea has been patented already. EVERY. SINGLE. ONE. Regardless of the fact that patents are supposed to be non-obvious to an expert in the field, there are about a thousand patents covering minor - no, let me rephrase that, completely trivial- variations on already obvious ideas. Even the process of being a patent troll has been patented!
Have you ever tried to buy a domain name? It's the same problem in a different guise. It's so cheap to buy a domain name that cyber-squatters have literally coded what amount to dictionary attacks on domain name registrars to purchase every available verb+noun and noun+noun combination in the .COM TLD. Patents, although stupidly expensive for startups, are so cheap for big companies that they patent tens if not hundreds of things each week.
In my previous job, I was called upon to skim the patent landscape for devices related to measuring properties of a borehole. I found a patent on transmitting information wirelessly from down a hole to a device outside the hole. I found another on recording information down the hole on any medium, then removing it and reading the information off it at the top. In other words, you can't measure anything down a hole without violating someone's patent. Arguably, even putting a stick down a hole and looking for the water line violates these patents.
How did anyone conclude that measuring something down a hole was non-obvious? What kind of idiots does the USPTO have working for it that they couldn't guess that the logical ways to get information out of a hole are to transmit it out, or record it down there and bring it up afterwards? Why do we allow this kind of crap to be regarded as intellectual property, let alone intellectual?
The next stage of the problem occurs for slightly non-obvious things, or obvious but technically difficult things. Oh don't worry, they're also all patented already, but there are few if any products available that implement any sufficiently complex patent. Take for example the fairly obvious idea that if you point a camera and projector in the same direction, you can show an image on a whiteboard, annotate it, then record the result. There are at least 80 patents covering this exact same concept - I know because I've read most of them over the last few days.
People have been having this idea since at least 1990 (Xerox has this one for example) so why, 20+ years later, can't I buy a product that does this? There are plenty of "interactive" whiteboards (about 80% of these are essentially a camera-projector system with some form of electronic pen, the rest are hugely expensive giant touch screens), but despite all the patents on the idea of doing this for a "Plain Old Whiteboard" as a form of backup, you just can't buy one. (Amusingly, if you search for "Version Control for Whiteboards" you get our products page :-), and then this hilariously over-engineered protocol for when people should be allowed to erase stuff from a workplace whiteboard.)
So what's a poor entrepreneur to do? I posed this question on Quora and the best answer so far is the most obvious - infringe anyway and deal with the consequences later as a cost of doing business in an archaic intellectual property system. There are other options, ranging from 'give up and go home' through 'try to negotiate a license' or 'modify your product to get around the claims' to 'ignore it and hope they don't sue you before you get big enough to patent a bunch of related crap you can use defensively'. But if everyone is infringing, patenting crap just in case it's useful defensively or offensively, or using lawyers to find ways of worming their way around existing patents, then what on earth is the point in the first place?
Am I just a hopeless libertarian for thinking that a world without any patents whatsoever might just be a better one than one in which patents are just a giant tax on doing business? The standard argument trotted out against this suggestion is that big pharmacuetical companies wouldn't ever spend the money on research, animal trials, human trials, and FDA approval if they couldn't have exclusive rights to the drug design. Sounds reasonable, but why not have a special annex for drugs and ditch software and process patents completely?
That argument however, is one for another day. Today was for ranting about the minefield that is patent law. Thank you, Internet, for indulging me.
In the not-too-distant future, projectors will replace screens as the dominant mode of displaying visual information with a robot.
There are several reasons for this, but the most critical is that a screen can only go where you can physically position it. A projection can go wherever you can see. When you add to this the fact that projections are the only way of doing augmented reality that is physically proximate to the reality being augmented, and the best way of doing so for multiple people to see at once, it's clear that there's a huge opportunity here.
Unlike screens, projectors don't require semi-permanent infrastructure; you can put a picture in the same place on a wall starting with the projector in a bunch of different locations - or on a mobile robot. The power and data cords also go to the projector, not the projection - not so for a screen.
Projections scale more easily than screens; you can't make a big screen bigger, and if you shrink the picture there's a lot of wasted space. With a projector if you want the picture on your hand rather than the wall, you just point it at your hand. If you want the picture to be larger, you just move the projector away from the wall a bit more.
For robots, projectors just make so much sense! So why do most consumer robots with visual output on the market today use a screen?
I suspect that the main reason is an implicit anthropomorphism like that I discussed in my previous post. Designers still think that people want to look at the robot, so they put a screen on it.
I prefer a contrary approach: people shouldn't be looking at the robot - they should be looking at the information it presents. Given that approach, it makes a lot more sense to put the visual information where it's most accessible to the user, and I see no good reason why this should be co-located with the robot.
Technology should solve problems, but should do so in the least interruptive manner possible. For this reason, I want to see more robots that stay out of your way until they're needed, that don't bug you with notifications, that drive themselves from A to B, and that give you the information you want, where you want it.
Anthropomorphisation is the attribution of human-like qualities to another thing. People often do this with robots, saying things like 'it wants to drive over there' or 'it saw me and turned around!'. When this happens naturally it can be a great indication of user friendly robot. But note that it happens when the robot is in the hands of end users. By contrast, anthropomorphisation of design happens at the beginning of a project. The concept crops up in design and engineering all too often in the guise of 'well this is how humans do X, so our system should emulate that'. In many cases, and especially so in robotics, this is a bad thing™.
Why? Because it limits the space of possibilities that the designers might consider, and worse, it leads to systems that fail to exploit their strengths and instead compete with the strengths of a completely different system.
As an example, someone commented recently on an IEEE Spectrum article about Google's autonomous vehicles: "No doubt it's a great step ahead in automation... but but but. Something is wrong.. because ... We [Drivers] has no computers in our heads, so we don't measure lengths, compute logarithms nor adding two numbers when we drive."
In all fairness, this commenter might not have been an engineer or designer, but this is backwards thinking. And on the Hacker News post about the same article, more people suggested that Google's team should focus on visual sensing, with such comments as "the technology is impressive, but humans drive okay without LIDAR, radar, or GPS." (Again to be fair, this commenter clarified his thoughts later, pointing out that he meant they should look at visual sensing as well.)
Fortunately, Sebastian Thrun and his team are designing an autonomous vehicle to drive at and beyond the abilities of a human. They are not designing an autonomous vehicle to mimic what a human would do. They realise that computers are incredibly good at computation over massive amounts of data, and pretty lousy at almost everything to do with vision. Humans are pretty slow at calculations, but our eye/brain combination is amazing at spotting patterns, detecting changes, and spotting moving objects in clutter. So Thrun's team plays to computers' strengths - they pre-scan the world ahead of time (incidentally this is a very smart move by Google - their competitors will struggle with the scale required to do this) and then have the two comparatively simple jobs of working out where their current sensor picture fits into that map, and what the differences are. They don't use visual SLAM, they use a particle filter and (as far as I can tell), ICP for scan matching - computationally intensive, but again, playing to their strengths.
This is just one example, but this kind of thinking turns up again and again. When we talk to customers about mobile robots in their homes, and mention that we have a very neat omni-directional wheeled platform, they often ask why we're not using legs to avoid the dreaded stairs problem. This is constrained thinking, led by anthropomorphic tendencies. Why are legs the first solution people think of? Why not flying robots? (don't laugh too hard - four out of the first fifty people we spoke with suggested this! Relax, we're not going there...) Why not a flexi-track like a packbot? Why not a stair lift? Why not just bank on robots being cheap enough to have one on each level?
Humans work well with legs, machines don't. Don't ignore wheels just because nature did.
And that's the take-away message from all this: play to your strengths. Don't emulate nature unless your system is well suited to doing so. Stop anthropomorphising design.
This blog is very seldom updated. Having kids will do that.