Thursday, April 29, 2010

Is slavery the future?

The debates between three party leaders in the UK general election all seem to have been quite tedious affairs. I saw some of the first debate, none of the second and all of the third. One thing which struck me was how incredibly quiet the audience were. It was almost as if they had been sedated. Apart from a small number of obviously pre-approved questions there was not a squeak out of them. No clapping or booing or groaning, or any sign of expressiveness at all. The audience was so non-participative that they could have been dispensed with entirely, and each leader simply delivered a lecture directly to the TV cameras. I was wondering whether anyone in the audience would dare to break the wall of silence, like the boy in the story of the emperor's new clothes, but nobody did.

This is in contrast to the kind of political debate which is usually to be expected, as in shows like Question Time, where there is often some interaction between the questioner in the audience and the panel of politicians and audible expressions of approval or disapproval from the audience are common. My guess is that especially after Gordon Brown's gaffe the politicians want to insulate themselves as far as possible from ordinary voters, who can not always be guaranteed of being "on message", and instead stick with groups of party supporters, sedated audiences (presumably not permitted to speak spontaneously without pre-approval of their questions) or official media commentators.

As far as I know there has been no mention of the Digital Economy Bill, which could end up having an impact upon many people over the next few years. Attempts by thousands of concerned voters to make this into an election issue worthy of discussion in the leadership debates seem to have utterly failed. The politicians were also completely evasive about the nature of the austerity measures which we're lead to believe are imminently to arrive on the post-election landscape. It remains inconclusive which public services we can expect to disappear and which will stay. Possibly this might be a deliberate strategy in order to avoid alienating any sections of society who might be dependent upon services which are at risk, especially since the election result could be a close one and antagonising any minority group could tip the scales in marginal constituencies.

One thing which I found slightly concerning, not least because it might apply to myself at some point in future, is the nature of the workfare-like scheme which all the leaders seem to be proposing. Gordon Brown stated in the last of the three debates that "the unemployed will be forced to work", but nobody in the audience picked up on this to get him to clarify what he meant by the remark - presumably they weren't permitted to do so. Does this mean that people will be forced to work for below minimum wage? Where will these jobs come from? If they're government created make-work jobs building bridges to nowhere, how will these be paid for in a situation where government spending needs to be reigned in rather than expanded? The worst possible interpretation would be that anyone who is unlucky enough to become unemployed loses their fundamental human rights and either becomes a slave labourer or faces starvation. I hope that's not what they're proposing, and even if it where such an arrangement wouldn't make sense anyway, since slaves are neither consumers nor efficient producers and hence don't contribute much to the economy. If anything slave labour would undermine the economy, resulting in wage deflation (why pay someone to work when you can have a slave work for nothing?) and stifling the possibility of growth in provision of goods and services.

Another thing which seems by now to be abundantly clear is that this is almost certainly the end of the road for the whole "new Labour" project which began with Tony Blair in 1997. People probably voted Labour back in 2005 because despite the growing catalogue of lies, wars and broken promises the economy had remained relatively stable, characterised by what Brown (as chancellor) described as "modest year-on-year growth". When Blair stood down he described Gordon Brown as "the best chancellor in 100 years", but the events of the last three years have shown that Brown's apparent competence for managing the economy truly was a mirage. Worse, his sale of the national gold reserves and disdain for regulation of the financial markets may have actively exacerbated the problems which caused the recession, allowing fraudsters and ponzi schemers free reign and putting Britain in a worse financial predicament than otherwise might have been the case.

The new found enthusiasm for the Liberal Democrats (aka "Cleggmania") I think originates because within the last 30 years there has been both a long period of conservative government and now also a long period of Labour. Both of those administrations were pretty rotten, so anyone who is old enough to remember them with any degree of clarity may be tempted to vote for something which hasn't been tried within recent history.

Also, this was billed as a "web 2.0 election", but so far there has been not much evidence of the internet significantly shaping the debate. From a media standpoint, apart from TV being broadcast via iPlayer, this seems like a very old-fashioned kind of campaign.

Thursday, April 22, 2010

The "poor man's laser scanner"


I'm currently testing the Sharp GP2Y0A700K0F for use as a possible laser scanner replacement. The sensor is an infrared ranging module costing about £20 and has a range of up to 5.5 metres, which would be quite acceptable for most indoor navigation tasks. There seems to be no information available, even within the Engrish specification document, about the beam characteristics but by waving my hand in front of the sensor and watching the returned voltage change I can see that the beam looks reasonably narrow.

