2008-06-15

Motoman robot controlled by two Wiimotes



Some time ago I controlled a robot with a Haptic.

Inspired by Johnny Chung Lee I started to work on controlling the Motoman industrial robot using two Wiimote infrared cameras. It's a bit less accurate method than using Haptic, but it's much cheaper.


What you need:

  • a robot (or whatever you'd like to control)
  • two Wiimote devices
  • a software (okay, here's the source, but beware, it's beta, work in progress, not finished and hackish)
  • a pen with two infrared diodes
The main problem is that normal infrared diodes are directional. But for this project we need to see the diodes from the side. Normal diodes are only seen from the front. I found that the diode CQY36 is perfect (the first pen below, black one). The other solution is to use two SMD KP-3216F3C diodes (the second pen below).


Both pens have a meomentary switch, so I can turn the leds on when I want to move the robot arm. Unfortunately on the videos you can't see when the leds are lighting, so it can be confusing that sometimes the move of a pen is moving the robot and sometimes not.

First video (rotation on the Y axis is flipped and the video ends with a robot failure):


Other videos:



2008-06-06

LinkedIn graph - I don’t get it



At Grono.net, the network graph had more than 80M edges and about 1.2M nodes. You know how much RAM it used on the machines? 320MB. It’s a bit more than 4 bytes for an edge, because of alignment, plus few megabytes of index.

LinkedIn says they need 12GB RAM for keeping their graph with 120M edges. Wow. It’s 107 bytes for an edge! I think that the graph shouldn't consume more than 0.5GB RAM.

Their software has a bit more features - their graph is updated in real time. The biggest problem with this feature is that you need a good garbage collector and there’s a possibility that you’d have fragmentation issues. But what about updating the data every few minutes? Using my solution it would require two instances of 0.5GB graph (one is serving, other is loading) - 1GB RAM.

Okay. I use 32bits as indexes, they can use 64 bits. But it’s still only 2GB RAM!


I don't get it. What the other 10GB RAM is used for?


PS. The graph is easily compressible. With a bit of CPU you can highly compress it (I bet more than 4 times). Cpu is cheaper than ram, isn't it?

PPS.
The LiknedIn Architecture pdf.



2008-05-29

Concurrent programming: It’s not about the language, it’s the framework


There’s a huge discussion on the web about concurrent programming. Now we have 4-core processors and that number will double every few years. The problem is that programmers don’t know how to use multiple cpus.

There are several approaches that address this issue:

  • Intel is developing a compiler that’s going to automatically parallelize software
  • people from Python are developing extension that’s enabling Python to use multiple cpus using threads-like api (normal python threads use only one cpu - see GIL)
  • there are many extensions to C that enable easy writing of parallel software
  • Java has built-in threading support
  • everyone is admiring Haskell support for multiple cpus
  • some people believe that the Software Transactional Memory is the parallel processing silver bullet
I wonder if we need parallelization at this level at all. Maybe the next level over “one processor” is not “multiple processors” but rather “multiple machines”. Here are the strategies that are popular nowadays:
Erlang as a language is horrible. It’s the language for really determined programmers, because the learning curve is so steep. But the Erlang’s framework is excellent. You can easily scale over many machines, using the Erlang message passing you can accomplish more than in thousand lines in other languages.

I believe that the Erlang framework ideas aren’t tied to the Erlang language. I’d love to have so powerful framework for other languages.

Maybe we should skip the “multiple processors” phase and learn to use “multiple machines” technologies right now.