2011-09-18

Software degradation


Do you still remember BSoD (Blue Screen of Death)? In the times when Windows OS crashed because software was unable to handle hardware failure, users were cursing software developers for bad product. But has anything changed since then? Are there any new technologies to gracefully handle failures and avoid user disappointment? Or perhaps software developers have matured and never ever release programs that simply don't work?

We're tightly surrounded by technology these days and whenever I'm about to buy a new item I wonder if it will have a microprocessor and software running on it. Recently I've upgraded my TV from CRT to LED and, guess what, - now it's called "smart", which probably means I am dumb compared to it. And before TV there was smart phone, smart oven and I see there are coming along smart cars, smart robots, smart nano-medicine, smart prosthetic limbs...

And I wasn't so surprised to find out how buggy smart devices are - I've spent nearly a week trying to configure my laptop and desktop PC to stream media files to the TV. On the way I've seen my HDD disappeared from the drive list, then TV just rebooted (probably software crashed) and many more glitches that made me rip my hair in desperation.

Software is complex and there's no reason to believe it will get simpler any time soon. Actually complexity cannot be reduced, it can only be changed in form, or moved to another place by introducing abstractions. Testing can cover only main scenarios plus few alternative and error scenarios, but typically one simple user can think of use case that no tester has ever dreamed of. There is a paradigm known as "crash early", that basically states that one should never try to handle an error if origin of this error is unknown. Sooner or later software encounters unexpected exceptions that are not handled because there is no code that knows how to handle it, and program crashes (hence the name of a paradigm is "_crash_ early"). Paradigm is good for debugging, but really frustrating for a user, and that's why some software developers decide to catch all errors and silently ignore them. Perhaps that's even worse, because errors happen for a reason, and user can get even more upset when he's clicking on button but nothing happens.
Fractals in Nature

So, what will happen when software approaches infinite complexity? I hope we never do reach this point, but if this fate is unavoidable, then I suspect software development as a concept or technology will cease to exist. It's hard to imagine what comes next, I foresee a kind of "smart components" capable of decision making and self-testing that would interact with each other to build algorithmic system to solve defined problem. Perhaps a next generation neural-networks or self-aware computer systems?


I definitely know one system of infinite complexity - it's our universe. Can you imagine a software system that would make this universe run? ;)



2011-04-29

No more paradoxes for ya, old man!


"Science is beautiful and if you don't like it - f*ck off!",  R.Dawkins


Once in a while I like to contemplate on highly useless things, 'cause I think that's fun and feeds human curiosity. Oh well, let's roll out sc-fi classics - time traveling!
Talking about time traveling, there are many speculations on the mechanics and physics of the process that lead to certain paradoxes and the problem is, that one can't be sure which way it works - 'cause there are no observable evidences of time travel to the past. What's been troubling my mind recently, is grandfathers paradox (I wonder why it's not simply a "fathers paradox"?), which says that if one travels  back in time and slaps his beloved grandpa with a "Quantum physics Vol.I" so hard that poor fellow loses interest in proceeding with his life duties, let alone having children, then... what would happen to the time traveler? Would he still exist? Well, he just broke his heritage line, didn't he?
As a computer science expert I see a problem with this paradox explanation, - there should exist some complex information processing mechanism to remove time traveler from universe (and his father and children if any), once his grandfather has been eliminated. And how would particles forming his body cease to exist? Just simply pop out of existence? But these particles are not special, they just happen to be so lucky to get into one place and build time travelers body.
Alternative explanations, e.g. parallel universes/timelines and Novikov self-consistency principle doesn't look too promising either. Well, they explain the paradox, but then bring serious task to explain how they work at information field level.

So here I come, one more speculation to explain time travel paradoxes. It is often considered that time is a fourth dimension of space-time continuum, however there's one main difference between Euclidean dimensions and time - all known particles are moving only forward in timeline, but they can move in any direction in space. To be very precise, timeline direction points towards increased entropy, which brings us to a finding that traveling backwards in time reduces entropy. Stephen Hawking  has kindly explained all this in such a style that even dummy physicists like me could grasp the idea. And I make a conclusion here, that if time traveling to the past is possible, then either information field should memorize life-time of each particle in the universe (that's about 13.6 billion years!) or there exists a mechanism to move particles backwards in time. And again - the first way has problems to store gazillions of information, and the other one has to deal with uncertainty principle somehow. Or maybe when time is moving back, there's a symmetrical "Certainty principle" that can state where and how particles are returning? These are  the weakest parts in my theory, but if somehow they survive, I shall continue with my idea.

I find that traversable wormholes are most realistic (but still theoretical!) time traveling "devices", so let's illustrate how it works when time traveler enters mouth of the future wormhole. For simplicity I'll assume that time traveler is an elementary particle.
Click images on the left to enlarge basic scenario: particle advances forward in time and gets into future wormhole which reconnects with space-time some-when in the past, and the particle gets out just to see itself still traveling towards future wormhole mouth. At this point we two instances of the same particle at the same space and time region, which is basically the reason why grandfather paradox may occur: if older instance of the particle hits the initial particle, and it changes motion path, it won't enter the future wormhole mouth, so what happens to the older instance of the particle? Two clone particles exist now in the universe! If we keep repeating the process, it would multiply particle clone count beyond infinity (imagine what would happen if you put money into wormhole -  woohoo!) and puffffft - law of conservation of matter is gone. Just like that. If there would be any natural future-to-past wormholes of reasonable size in the universe, then this described matter-bloat would be easy to notice.

