Best Laid Plans of Mice and Robots

4344787264
Picture posed by model.

So, I had this plan to make a line following robot. I’d even figured out how to do the lines. The idea was to print track segments on A4 pages, and then laminate the pages and lay them on the floor. The robot would go from page to page and it would all work.

That was the plan.

So I drew out some track segments in Photoshop Elements, printed them out and then laminated them. Then, and only then,  (and this is the stupid part) did I get round to testing my track design with the robot sensors. Turns out that the line sensors can see white paper really well. Really, really well. I get 99% reflection when I put the robot on the white parts of the paper. Only problem is, I also get 99% reflection when I put the robot on black parts. This is not a problem with the laminate,  it seems that, as far as the sensor is concerned, black is most definitely not black. Robot fashion shows must be awfully dull.

Anyhoo, my line following plans were in danger of not being plans any more. Finally I had a brainwave. Carpet seems to give me only around 20% reflection, even through plastic. So I’ve now made some track parts that just have transparent sections where the dark bits should be. You can just see how this works in the corner section above. The green LED is lit because the sensor at the far side of the robot is on the white part.

And now I’ve hit another snag. The robot runs rather roughshod over the path sections. I was hoping they would be heavy enough to stay put when the robot goes over them, but it seems that Jason is rather heavy footed, and messes them up. I’ve now got to find some velcro, or something that will stop them getting moved around as the robot travels over them.

That’s for tomorrow though, I’m off to bed now.

Links for Software Engineers

Pot Pourri

I was talking to our .NET Development Postgrad students and we decided that there were a few things that you should be familiar with if you want to become a “proper” Software Engineer. These are the things I think you should do:

Read “Code Complete 2” by Steve McConnell. Perhaps the best book ever on software construction.  Then keep your copy where it is handy, and have a policy of reading a bit now and then, just to keep up to speed. If you can track down a copy of “Rapid Development” you should read this to.

Read I.M. Wright’s “Hard Code” blog. And buy the book if you like.

Read “How to be a Programmer”. Excellent stuff.

This is not everything you should do. There are other good places to look. But it is a start. Oh, and if anyone out there has other ideas about good, pragmatic texts for budding coders, then let me know and I’ll add them.

Resources from Rob

4326495458

A couple of new resource postings you might have missed:

  • Find out how to load images into your Flash/Chumby programs here.
  • Find out how to reset your TinyCLR Micro Framework device if it has got stuck here.

I’ve just about got my JSON serialiser working to send and receive JSON structured messages between the Micro Framework robot and another machine. When I’ve got the whole thing sorted I’ll post all the source. It lets you create message frameworks and then push status information between two systems.

Christmas Chumby

4269183539

My “big” Christmas present to myself was a Chumby. This is a fun little internet appliance that you can write programs for.  I’ve started doing just that, and you can find out more at my newly minted Chumby pages.

Hull Digital Event

4174364090

We had the first Hull Digital event at the university today. People found their way to the department OK, because (or perhaps in spite of) the arrows that I stuck on the wall using borrowed blu-tack.

Anyhoo, we had two speakers and both were excellent.

Andrew Chalkley, from Cake Solutions  showed just how powerful Ruby on Rails is. He did this by creating a complete blog site, with comments and user authentication, in around fifteen minutes. The fusion of language and tools that you get with this framework looks very powerful, and well worth a look I reckon.

Then Craig Albeck took to the floor. Craig works for the Hull based company behind Omerta (a text based Mafia game) and ThirteenOne (a free on-line video gaming magazine which actually features some stuff by me). In a very interesting talk Craig spoke of his experiences in the market place and how to get out there and build a brand of your own. 

Great stuff. I’m looking forward to the next event.

Windows 7 on Artigo PC

4160818974

Some time back I got an Artigo PC to play with. This is a lovely little PC in a tiny box which will fit into the drive bay of a “proper” computer. It was supplied running Windows CE, which is a very nice operating system, but I wanted to do a bit more with it. I wanted to run Windows 7 on it.

I started small, with the Windows Embedded Standard 2011 CTP2. This is the latest version of Windows Embedded, basically a componentised version of Windows 7 where you can select just what you want in your installation. The idea is that you can make small footprint, customised, builds of windows for things like kiosk displays. My plan was to get maximum performance by just including the bits that I needed to let me watch recorded TV over the network and BBC iPlayer from the web.