I'm using the Rodney robot as a pan and tilt mechanism for this sensor. By panning from side to side it may be possible to build up a two dimensional range profile very similar to what you might expect to acquire from a scanning laser rangefinder. If it works then this might be a good indoor navigation assistant, capable of being produced at low cost and lacking the safety issues associated with using lasers. The narrow beam and practically instantaneous ranging response provides a better solution than the sonar sensors which are traditionally used in robotics for similar purposes.

Cherry picking the statistics

Reading this BBC article about the UK national debt situation is at first quite alarming. According to the article the national debt is now 68% of GDP - the largest since the second world war.

But is this really true? Is 1950's style austerity and rationing just around the corner?

The BBC article is at best misleading, and certainly represents a poor journalistic analysis which confuses more than it informs the reader. Checking out these figures we can see that the last time that the national debt was around the 70% level was 1970. This is still an indictment on the behavior of the current administration, but nowhere near as alarming as might at first be imagined. However, if you plot the data in absolute terms (billions) adjusted for inflation then we are in the worst post-WW2 debt situation. But since the overall economy - in terms of the numbers of goods and services being produced and the size of the population consuming those products - has probably grown over the last 60 years I don't think that looking at the debt in absolute terms is very helpful and probably the relative percentage of GDP figure is much more instructive. This just goes to show that it is possible to cherry pick the statistics, and mix and match your comparisons in a news article, in order to come up with a more gloomy (aka sensationalist) picture of what's happening.

Wednesday, April 21, 2010

USB to I2C

I've written another ROS package, this time for use with a USB to I2C communications module which I use as a way of receiving range data from SRF08 sonar sensors on the GROK2 robot. In accordance with current policy I'm putting all new projects onto launchpad, which means that code written by me can't be erroneously classified as a "US technology" and subjected to US export regulations. Existing projects on Google Code will probably remain where they are for the time being.




Compilation


To compile the package, assuming that you already have ROS installed.
  1. Make a directory called usbi2c within your ros/pkgs directory
  2. Copy the files into the usbi2c directory
  3. Run roscore
  4. Run rosmake --rosdep-install usbi2c

Setting the addresses of sonar sensors


On an I2C network each device has its own unique address. To set the address of a sonar sensor.
  1. Connect the sensor to the USB-I2C module. Only a single sensor should be attached.
  2. Run roscore
  3. Run rosrun usbi2c sonar _device:=/dev/ttyUSB0 _sensors:=1 _address:=[sensor address]
Where the address is a hex value in the range 0xe0 to 0xfe . You can alter the serial device from ttyUSB0 to whatever is needed on your system.



Publishing the sonar ranges

To broadcast sonar ranges.
  1. Run roscore
  2. Run rosrun usbi2c sonar _device:=/dev/ttyUSB0 _sensors:=[number of sensors]
The sensors should be assigned adjacent addresses so that the publisher can cycle through them. Potentially other activation patterns could be devised, but at present each sensor is activated sequentially.

Subscribing to the sonar range data

With the publisher running there is also an example client program which can be run with:
rosrun usbi2c sonar_client
This should connect to the publisher and receive sonar ranges. Presently there doesn't appear to be any standard message format for sonar data within sensor_msgs, so I've created my own message called sonar_params. The format contains three values:
int32 index - index number of the sensor. Note that this is not the same as the I2C address.
int32 range_mm - the returned range in millimetres.
time stamp - the time at which the data was obtained (ping arrival).

Digital economy

Tom Watson talking about the Digital Economy Act. There has been a lot of kerfuffle about this over the last few weeks, and probably with some justification. The act basically allows Chinese style politically motivated blocking of web sites, and could very easily be used to censor legitimate but embarrassing disclosures, such as documents appearing on Wikileaks. Not only does the act allow government to force ISPs to block access to web sites infringing copyright, but also sites which might infringe copyright at some unspecified point in the future. The worst part which was focussed upon by protesters was the possibility of people being cut off from the internet as a penalty for copyright infringement. It doesn't take a large stretch of imagination to imagine this law being used against bloggers and whistleblowers in order to try to prevent them, perhaps temporarily for a few weeks or months, from getting their messages out into the public domain - or at least make their life harder.



There is also a flip side to rigid enforcement of digital copyrights, and this is the genius of licenses like the GPL or Creative Commons. The more aggressive the copyright regime becomes the more attractive Free/Open Source software and Creative Commons media will become. What the "analogue" industries are really fighting against in something like the Digital Economy Act is human nature and human culture itself - the desire to freely produce and share cultural artefacts.