So, I made an assumption here - what if time traveling particle does not meet itself in the past and how could it happen? To illustrate I need another particle (the red one in the image on the right) that exists alongside time traveler particle, but does not enter the wormhole. Here's what red particle observes: both particles hang out around and then suddenly blue particle "disappears" in the wormhole. And the blue time traveler particle observes that red particle is sticking around, until wormhole approaches. Space-time starts bending and time traveler is seeing how time slows down for red particle (similar effect can be observed close to the massive body, like a black hole). At some point time for red particle stops (when wormhole timeline becomes perpendicular to  the main timeline) and then is reversed - red particle starts moving backwards. However, note that unlike when moving forward, now it is moving alone - time traveler is in the wormhole moving forward in local space-time frame. At the end of the journey time traveler exits out of past-wormhole mouth and finds out that only red particle is here. That's it folks, no more clones and paradoxes!

So, that's particles. And how about human time travelers? The more I think of it, the more fun it looks. While time traveler is in wormhole, his absence in main timeline causes effect that looks like some eraser is removing a person from existence. The more he travels in the past, the more of his life is "erased". People are still remembering this person, shaking hands with empty space when greeting and looking at the photos of someone who will be erased soon. Okay, that looks weird, maybe even creepy :)


Post factum. It took me a week to write this post, so now when I look at it in the end, I'm pretty much convinced that traveling via wormholes is not possible at all...

2011-04-17

Six legs - more power (Part I)


This post is dedicated to special kind of robots, - hexapods. Literally it means "six legged" robot, and I bet you imagine bug- or spider-like mechanical walker that is hiding under your bed and has come to claim your soul...




But there is another kind of hexapod robots, that have less scary looks and are supposed to be very precise. Yes, I'm talking about Stewart platform, a six-cylinder positioning device. The most surprising is that they have very simple closed-form mathematical solution to the inverse kinematics (IK) problem, that is usually a hard nut to crack for regular joint-robots. But this advantage comes at a cost - the forward kinematics (FK) solution is a real challenge for your math skills (and again - FK is a piece of cake for joint-robots).
To remind what is IK and FK, I'll provide an example:
suppose you can figure out exactly the position of each part of your body, and by position I mean rotation angle (because humans don't have telescopic joints :) - something like "my upper arm is rotated by 45°, lower arm by 15°, palm 5°..." etc. up to the very last bone of your finger. By the way, it's called "End effector" - the very last part in kinematics chain. Assuming that you know exact length of each of your bones and applying some math one can figure out the exact position of finger-tip in space. This solution is called forward kinematics in robotics world.
And now, as one can simply guess, inverse kinematics does just the opposite: suppose you want to use your finger to say.. pick your nose (yuck!). You know exact position of your nose, and you still remember exact length of your bones. The question is, how do you know what force of muscles you should apply to rotate your bones into positions so that end effector hits your nostril? One can easily guess, that there are many solutions to this problem and that's why there is no simple answer.
Luckily for us, humans, we're equipped with many-thread processing unit called "brains", that have evolved an  astonishing approximation algorithm - just think how professional basketball player is capable of  real-time body coordination to make a three-point shot from a distance! Yes, approximations and data from zillions of sensors - that is receptors - are working in a clockwork mechanism to deliver you a flawless nose-scratching service.
And how about robots? Well, approximation algorithms exists, but on top of that one needs additional layer of rules how to pick a solution from set of available ones. Sometimes it doesn't matter, consider that you're trying to push a light-switch on the wall. Do you really care which way finger touches the switch as long as the light goes on? You don't, unless the switch is broken with plain wires sticking around and a slight mistake would electrocute you.

In the past ten years I've been working with hexapod devices to precisely position patients in 3D space. But up till now I didn't know how controller calculates IK and FK problems for the Stewart platform, my software simply pushed end effector targets and that's it. Recently I've started doing a research on mathematical hexapod model, still hoping to find simple solution for FK problem (do I have to remind why I've miserably failed? :), and came to a conclusion that FK is rarely needed for hexapod device. Especially real-time FK. Usually robot controller application needs to know cylinder positions when end-effector position is known, not the other way around. I'm not gonna drill down to the technical details now and will explain the math in Part II next time.
As for now, enjoy the walker show:


Article references:
Kondo Hexapod
Rubedo Sistemos

2011-03-13

Mindstorms robot has arrived, humanity gets one step closer to extinction

So here we have it - the ultimate toy of all geeks and robotics fans, the Mindstorms NXT 2.0. The kit comes with 3 servo motors, four sensors (ultrasound, color, touch), 32 bit programmable microprocessor and a whole bunch of LEGO building blocks.
Along with the kit we've got a CD with visual editor to write programs for the microprocessor (the unit is called LEGO brick - the size of it is really "bricky" ;). It doesn't look complicated to program with this editor, but still the result has limitations - the program is compiled and uploaded to bricks internal memory (something like 256kb). So, I'm looking forward on using Microsoft Robotics Studio via Bluetooth, that should open a whole new dimension of features.
The first task on our list says we need something simple, that is able to hold a tool with markers and move this tool along predictable path. Well, maybe next item on this list should be something more destructive, like for example a battletank? ;)

2011-02-13

Beercan robot

Just came across Sandy Sanderson's page who has a hobby of making cars from cans. The result is quite amazing, check photos and the making process! 
This brings me an idea to make some kind of a robot out of cans. Well, not that it could move or something (or maybe he could?), but sculpture or dummy. I guess I'll start with 3DS Max modeling or WebGL rendering anytime soon..