It really is easy to install. If you have had horrid experiences of customising operating systems this will be a revelation.  You just boot your target device from the distribution image and then start selecting what you want to have in your custom Windows 7 deployment. There are a number of templates you can use as a starting point, or you can build your configuration from the ground up. You can pick which components that you want and the installer checks the dependencies and tells you the size of the footprint on the hard disk that you will end up with. The idea is that once you have made a machine that that works the way you want you can pull this back off the device and use it to manufacture as many more as you need. 

Works a treat. I quickly had a version of Windows 7 running with just Media Player and IE. This kind of thing would be great for use in open areas. It removes the need to worry what people might do with things like the command prompt, since there isn’t one there from the start.

The hardest bit of the job was upgrading the BIOS on the Artigo so that it would work with later versions of Windows. To do this I ended up making a boot floppy (I’ve not touched a floppy disk for years) and using that to boot the Artigo into Windows 95 and run the BIOS upgrade program.

If you fancy having a play with this you can get a free download of the entire thing by signing up on the Microsoft Connect link above, and the software will run for 180 days (until summer next year) so it might even be properly useful for a while.

As for me, I found that Windows 7 ran so well on my tiny machine that I thought I’d go for broke and put Windows 7 Ultimate on it. This worked very smoothly.  The only problem was with the drivers for the graphics display, where I’ve had to use the original ones that were designed for Windows XP. These mostly work, but at the moment the video playback is a bit choppy for full screen viewing, although it works fine in a reasonably sized window on the desktop.

Great fun though, and a very interesting exploration of where Windows Embedded is going in the future.

Fun with MineSweeper

I spent some of today working on the coursework for our First Year programming course. Every year we get our students to create a simple game. Last year it was Battleships. This year it is MineSweeper, a game with a long and honourable history, having been shipped with every version of Windows right up to Windows 7.

One of my rules is that I don’t ask the students to do something that I can’t. At least not in the First Year…

So I spent a happy afternoon putting together a simple version of the game and writing the notes to go with it. I’m so pleased with what I ended up with that I might make a version for the Zune. It is a really nice platform for that kind of thing.

The first part of the lab goes live next week and should be great fun.

Hull Digital

I’m really pleased to find out that there is now a Digital Community in Hull:

http://hulldigital.co.uk/

They are organising a live event in October which has some interesting speakers:

http://www.hdlive09.co.uk/

I’ve persuaded my boss to pay for a ticket, and I’m really looking forward to it. I’m pleased to find that they do student pricing for the event (which seems to me quite reasonable) and with a bit of luck we can involve some of our students in their events in the future.

One of the most important things about computing is that the field is constantly changing and professional development is something you really need to work at if you want to keep your skills up to date.  Hull Digital looks like it will be a neat way of doing this.

Reading Twitter Feeds with LINQ

LINQ (Language Integrated Query) is a really neat feature of .NET which makes it very easy to work with structured data. I’d always thought this meant things like databases and stuff, but it also works with XML. This CodeProject article shows how you can use LINQ to read information out of Twitter feeds.

http://www.codeproject.com/articles/35668/How-to-Read-Twitter-Feeds-With-LINQ-to-XML.aspx

Very clever. It took me around five minutes to make a simple Twitter Viewer application based on the code given:

https://static.squarespace.com/static/5019271be4b0807297e8f404/52c5bcfce4b0c4bcc9121347/52c5bd03e4b0c4bcc91238f5/1240577347000/TwitterViewer.zip

Funny Way to Run a Railway

Got into a conversation with a web design company today. They had asked permission to use one of my pictures on Flickr (which was nice of them) and mentioned the site they were building.

I had a quick look and the site was really swish. Well designed and with nice content. But I noticed that one of the pages did not render quite correctly with IE8, my current browser of choice. I’ve been quite happy with IE8, although it has to be said that sites don’t always look right with it. Perhaps this is due to it being more standard than they are, but I’m not sure. Anyhoo, I tried the page with Safari and it seemed to look OK so I pinged the company my findings.

They came back to me and said “Oh, that’s interesting. We don’t usually test our sites with IE8 or Safari.” I found this very surprising. I’m not sure if a shop would do very well if it has window display that was only visible to blondes, or put everything on a high shelf where only tall people could see it (although I’d be OK on both counts of course).