Tuesday, April 20, 2010

Patents and trains

An episode of FLOSS Weekly highlights the problem with software patents. You tend to think of patent trolls as only going after lucrative wealthy targets such as big companies, but in this case the target was a hobby open source project for model trains written in Java.

For any software developer the prospect of being pursued by a troll threatening to sue you for millions of dollars and shut down your project or software business is the nightmare scenario. The interview provides a good indication of just how unethical the behavior of patent trolls can be, and how that even if you're confident that you're on the right side and will eventually be exonerated, the legal system can tie you up with years of unproductive, costly and illogical machinations.

The moral of this tale is:
  • Use one of the popular OSI approved licenses. Don't try to roll your own license, because even a couple of words can make the difference between it being legally valid or not.
  • Don't assume that the legal system is logical.
  • Even if you're running an open source project as a hobby and it's distributed at no cost, so that you're not making any financial income out of it, patent trolls can still come after you and try to ruin your life. Your project isn't too small, too obscure or too non-commercial to be invulnerable to these issues.
  • If you're in the US then register the copyright. I don't know whether anything similar applies outside of the US. Registration provides extra legal weight if it comes to a court case.

Monday, April 19, 2010

Some UK energy statistics

I've made some graphs from the energy statistics available on data.gov.uk (a more specific link here), to see what's currently occurring with nuclear power and renewables.

The supply of electricity from nuclear fission has been in decline since the late 1990s, both in absolute terms and also as a percentage of overall electricity production. Currently the amount of electricity produced from nuclear is about the same as it was in 1983, equivalent to about 14% of the total. I'm guessing that this decline is the result of a deliberate policy of not replacing retired power plants.



Electricity from renewables is rising, but still comprises less than half of the output from nuclear.



The main renewables are wind, hydroelectric and landfill gas. There are other biogas sources and also solar power, but the electricity produced from these is currently tiny compared to the big three. If we do eventually get "cheap solar" and there are panels on every rooftop, solar might become much more important in future though.



Production from hydroelectric appears to have barely moved since 1970, and that shouldn't be surprising since it usually involves significant alterations to the landscape (artificial lakes) which are very unpopular with NIMBYs. Wind power is the biggest contributor to the overall rise in electricity from renewables, overtaking the other two for the first time in 2006.

Fundamental matrix

Sunday, April 18, 2010

RGB-D

Some interesting 3D SLAM results using a time of flight camera can be found here.



I havn't seen anything quite this exciting since the 2000-2002 CMU hallway runs produced by Hans Moravec, but it's worth remaining cautious about interpreting demos until I can either try out a time of flight camera myself, or get a review from a credible source, in order to ensure that there are no big gotchas, unrealistic assumptions or men behind curtains. If this is what it appears to be, and maps can be constructed reasonably efficiently using algorithms such as TORO, then it could be that the difficult problem of robotic visual perception is almost in the bag. Trying to get maps of this quality with conventional stereo vision is an extremely challenging task, and it might turn out that the RGB-D devices render most previous depth perception technologies obsolete - at least in the indoor case where ranges are typically in the order of no more than a few metres.

More information about the time of flight cameras currently available can be found here. These are all very expensive sensors, but if these devices are mass produced for games consoles, or possibly for use in automotive safety, the cost should be greatly reduced.

Saturday, April 17, 2010

Mining the manifestos

For the 2010 general election I thought that it would be a good idea to decide which way to vote based upon some definite criteria other than superstition. There are a couple of parties that I wouldn't even consider voting for, because they're too xenophobic, and others which just aren't applicable in the local area (like the Scottish Nationalists), but the rest are fair game.

I compiled a list of salient features and then tried to determine whether or not they existed in four manifestos. The results look like the following. Voting intention can then be decided by minimised hamming distance.



Based upon this it looks like I should probably vote Green, or Liberal Democrat if there is no local Green candidate. The Green manifesto is the only one which explicitly mentions the problem of software patents and promotes a "Tobin" style tax on transactions (a damper in control theory terms, which helps to filter large oscillations). Although the Labour and Conservative manifestos do contain costings for various policies and taxes they're heavily embedded into the text and don't have summaries which make it easy for the reader to evaluate the figures overall. Neither the Liberal Democrat nor Green manifestos mention electric vehicles, which given the current record level of fuel prices is a surprising and potentially costly omission.

