<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>HardLikeSoftware</title>
	<atom:link href="http://hardlikesoftware.com/weblog/feed/" rel="self" type="application/rss+xml" />
	<link>http://hardlikesoftware.com/weblog</link>
	<description>The writings of John Snyders, mostly about software.</description>
	<lastBuildDate>Thu, 13 Sep 2012 04:37:17 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Amazon MP3 drops Linux, who wants my money now?</title>
		<link>http://hardlikesoftware.com/weblog/2012/09/13/amazon-mp3-drops-linux-who-wants-my-money-now/</link>
		<comments>http://hardlikesoftware.com/weblog/2012/09/13/amazon-mp3-drops-linux-who-wants-my-money-now/#comments</comments>
		<pubDate>Thu, 13 Sep 2012 04:37:17 +0000</pubDate>
		<dc:creator>John Snyders</dc:creator>
				<category><![CDATA[Other]]></category>

		<guid isPermaLink="false">http://hardlikesoftware.com/weblog/?p=145</guid>
		<description><![CDATA[Don&#8217;t get too excited, its not a lot of money — about 6 albums and a dozen or so songs this year to date. The thing is, I really liked buying music from Amazon and had been doing so since 2008. They have great selection, a DRM-free product, good support, good prices, convenience, and the [...]]]></description>
			<content:encoded><![CDATA[<p>Don&#8217;t get too excited, its not a lot of money — about 6 albums and a dozen or so songs this year to date. The thing is, I really liked buying music from Amazon and had been doing so since 2008. They have great selection, a DRM-free product, good support, good prices, convenience, and the MP3 downloader worked on Linux. But not any more.</p>
<p>In August I bought two albums and the MP3 downloader worked fine. Today I tried to buy an album and nothing happened. The Amazon MP3 downloader application launched but nothing was downloaded. The install page for the downloader now says &#8220;We apologize — Linux is not supported.&#8221;.  That was news to me. I contacted support and they confirmed Linux was not supported (even though Linux support was still mentioned on a FAQ page). The person was very polite and helpful and refunded my money for the product I wanted but can&#8217;t have, at least not my way. I could send the music to the Amazon cloud player and listen to it from there but that is not the product I want. It is not the product I thought I was buying but then I went back to the Amazon MP3 store landing page (I usually jump right into search or follow direct links) and it is clear that MP3s and Amazon Cloud player now go hand in hand like iTunes and iPod. This is the exact opposite of what I want and why I liked Amazon for buying MP3s in the first place. The cloud player says &#8220;Your music. Everywhere.&#8221; but I already have that so it offers me nothing new. </p>
<p>Its not just Linux users that are affected. The move to the cloud has an impact on Mac and Windows users as detailed by the <a href="http://www.leisurelyhistorian.net/amazon-changes-download-policies-drm-creep-or-privacy-nightmare">The Leisurely Historian</a>.</p>
<p>So where can I buy my MP3s now? Is it back to CDs?</p>
]]></content:encoded>
			<wfw:commentRss>http://hardlikesoftware.com/weblog/2012/09/13/amazon-mp3-drops-linux-who-wants-my-money-now/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>JavaFX&#8217;s FXML a big step backwards</title>
		<link>http://hardlikesoftware.com/weblog/2011/09/14/javafxs-fxml-a-big-step-backwards/</link>
		<comments>http://hardlikesoftware.com/weblog/2011/09/14/javafxs-fxml-a-big-step-backwards/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 04:57:28 +0000</pubDate>
		<dc:creator>John Snyders</dc:creator>
				<category><![CDATA[Java]]></category>
		<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://hardlikesoftware.com/weblog/?p=139</guid>
		<description><![CDATA[I shouldn&#8217;t care about this because I don&#8217;t use JavaFX. But it bugs me so I&#8217;ll rant a bit.
A while ago (probably around version 1.2) the language caught my eye. I especially liked its literal declarative syntax for creating tree structures and data binding. I thought I heard that Oracle was discontinuing JavaFX but version [...]]]></description>
			<content:encoded><![CDATA[<p>I shouldn&#8217;t care about this because I don&#8217;t use <a href="http://javafx.com/">JavaFX</a>. But it bugs me so I&#8217;ll rant a bit.</p>
<p>A while ago (probably around version 1.2) the language caught my eye. I especially liked its literal declarative syntax for creating tree structures and data binding. I thought I heard that Oracle was discontinuing JavaFX but version 2.0 is in beta. I now realize that it is only JavaFX Script that is canned &mdash; JavaFX is alive and well. (JavaFX Script lives on in <a href="http://code.google.com/p/visage/">visage</a>.) The features of JavaFX are available as APIs that can be used from Java or other languages on the JVM. This is a good architecture.</p>
<p>Writing procedural code to construct a scene graph looks as ugly and cumbersome as JavaFX Script was elegant. To &#8220;fix&#8221; this problem <a href="http://fxexperience.com/2011/07/introducing-fxml/">FXML</a> was invented. FXML is a XML dialect for declaring a scene graph. </p>
<p>From what I have read there are two main motivations for using XML:</p>
<ul>
<li>Familiarity &mdash; from the getting started with FXML page: &#8220;One of the advantages of FXML is that it is based on XML and is therefore familiar to most developers&#8221;</li>
<li>No need to compile (presumably changes to FXML are made on the fly without having to restart the app). This is fair but doesn&#8217;t imply that XML is a good answer.</li>
</ul>
<p>The familiarity argument is false. It confuses syntax with semantics. Yes many developers are familiar with the syntax of XML but just because someone knows XML Schema doesn&#8217;t mean they will have any understanding of XSLT. One must still learn the semantics of FXML and that&#8217;s the hard part.</p>
<p>Here is what I think is bad about FXML:</p>
<ul>
<li>XML is just not a convenient language for source code. It is verbose and cumbersome. It has lots of little things that get in the way such as entity references. New programming languages including declarative ones should not be XML.</li>
<li>Use of character case in element names to distinguish between instances and properties is ugly.</li>
<li>Properties can be represented by either XML attributes or XML elements. This is practical but confusing and stems from using the wrong tool for the job (XML).</li>
<li>Type coercion.</li>
</ul>
<p>And a few things I liked:</p>
<ul>
<li>Use of XML processing instructions.</li>
<li>Built-in support for string translation. But it doesn&#8217;t go far enough. It should eliminate the need for maintaining resource property files and support format substitutions.</li>
<li>Concept of static properties.</li>
</ul>
<p>What FXML shows is the importance of having a literal representation for data. It looks like FXML could be used to build arbitrary heterogeneous object trees which is generally useful. What I think is really needed is an object literal syntax for Java similar in concept to what JavaScript has. The syntax used by JavaFX Script would make a great starting point. </p>
]]></content:encoded>
			<wfw:commentRss>http://hardlikesoftware.com/weblog/2011/09/14/javafxs-fxml-a-big-step-backwards/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Video editing with PiTiVi</title>
		<link>http://hardlikesoftware.com/weblog/2011/09/08/video-editing-with-pitivi/</link>
		<comments>http://hardlikesoftware.com/weblog/2011/09/08/video-editing-with-pitivi/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 03:14:19 +0000</pubDate>
		<dc:creator>John Snyders</dc:creator>
				<category><![CDATA[K'NEX]]></category>
		<category><![CDATA[Play]]></category>

		<guid isPermaLink="false">http://hardlikesoftware.com/weblog/?p=130</guid>
		<description><![CDATA[For my last video project I used Blender. It is a very capable video editor but it has a steep learning curve and is complex. I wanted something easier that I could show the kids how to use. They have had some exposure to iMovie at school. Ubuntu 10.04 (Lucid) comes with a few more [...]]]></description>
			<content:encoded><![CDATA[<p>For my last <a href="http://hardlikesoftware.com/weblog/2009/11/14/lego-climbing-robot/">video project</a> I used Blender. It is a very capable video editor but it has a steep learning curve and is complex. I wanted something easier that I could show the kids how to use. They have had some exposure to iMovie at school. Ubuntu 10.04 (Lucid) comes with a few more video editing options than past releases. I decided to give <a href="http://www.pitivi.org/">PiTiVi</a> a try. </p>
<p>Over all PiTiVi is fairly good for such a young product. It has lots of potential to be both powerful and easy to use. The documentation is good, straight forward, and easy to understand. It does leave out some background or supplemental information which I had to figure out on my own. This is not a tutorial, just some information that may be useful to others trying it out.</p>
<p>The video project I choose is a marble timer built with K&#8217;NEX that my daughter Isabella and I made for a school project of hers last year. The video was shot with a Flip HD camera. </p>
<p><iframe width="560" height="345" src="http://www.youtube.com/embed/XlWqW96L1Hc?rel=0" frameborder="0" allowfullscreen></iframe></p>
<p>I installed the latest PiTiVi version. There really is good reason to use a newer version than the one that comes with the Lucid software sources. There are many improvements and new features. The PiTiVi download page gives instructions on how install from the Ubuntu PPA (Personal Package Archive). I used version 0.14.0-2. </p>
<p>The Flip takes nice video but the HD resolution (1280&#215;720) can make it difficult to work with on underpowered computers. I have an old Z61m ThinkPad with a 64MB ATI Mobility Radeon x1300 video card. It has no problem playing back HD video but it could not handle editing.</p>
<p>The PiTiVi documentation talks about friendly video formats. It says frame-independent compression formats such as MJPEG will perform better. I figured editing may work better if I convert my Flip video, which uses a H.264 / AVC codec to MJPEG or even uncompressed. I tried both. The uncompressed AVI files were huge and didn&#8217;t perform any better so I stuck with MJPEG. It took me a while to figure out how to convert the files. Since PiTiVi is based on GStreamer I decided to try using it. There may be other tools for this. I had to learn a lot about Gstreamer and its command line program gst-launch.  The command line I finally figured out is this (just change the src and sink file names):</p>
<p><code><br />
gst-launch filesrc location=VID00001.MP4 ! decodebin name=demux demux. ! queue ! ffmpegcolorspace ! jpegenc ! mux. demux. ! queue ! mux. avimux name=mux ! filesink location=vid0001.avi<br />
</code></p>
<p>The performance was better with these files. If there was only one clip I could scrub and play back with no problem but as soon as I added another clip the video was choppy. I could have tried reducing the resolution of the video but I really wanted the result to be in HD otherwise what is the point of taking video in HD in the first place. I decided since my video would be fairly simple and short that I could manage to edit it with choppy video.  I could advance a frame at a time to check fades and transitions. Audio playback was in real time.</p>
<p>The titles were made with GIMP. When added as a clip they are automatically turned into video.</p>
<p>The most complicated thing about my video is the timer overlay. To do this I created a solid green frame using GIMP brought it into a new PiTiVi project added it as a clip and made it 30.5 seconds long. Then I rendered this to MJPEG. This gave me a green screen video 30 and a half seconds long. Then I used the <a href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-plugins/html/gst-plugins-base-plugins-plugin-pango.html">pango</a> timeoverlay plugin in the following command to add the timer.</p>
<p><code><br />
gst-launch filesrc location=green.avi ! decodebin ! timeoverlay halign=right valign=bottom xpad=100 ypad=50 font-desc="serif bold 20px" ! ffmpegcolorspace ! jpegenc ! avimux ! filesink location=timer.avi<br />
</code></p>
<p>I added the resulting timer.avi file as a clip above the marble track video and used the alpha filter effect so that the green was transparent. This gives a counting timer overlaid on the marble video. All that remained was to start it when the marbles started and trim it when the last marble hit the table.</p>
<p>PiTiVI has plenty of effects. The one I wanted to use was Bulge. I would have used it on the main title screen but I wanted it to move across the screen. The effects will be much better once they can be animated over time with the key frames. Also if the pango plugin was available in the effect library perhaps I wouldn&#8217;t have needed to use a command line.</p>
<p>One problem the video has that I couldn&#8217;t find a way to fix is an audio glitch at the beginning and end of each voice over. The voice over quality in general is not that good probably due to a cheap microphone. The voice was recorded separate from the video. I used Audacity to cleanup the audio some.</p>
<p>I tried rendering in a few different formats. 1) MP4, FFmpeg PEG-4 part 2, ACC. This produced a very small file (16MB) and rendered quickly but the video quality was very poor. 2) Ogg, Theora, Vorbis. This produced very good quality video. Render time was about 20min. The file size is 187MB. 3) AVI, FFmpeg motion jpeg, ACC. The video quality was not very good the file was large (127MB) but the render time was very fast (~7min). 4) WebM, On2 VP8, Vorbis. The video quality was very good, the file was small (22MB) but it took about 44 min to render. Uploading the WebM format to youtube didn&#8217;t work so I uploaded the Ogg format. There are many other rendering options but these are the only ones I have tried so far. The audio glitch was present in all rendering formats.</p>
<p>My wish list for PiViTi:</p>
<p>The documentation should include more information on preferred video formats for editing and how to use external tools to do the conversion. Even better would be built-in tools do do the conversion.</p>
<p>The documentation should give advice on different rendering combinations. There are many containers each with different options for video and audio codecs. It would be nice to have a simplified dialog that  chooses a recommended output format based on high level choices such as what do you plan to do with the video (burn to DVD, upload to YouTube etc.) and other choices like do you prefer open standards.</p>
<p>The render dialog should remember the last folder I rendered into.</p>
<p>Here is a direct link to the <a href="http://www.youtube.com/watch?v=XlWqW96L1Hc">video</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardlikesoftware.com/weblog/2011/09/08/video-editing-with-pitivi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Angular, Bindings and Templates</title>
		<link>http://hardlikesoftware.com/weblog/2010/09/19/angular-bindings-and-templates/</link>
		<comments>http://hardlikesoftware.com/weblog/2010/09/19/angular-bindings-and-templates/#comments</comments>
		<pubDate>Mon, 20 Sep 2010 01:53:00 +0000</pubDate>
		<dc:creator>John Snyders</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Web Apps]]></category>
		<category><![CDATA[ajax]]></category>

		<guid isPermaLink="false">http://hardlikesoftware.com/weblog/?p=97</guid>
		<description><![CDATA[I recently watched a video about a cool new technology called &#60;angular/&#62;. It looks like a great way to create web applications. It caught my attention because I saw in it some parallels with some of my recent writings and what I am currently working on.
The video was very good but in the beginning Misko [...]]]></description>
			<content:encoded><![CDATA[<p>I recently watched a <a href="http://www.youtube.com/watch?v=0iQCLlu1dko">video</a> about a cool new technology called <a href="http://angularjs.org">&lt;angular/&gt;</a>. It looks like a great way to create web applications. It caught my attention because I saw in it some parallels with some of my recent <a href="/weblog/2009/05/14/a-declaritive-language-for-web-applications/">writings</a> and what I am currently <a href="/weblog/2010/09/06/implementing-a-domain-specific-language/">working on</a>.</p>
<p>The video was very good but in the beginning Misko Hevery struggled a bit to describe it and at the end admitted the biggest problem was explaining to people what &lt;angular/&gt; is. To me it is clearly a language, and an extensible one at that. It is (or at least contains) as he describes an HTML compiler. Doesn&#8217;t a compiler imply some language to compile. The source is clearly more than just HTML so it must be more than just an HTML compiler. I wonder if there is some reason he avoids calling it a language. The fact that it can be extended to handle new behaviors, widgets, etc. just makes it a better language. Is there some fear that calling it a language would put people off? It doesn&#8217;t bother me since I previously said that higher level languages will provide the <a href="/weblog/2009/04/20/writtten-language-already-the-best-tool-for-software/"> biggest productivity gains</a>. </p>
<p>The parallels I was talking about are:</p>
<ul>
<li>Its a declarative language</li>
<li>The language is designed to be extended</li>
<li>It has two way data binding</li>
</ul>
<p>Two way data binding is a very important aspect in simplifying the creation of web apps. The first time I ever saw data binding was back in the the late &#8217;80s. I was visiting a friend that was working on a <a href="http://en.wikipedia.org/wiki/Maser">maser</a>, which is cool (literally) in its own right, but what caught my eye, as he showed me around his lab, was some software running on an old Mac. That software was LabView. The fact that a line drawn between a sensor and a gauge meant that any time the senor value changed the gauge was updated really impressed me. More recently I noticed that data binding is built in to the JavaFX language. I haven&#8217;t written any programs in LabView or JavaFX so I&#8217;m not sure if the bindings can be bidirectional but I&#8217;m pretty sure at least in JavaFX that bidirectional changes can be accomplished.</p>
<p>It is the two way data bindings that most notably distinguish &lt;angular/&gt; from template languages. I used to be a big fan of template languages, and StringTemplate was my favorite. Lately I have found them to be less useful. One reason is that in my recent work I have found that procedural logic far outweighs the amount of template text. The bigger reason is that most template languages don&#8217;t automatically protect you from <a href="/weblog/2008/02/15/script-injection-and-stringtemplate/">script injection (XSS)</a>. There are many JavaScript template languages available now and I don&#8217;t have a need for any of them. But &lt;angular/&gt; is different &mdash; it is not a template language and it looks like it protects against script injection by default.</p>
<p>&lt;angular/&gt; is new but it looks very promising.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardlikesoftware.com/weblog/2010/09/19/angular-bindings-and-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Implementing a domain specific language</title>
		<link>http://hardlikesoftware.com/weblog/2010/09/06/implementing-a-domain-specific-language/</link>
		<comments>http://hardlikesoftware.com/weblog/2010/09/06/implementing-a-domain-specific-language/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 01:53:13 +0000</pubDate>
		<dc:creator>John Snyders</dc:creator>
				<category><![CDATA[Programming Languages]]></category>
		<category><![CDATA[Software Development]]></category>
		<category><![CDATA[Web Apps]]></category>

		<guid isPermaLink="false">http://hardlikesoftware.com/weblog/?p=95</guid>
		<description><![CDATA[I have been so busy at work lately that since wrapping up the climbing robot I haven&#8217;t had time for any substantial personal projects. What I&#8217;ve been working on is a declarative DSL for implementing a web application based on ideas I previously wrote about. Like I said its a work project so I can&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I have been so busy at work lately that since wrapping up the <a href="http://hardlikesoftware.com/weblog/2009/11/14/lego-climbing-robot/">climbing robot</a> I haven&#8217;t had time for any substantial personal projects. What I&#8217;ve been working on is a declarative DSL for implementing a web application based on <a href="http://hardlikesoftware.com/weblog/2009/05/14/a-declaritive-language-for-web-applications/">ideas</a> I previously wrote about. Like I said its a work project so I can&#8217;t go into any details. I will say that I&#8217;m working with <a href="http://www.antlr.org/">ANTLR v3</a> and <a href="http://jquery.com/">jQuery</a>, which are technologies I really like. My point in mentioning it is that if you read that post and wondered, like I did, if those ideas would work I believe the project is far enough along that I can say that they do.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardlikesoftware.com/weblog/2010/09/06/implementing-a-domain-specific-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Lego Climbing Robot</title>
		<link>http://hardlikesoftware.com/weblog/2009/11/14/lego-climbing-robot/</link>
		<comments>http://hardlikesoftware.com/weblog/2009/11/14/lego-climbing-robot/#comments</comments>
		<pubDate>Sat, 14 Nov 2009 05:11:19 +0000</pubDate>
		<dc:creator>John Snyders</dc:creator>
				<category><![CDATA[K'NEX]]></category>
		<category><![CDATA[Lego]]></category>
		<category><![CDATA[Play]]></category>

		<guid isPermaLink="false">http://hardlikesoftware.com/weblog/2009/11/14/lego-climbing-robot/</guid>
		<description><![CDATA[Way back in January I watched a Google tech talk video Lego Engineering: from kindergarten to college. The talk stresses the importance of teaching engineering in schools. A few days later at breakfast I started talking with my oldest daughter, Alexandria, about engineering and what it is that engineers do. I said that engineers use [...]]]></description>
			<content:encoded><![CDATA[<p>Way back in January I watched a Google tech talk video <a href="http://www.youtube.com/watch?v=EG-izyXfFHI">Lego Engineering: from kindergarten to college</a>. The talk stresses the importance of teaching engineering in schools. A few days later at breakfast I started talking with my oldest daughter, Alexandria, about engineering and what it is that engineers do. I said that engineers use what they know about science and how things work to find solutions to challenges. I threw out a challenge as an example: Build the tallest possible tower that fits in our house and then build a robot to climb it. It was just an example but she got really excited about the idea. &#8220;Can we build it. Can we. Can we.&#8221; she said. I said &#8220;sure&#8221;.</p>
<p>In March I posted a <a href="/weblog/2009/03/28/lego-robot-preview/">preview</a> of the robot with a picture and promises of more details to come. Its taken me way to long to finally write it up. The robot has been done since May and has made a dozen or so ascents. Making the video is what caused the delay. </p>
<p><object width="425" height="344"><param name="movie" value="http://www.youtube.com/v/-WfDdsEpBX0&#038;hl=en&#038;fs=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/-WfDdsEpBX0&#038;hl=en&#038;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"></embed></object></p>
<p>Here is what I remember of the process.<br />
<span id="more-81"></span><br />
I asked Alexandria what the tower should be made of and where is the tallest place in the house. Wood and <a href="http://en.wikipedia.org/wiki/K%27NEX">K&#8217;NEX</a> were the candidate tower materials. We had just gotten some K&#8217;NEX for Christmas so that seemed like the more interesting choice. We measured a few places in the house and found that the tallest possible place was the stairs that went from the basement to the second floor but in at least one spot it would be too narrow for a robot. The second tallest place has a ceiling fan in the way. That left the play room which has a sloped ceiling just over 11ft at its highest. We have a large Lego collection including the <a href="http://en.wikipedia.org/wiki/Lego_Mindstorms">RCX</a> so it was clear that the robot would be made out of Legos.</p>
<p><img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2009/11/tower01.jpg' alt='Tower01' style="float:right;padding-left:1em;" /></p>
<p>One weekend morning Alexandria and I set out to build the tower. We were both new to K&#8217;NEX so we started by just playing around with different ways of connecting them. We each came up with a tower design. Alexandria&#8217;s was stronger (and looked cooler) but used more pieces. We decided to go with her design after removing some parts to conserve materials without reducing the strength. In the end we ran out of some parts so we switched to a simpler design that used parts that we still had plenty of for the top of the tower. The total height of the tower is 10ft 9in (3.28 meters). The tower has a ladder built into one of its faces for the future robot to climb.</p>
<p>Later, my other daughter, Isabella, helped build the tower base out of wood. She cut strips of wood and screwed them to a piece of scrap plywood to hold the tower steady as the robot climbed. There are no guy wires or anything else holding the tower steady.</p>
<p>With the tower complete it was time to work on the robot. I knew that this would be much more challenging than the tower but I still wanted to involve the kids as much as possible. We talked about how design ideas can come from watching other things work including nature. We acted out how people climb ladders and modeled the motion of a simple arm with Legos. I played a little with a motorized elbow and shoulder but quickly realized that it would end up being too heavy, not strong enough and use more motors than the Lego RCX can control (it has a maximum of three outputs). </p>
<p>I switched to a design that used rack gears to move an arm up and down. A quick test showed that driving the rack gear directly from the motor would not have enough power to lift the robot. Gear reduction would be needed. This was a good opportunity to demonstrate to the kids how you can trade speed for power with different size gears. </p>
<p><img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2009/11/motor01.JPG' alt='Climber V1 Motor' style="float:left;padding-right:1em;" /></p>
<p>The robot has two climbing arms. The left and right sides are mirror images so Alexandria and I built one side each in parallel. At this point we had a good motorized climbing mechanism with switches so that the robot controller would know when the arms were at their farthest extent either up or down. It used two motors and two switches. The arms had enough reach for the  ladder rung spacing but how it would grab and release was still an unsolved problem and turned out to be one of the hardest.</p>
<p>I used a section of the tower ladder for testing out various designs for how the robot arms would grab and release. The general principals were fairly simple. It needed a pivot and a curved or angled piece to move the hook out of the way as the arm moved up past the next rung. It would then need to snap back into place so the hook could engage the rung as the arm moved down. Selecting just the right combination of pieces that would work with the K&#8217;NEX ladder design was very challenging. I worked on this many nights without finding a solution that I thought would be robust enough. </p>
<p><img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2009/11/claw01.JPG' alt='Climber V1 claw' style="float:right;padding-left:1em;" /></p>
<p>I stopped working on it for a while and it might have become another uncompleted project if Alexandria hadn&#8217;t reminded us to get back to work on it. I finally came up with a design for the grabbing hook. The blue curved part and the pivot point near the rack gear allows the hook to move out of the way as it slides past the ladder rungs. Then a rubber band snaps the hook back into place. The black piece sticking up contacts a switch on the down stroke.</p>
<p>Deciding where to place the RCX programmable brick was a challenge. Putting it on top of the motors would move the center of mass too far way from the ladder, which would make it difficult for the hooks to grab on. This lead to the hinged design that allowed the robot to drive up to the tower then fold flat and hang down as the robot climbed. </p>
<p>Here is the first version of the climbing robot:</p>
<p><img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2009/11/climberv1.JPG' alt='Climber V1' style="float:left;padding-right:1em;" /></p>
<p>With the mechanics working it was time to start programming. I like to use the text based <a href="http://en.wikipedia.org/wiki/Not_Quite_C">NQC</a> language for programming the RCX rather than the Lego Mindstorms picture based language. It is also easier to setup and use on Linux.</p>
<p>To get the kids involved we did the exercise described in the Lego Engineering video. We built a simple car and measured how far it went when the motor was turned on for one second. Then we placed a Lego minifig 4 feet from the starting line. The challenge was to figure out how long to run the motor so that the car would come as close as possible to the minifig without running it over. We had a lot of fun doing this. However, I bet it wasn&#8217;t so fun for the minfigs that got run over.</p>
<p>The program moves each climbing arm independently. There are two switches for the arms: one detects when either of the arms is all the way down and the other detects when either arm is all the way up. Because the switches are shared by both arms the program must keep track of which direction the arms are moving. If both arms are ever both up or both down there will be problems. The program counts each arm stroke and displays the count on the RCX display. It also makes a beep sound on each stroke. This beep turned out to be helpful during video editing. At start up it goes through a test cycle to make sure each arm can move all the way up and down. If something goes wrong during the startup tests it will play an alert sound and end &mdash; better to find a problem before it starts to climb.</p>
<p>While testing it became clear that more gear reduction was needed. As soon as the batteries lost more than one tenth of a volt the robot would start having trouble climbing. I added a battery voltage test at startup so it won&#8217;t climb if the battery is low. </p>
<p>Using what was learned I redesigned the robot. The gear ratio was 8 to 40 before and I added another 8 to 40. This gave a great deal of torque (and also means the robot climbs much slower). I found that if the switch or program was even a little delayed at turning off the motor it would rip the robot apart. So I did more redesign to make the switch contacts more robust and the overall structure stronger. </p>
<p>The original challenge had nothing to say about how the robot would get down or if it even would. There were plenty of details to work out just to get it to climb up but the getting down problem was in the back of my mind the whole time. While working on the hooks the general idea came to me that rubber bands would be used to pull the hooks away from the rungs while the arm moved down. The tricky part is that the same rubber bands would have to be slack on the way up. I came up with a passive mechanical design where a bar across the top of the tower would trip a lever as the robot climbed past it. This would tension the rubber bands. The lever is designed with another rubber band so that it snaps into either the up or down position and won&#8217;t stay in between. This mechanism was in the first version of the robot but it was never tested (since the robot had trouble getting to the top). This too was improved in the second version.</p>
<p>Here is what the second version of the robot looks like:</p>
<p><img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2009/03/lcr001.JPG' alt='Lego Climbing Robot 01' style="float:left;padding-right:1em;" /></p>
<p>The climbing direction lever can be seen in the climb-up position. You can also tell that the motor was reversed and the extra gears added to the outside. This allowed for the extra gears to fit in a very small space. Climbing down requires a different algorithm than climbing up. A switch is used to detect when the lever is in the down position. Even with the switch I consider it a passive design because no motor is used to change the mechanical configuration. When the robot reaches the bottom the folding action causes the lever to move part way up (releasing the switch). This is how the program detects when it is all the way down. When testing the robot would sometimes stop halfway down. The reason was that any small movement of the lever could release pressure on the switch. Given the sensitivity of the switch and the delicate balance of the rubber bands the problem was best solved in software. The program requires that the switch be off for two full cycles before ending. This is why it keeps climbing for a moment when it is at the bottom.</p>
<p>This project marks the first time that I used Lego modeling software. While redesigning between the first and second versions I wanted to remember the way it was in case I needed to go back. I had wanted to try modeling software for a while. On my previous <a href="/weblog/2007/03/07/lego-marble-machine/">Lego video</a> I got some requests for how it was made. This time I have a model to share (see below for the link). The software I used is <a href="http://www.lm-software.com/mlcad/">MLCAD</a> (under <a href="http://en.wikipedia.org/wiki/Wine_(software)">Wine</a>), and LDView. This <a href="http://www.ldraw.org/GetStarted-Linux.html">site</a> is required reading for getting this stuff running on Linux. I installed LeoCAD also but in the end preferred MLCAD. I even installed Lego Digital Designer (again using Wine) but this official program does not have very many parts and is not as powerful as the others (it looks and feels like a toy). Note: I had to turn off Compiz for LDView to work (Ubuntu 8.04).</p>
<p><img src='http://hardlikesoftware.com/weblog/wp-content/uploads/2009/11/cockpit.jpg' alt='cockpit.jpg'  style="float:right;padding-left:1em;" /></p>
<p>Isabella and I built the cockpit together and Isabella made the minifig pilots. </p>
<p>The robot had one more problem. At the very end when the wheels would first touch the ground the robot would fall over backwards. The reason was that the car wouldn&#8217;t fold back up. I tried adjusting the car so that it stayed partially folded (like a hockey stick rather than a straight line) but this moved the center of mass so that the hooks wouldn&#8217;t grab reliably. It took me a long time to figure out a solution. After considering all kinds of ideas that would require an extra motor the simple solution can be seen in the last picture. To wheels sticking out the back of the cockpit would hit the ground first and start the car folding.</p>
<p>So now its May and the robot is done. It&#8217;s final weight is 900 grams (32 ounces). It climbs up and down flawlessly. A number of visitors get to see it but the project was always intended to include a video to share on YouTube. Here again the project stalls until November.</p>
<p>The last time I edited a video was back when I was running Windows 2000. I used Adobe Premiere 6 and After Effects. Linux doesn&#8217;t have as many video editing options as Windows. One program that I saw mentioned a number of times is Cinelerra. Unfortunately it consistently crashed after a few seconds of playing any video I loaded from my Camera. (The camera is a SANYO xacti.) I also found the Cinelerra documentation to be very poor. While looking for another program I found a forum where people were voting for their favorite Linux video editor program. Someone asked why <a href="http://www.blender.org/">Blender</a> wasn&#8217;t on the list. The response: its a 3D modeling program. There were a number of follow ups explaining that while it is a 3D modeling program it also includes a very good video editor. There was something about the responses that made me want to try it. Blender is open source and cross platform, which is great. The documentation is good and the community seems very active. There are many tutorials. The down side is that it has a steep learning curve. When you first start it up it is difficult to even find the video editor. Because of the quality documentation and tutorials I kept at it. It took several hours to get used to the program but the whole time I had the feeling that the effort was worth it &#8211; that knowing this software would be useful. I&#8217;m very happy with Blender. I found that it can do all the things that I had previously done with the Adobe products.</p>
<p>I shot a bunch of views of the robot and the tower. Then two complete runs up and down the tower. Each run was a continuous shot. I did two runs so that I could cut between them to get views from different angles. The beep the robot makes at the end of each stroke, while not intended for this purpose, helped me to sync cuts between the two shots.</p>
<p>The music for the video is from the Nine Inch Nails album <a href="http://ghosts.nin.com/">Ghosts I-IV</a>, which has a Creative Commons license. (How cool is that?) </p>
<p>The model is available as a zipped LDraw format (.mpd) file <a href="/projects/lego/climber_v2.mpd.zip">here</a>. The model isn&#8217;t 100% identical to the final robot. In some cases the part library didn&#8217;t have the exact part I used. Some details such as the rubber band connectors were left off. You can compare with the video and pictures above. The model is organized into sub models and includes some steps. It is provided as-is with no warranty. It was never tested by building the robot from scratch. The NQC program <a href="/projects/lego/climber3.nqc.zip">source</a> is also provided as-is with no warranty.  Here is a direct link to the YouTube video <a href="http://www.youtube.com/watch?v=-WfDdsEpBX0">&#8220;Lego Robot Climbs K&#8217;NEX Tower&#8221;</a></p>
<p>We hope you enjoy the video.</p>
]]></content:encoded>
			<wfw:commentRss>http://hardlikesoftware.com/weblog/2009/11/14/lego-climbing-robot/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