If I was running a web design company I’d make it my business to ensure that the site worked correctly with everything. Of course one day, in a distant utopian future, we might have some web standards that would mean browser compatibility was no longer an issue, but for now it is – and I would have thought that would be standard practice to worry about this kind of thing.

Live Code at the Humber Bridge

The clocks changed on Sunday morning. In the UK we started British Summer Time, which meant that a sinister government plot resulted in 60 minutes of my life being stolen overnight. We had to put the clocks forward of course. One year I tried to assert my independence from this time base tyranny, but it didn’t work that well, and I was late for everything (or early, I forget).

Anyhoo, many years ago I wrote some software for the Humber Bridge that is part of their toll management system (Ian and Nicky did the rest) and my bit is in charge of making sure that the clocks get put forward and back. Because the software had to go quite quickly I implemented a little look-up table with the dates hard wired into the code. And then I forgot all about it.

Of course this weekend my little table ran out, and today I got a call from Neil at the bridge because their system was living in the past. So it was out with the Windows 95 system that I used to create the software, a quick extension of the table and down to the bridge to install it.

We use a system by Siemens to talk to PLC machines in the Toll Booths. It has a wonderful ability to let you update the code while everything is running. This is because the software is designed for process control, where you sometimes can’t turn everything off just to put new versions out there. So I was able to add the new code (which I’d already tested on my laptop) and then watch as the clock pinged forward to the correct hour.

The table now works to 2012. I’ve set an appointment in my diary to remind me to get in touch with them well before then, so that it doesn’t happen again.

First, Update the Firmware

Did some work on our Micro Framework project today which will be our entry into the Dare To Dream Different competition. We are creating an “Anything Bad” alarm system with nifty remote sensors. The sensors are based on the XBee ones that we got supplied with the competition hardware, and they work a treat.

Eventually.

First thing we did was build some test remote sensors:

3384045935

This turned out to be easy enough, although I did solder 20 pins rather than four, which took a bit longer than it needed to…

Anyhoo, the next thing to do was configure the XBee devices. This was harder, in that nothing seemed to work. We were giving the correct commands and everything, but the device was complaining every time. A bit of searching got us the answer. We found a blog post with the revealing message “To get the devices to work you must upgrade the firmware”. I’m not sure why a company would ship a product which doesn’t work out of the box, but then again, welcome to the world of hardware development.

After the upgrade things went swimmingly. We reached a point where I could press a button on the device above and have a program on another machine notice this. Wonderful.

I M Wright Speaks

You’ve probably heard me go on about I M Wright before. He is the “Microsoft Development Manager at Large” alter ego of Eric Brechner. He wrote the book Hard Code, which is a wonderful look at how to create software properly. He also has a blog which is brilliant. And now he has a podcast too, so you can listen to the good word rather than have to read it. You can find the file here.

Bad/Mad Practice

Alfred Thompson had a good post in his blog about software testing. Alfred and I are around the same generation (I hope he won’t mind me saying this) and we’ve both written software for money in the past. When I was writing my largest projects I didn’t make use of any kind of tester particularly, I just make sure that it worked before I handed it over. Alfred was the same.

Nowadays it seems that there is a trend towards developers handing stuff over which they haven’t really tested, on the basis that the test people who receive it will find any mistakes they made. Alfred (and I) hate this idea. I put quite a verbose response to this effect on his post you can find here:

http://blogs.msdn.com/alfredth/archive/2009/01/27/how-not-to-develop-software.aspx

I’ve since talked to people in the business and was appalled to hear that this practice is not uncommon nowadays because developers are pushed to meet deadlines and the only way they can do this is by skimping on the testing they do. Ugh. I reckon this really goes back to Bad Management, in that a manager will get a good feeling if they are enforcing a strict regime with tight deadlines which the programmers are all hitting.

The end result though is that the testers keep sending stuff back for re-working because it has bugs in, the developers lose time on the next phase because they have to fix all these bugs, so they send the next version out (in time for the deadline) with more bugs and so on. The words Vicious and Circle spring to mind. Along with Bad and Product.

It turns out that one of my heroes, Eric Brechner, has written a lovely post about this that sets it out really nicely:

http://blogs.msdn.com/eric_brechner/archive/2009/01/01/sustained-engineering-idiocy.aspx