On presentational style the Conservative manifesto is probably the best. It looks as if they employed a professional photographer, and the text layout is aesthetically pleasing. This does make the pdf file rather large and unwieldy though, especially when searching for keywords.

Both Labour and the Conservatives also seem to be advocating something called "workfare". I'm not sure that I have a strong view on this, since it depends on the implementation detail, but I'd be against the notion of forcing the long term unemployed into unfree labour.

For some informed views on human rights in the UK and the Human Rights Act, see this podcast.

Thursday, April 15, 2010

Unsophisticated philanthropy

Peter Diamandis explains the power of prizes.



Which makes me wonder about some of the other seemingly intractable problems which people have given up trying to solve. The Diamandis video above reminds me of something I heard said about the problem of homelessness, although I don't remember where I heard it. The saying was that there will always be homeless people on the streets because there's no money to be made in solving the problem, and that if getting people off of the streets put a few million into the bank accounts of entrepreneurs the problem would be solved very rapidly.

There's a general election to be held in the UK early next month, and reading the manifestos of the three main parties is, as can be expected, a fairly depressing experience. All of them claim to have "radical" policies, but it's hard to uncover any new thinking in these turgid volumes. About the best idea I've seen so far is in the conservative manifesto, which proposes using the existing government petitioning system to turn the top rated petitions into bills which are then debated in parliament. It sounds like a good idea, and a move towards more direct democracy, but if history is anything to go by then good ideas written down in manifestos have a habit of being quietly dropped after the electioneering bandwagon has passed and the new administration has been safely installed. I see that the labour party is promising "constitutional reform" yet again, but they have been promising this at least since the mid 1990s but never actually delivered anything other than rhetoric. The house of Lords still exists. It's still undemocratic. It still needs to be ditched, and we still don't have any written constitution so that the layman can understand in plain English terms what their rights and responsibilities are.

Perhaps the prize driven Diamandis-like approach could be taken to some of the difficult social problems, like homelessness. A prize might be awarded to any individual or organisation who can come up with a successful and reproducible method to get people off the streets and into some sustainable lifestyle which probably includes work (either paid or voluntary). There would need to be some auditing so that you don't end up with the sort of statistical fraud which occurred under the Blair administration (i.e. you claim to have solved the problem by manipulating, cherry picking or fabricating the statistics), and this might help to create a new generation of social entrepreneurs. A prize driven approach is probably better than one simply guided blindly by political prejudice, and has a stronger focus upon getting a measurable result.

Tuesday, April 13, 2010

On the expanding frontier of ignorance

This is quite a fun talk about the nature of innovation in science.



And I agree with his summary of anthropogenic global warming at the end, and also that it's a good idea to try to go back and check the original sources of data if you can. The Earth's biosphere is complex, and there are probably many factors which aren't yet understood and don't feature in any current climate simulations. Some of the examples given are a classic reminder that consensus and authority don't always mean that an idea is correct, and that sometimes it can take decades for a new idea to become established.

Here's the aforementioned Fred Vine video explaining continental drift.

Monday, April 12, 2010

The incompetent Armageddon

Better auditing of nuclear weapons and materials is definitely something worth pursuing, but I think that the following Obama statement is probably not true.
"The single biggest threat to US security, both short-term, medium-term and long-term, would be the possibility of a terrorist organisation obtaining a nuclear weapon"
Even in the event that a bearded bogeyman could obtain a nuke, delivering it to the target destination without the propulsive assistance of a missile (I presume that it's impossible to "steal" a nuclear missile silo) would be a significant problem. In practical terms it would mean acquiring an aircraft or a UAV with enough load carrying capacity.

Probably the biggest threat on all fronts, economic, humanitarian and political, is an old one - plague. The spread of a highly infectious disease, such as bird flu, which might either be fatal or at minimum render the victim "economically inactive" for some significant length of time would be hugely disruptive and thanks to easy intercontinental travel be able to spread rapidly around the world. Plague could be of natural origin, or deliberately bio-engineered, although at this stage biotechnology is probably not sufficiently advanced to be able to engineer arbitrary contagions with desired properties.

But nukes and shifty-eyed men in caves make more entertaining nightmares than invisible microbes. You can make TV shows about nukes or embark upon book tours and deliver finger-wagging prophecies, but microorganisms are an altogether more esoteric topic dominated by abstruse nomenclature. About the worst nuclear terrorism scenario contemplatable is that a botched attack made using a small stolen weapon is subsequently misinterpreted by paranoid military generals as a first strike by a rival nation, and an escalation of mutually ensured destruction then ensues.

A more realistic nuclear threat though comes from nation states, and also merely from accidents. ICBMs are a technology which is half a century old now, and there might be many of these weapons still around (especially in the US and Russia) in a poorly maintained condition after at least a couple of decades of budget cuts, and where the technology is so archaic that few people understand how it works and failed parts are not easily replaceable. I've seen old computer systems in banks and factories which meet this sort of criteria - they're ancient and crumbling but still somewhat operational and considered to be too expensive to replace. Nuclear armageddons are typically imagined to be deliberate acts of violence, but they could just as equally occur due to incompetence or neglect.

And speaking of nukes, the front cover of the Labour party manifesto looks rather sinister.

Saturday, April 10, 2010

Passing command line parameters to rosrun

It doesn't seem to be very clearly explained in the documentation, or rather, finding out how to do this is a matter of piecing together information from several sources. Suppose that you want to pass some parameters when using rosrun. In my case I want to pass Phidget device serial numbers so that multiple devices of the same type can be connected and used.

The usual way to run a node is something like this:
rosrun [package] [node]
To pass a parameter, use the following syntax:
rosrun [package] [node] _param:=value
Where param is the name of the parameter or option.

So in my case to pass the device serial number I do the following.
rosrun phidgets advanced_servo _serial:=88209
Then within the code for the advanced_servo node the value can be accessed like this.
ros::NodeHandle nh("~");
int serial_number = -1;
nh.getParam("serial", serial_number);
ROS_INFO("Device serial number %d", serial_number);
And that's all there is to it. Passing a value of -1 for the serial number just connects to the first device which can be found.

Thursday, April 08, 2010

Density

I've released a new version of the v4l2stereo stereo vision utility, which now includes a dense stereo correspondence algorithm in addition to the existing feature based method. The algorithm which I've used is quite a conventional, almost textbook, implementation which compares image patches using sum of absolute difference as a correlation metric. On the Minoru webcam this seems to work quite well, although the depth resolution is not very accurate.

The sort of result which can be expected looks like this.



Some instructions on using the dense stereo algorithm can be found here.

Dense stereo obviously uses significantly more compute power than the feature based method, with many more pixels being compared, and to help spread the load I've made extensive use of openmp so that the algorithm should be scalable on multi-core architectures. Tweaks can also be made to the algorithm using various command line options in order to improve speed if you need something realtime running on an older or less powerful machine.

Also in the light of recent towel-related activities I thought it would be a good idea to integrate v4l2stereo with the ROS system of Willow Garage, so that potentially a stereo webcam such as the Minoru could be used as a replacement for the much more expensive stereo cameras typically used in academic research. In the current source code release I've included an example ROS publisher and subscriber which should make integration of webcam based stereo vision with a robot running ROS a fairly straightforward proposition. More details of how to use these can also be found here.

The commands to run the ROS integration demo are depicted in this video.

The first bug report

From Wikipedia:


Moth found trapped between points at Relay # 70, Panel F, of the Mark II Aiken Relay Calculator while it was being tested at Harvard University, 9 September 1945. The operators affixed the moth to the computer log, with the entry: "First actual case of bug being found". They put out the word that they had "debugged" the machine, thus introducing the term "debugging a computer program".

Sunday, April 04, 2010

The Tabulators

One good thing about tablet PCs like the iPad is that they appear to be yet another push in the direction of telerobotics. When you examine previous academic research or vapourware telerobots one thing that they all have in common is a a fairly large flat screen on a pole or otherwise elevated to head height, like this:



In the past this was typically a flat monitor of some kind, but as the PC electronics gets smaller there's no reason why the computer, display, camera, wireless communications, GPS and accelerometer can't all be part of the same unit, minimising the manufacturing costs. The form factor of a tablet is probably more appropriate to bolt onto a pole than a conventional laptop or netbook would be, and with the addition of some motor electronics capable of being operated via the wireless network (there is a Phidgets SBC something like this) you're pretty close to having some moving machinery. The size of the screen may also turn out to be an important factor. In principle it would be possible to use a mobile phone or PDA-like device as a telerobot display, but these screens may be too small to be ergonomically viewed from a distance.

The debates over the closed nature of the iPad will probably turn out to be a storm in a teacup, since there will no doubt be other variants sold by other companies which don't suffer from the same software or interfacing restrictions.