<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7120877094656561813</id><updated>2012-01-02T08:03:46.361+01:00</updated><category term='oscilation'/><category term='touch sensor'/><category term='speed'/><category term='design patterns'/><category term='Mindstorms'/><category term='sound sensor'/><category term='segway'/><category term='racer'/><category term='RCX'/><category term='Low Rider'/><category term='ultrasonic sensor'/><category term='LCD'/><category term='robots'/><category term='memory'/><category term='NXT'/><category term='subsumption architecture'/><category term='GUI'/><category term='software architecture'/><category term='tape'/><category term='Breitenberg'/><category term='sound'/><category term='wall follower'/><category term='line follower'/><category term='behavior'/><category term='NXT Train'/><category term='Bluetooth'/><category term='design'/><category term='firmware'/><category term='JUnit'/><category term='testing'/><category term='race'/><category term='Turing Machine'/><category term='architecture'/><category term='speed racer'/><category term='light sensor'/><category term='balance'/><category term='PID'/><title type='text'>Lego of Doom</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Martin Have</name><uri>http://www.blogger.com/profile/07000011516463115777</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>26</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-3690794384084741532</id><published>2009-01-28T15:36:00.003+01:00</published><updated>2009-01-28T15:46:01.679+01:00</updated><title type='text'>Turing Machine Demonstration Video</title><content type='html'>&lt;object width="425" height="344"&gt;&lt;param name="movie" value="http://www.youtube.com/v/cYw2ewoO6c4&amp;hl=en&amp;fs=1"&gt;&lt;/param&gt;&lt;param name="allowFullScreen" value="true"&gt;&lt;/param&gt;&lt;param name="allowscriptaccess" value="always"&gt;&lt;/param&gt;&lt;embed src="http://www.youtube.com/v/cYw2ewoO6c4&amp;hl=en&amp;fs=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="425" height="344"&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;&lt;br /&gt;We have made a short TV Shop themed demonstration of the Turing Machine. &lt;br /&gt;&lt;br /&gt;The demonstration is intended to be fun and entertaining while providing idea and intuition of our project and what the Turing Machine can do. It does, as such, not give detailed information on the techniques and theories behind the project. For this, we refer to this blog :)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-3690794384084741532?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/3690794384084741532/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=3690794384084741532' title='8 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/3690794384084741532'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/3690794384084741532'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2009/01/turing-machine-demonstration-video.html' title='Turing Machine Demonstration Video'/><author><name>Anders Nissen</name><uri>http://www.blogger.com/profile/09289108430925099897</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>8</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-6564609813371479161</id><published>2009-01-28T12:18:00.009+01:00</published><updated>2009-01-28T14:59:17.716+01:00</updated><title type='text'>Pictures of the Turing Machine</title><content type='html'>&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_6L8OkA0EmwA/SYBE4hpT4ZI/AAAAAAAABQQ/YGHYml2m4DI/s1600-h/Lego+010.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 240px; height: 320px;" src="http://4.bp.blogspot.com/_6L8OkA0EmwA/SYBE4hpT4ZI/AAAAAAAABQQ/YGHYml2m4DI/s320/Lego+010.jpg" alt="" id="BLOGGER_PHOTO_ID_5296308899682705810" border="0" /&gt;&lt;/a&gt;&lt;img src="http://3.bp.blogspot.com/_6L8OkA0EmwA/SYBE3OEQplI/AAAAAAAABQA/fweslO_UQAY/s320/Lego+008.jpg" style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 240px; height: 320px;" alt="" id="BLOGGER_PHOTO_ID_5296308877247161938" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_6L8OkA0EmwA/SYBEFZmI2KI/AAAAAAAABPo/bdQhWWTnFHo/s1600-h/Lego+005.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_6L8OkA0EmwA/SYBEFZmI2KI/AAAAAAAABPo/bdQhWWTnFHo/s320/Lego+005.jpg" alt="" id="BLOGGER_PHOTO_ID_5296308021348587682" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_6L8OkA0EmwA/SYBEFb7-OcI/AAAAAAAABPg/HBmptT0EzbI/s1600-h/Lego+004.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_6L8OkA0EmwA/SYBEFb7-OcI/AAAAAAAABPg/HBmptT0EzbI/s320/Lego+004.jpg" alt="" id="BLOGGER_PHOTO_ID_5296308021977037250" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_6L8OkA0EmwA/SYBEFN3XjJI/AAAAAAAABPY/YOs5DPoPNtY/s1600-h/Lego+003.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_6L8OkA0EmwA/SYBEFN3XjJI/AAAAAAAABPY/YOs5DPoPNtY/s320/Lego+003.jpg" alt="" id="BLOGGER_PHOTO_ID_5296308018199628946" border="0" /&gt;&lt;/a&gt;&lt;img src="http://2.bp.blogspot.com/_6L8OkA0EmwA/SYBE2ZKGndI/AAAAAAAABPw/RZQt2mnN7jU/s320/Lego+006.jpg" style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" alt="" id="BLOGGER_PHOTO_ID_5296308863044591058" border="0" /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_6L8OkA0EmwA/SYBEE4MdGNI/AAAAAAAABPQ/5qj-vwbm9K4/s1600-h/Lego+002.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" src="http://3.bp.blogspot.com/_6L8OkA0EmwA/SYBEE4MdGNI/AAAAAAAABPQ/5qj-vwbm9K4/s320/Lego+002.jpg" alt="" id="BLOGGER_PHOTO_ID_5296308012382492882" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_6L8OkA0EmwA/SYBDT6bcvtI/AAAAAAAABPA/gS9xG28Rm_w/s1600-h/IMG_1766.JPG"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_6L8OkA0EmwA/SYBDT6bcvtI/AAAAAAAABPA/gS9xG28Rm_w/s320/IMG_1766.JPG" alt="" id="BLOGGER_PHOTO_ID_5296307171168665298" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_6L8OkA0EmwA/SYBDTrApaoI/AAAAAAAABOw/A0o0vmM1O_Y/s1600-h/Billede206.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_6L8OkA0EmwA/SYBDTrApaoI/AAAAAAAABOw/A0o0vmM1O_Y/s320/Billede206.jpg" alt="" id="BLOGGER_PHOTO_ID_5296307167029717634" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_6L8OkA0EmwA/SYBDSReegTI/AAAAAAAABOg/aUKX0AIIZfM/s1600-h/Billede204.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_6L8OkA0EmwA/SYBDSReegTI/AAAAAAAABOg/aUKX0AIIZfM/s320/Billede204.jpg" alt="" id="BLOGGER_PHOTO_ID_5296307142995640626" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_6L8OkA0EmwA/SYBCru5lWbI/AAAAAAAABOI/EfTeOOh0Y1I/s1600-h/Billede197.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" src="http://2.bp.blogspot.com/_6L8OkA0EmwA/SYBCru5lWbI/AAAAAAAABOI/EfTeOOh0Y1I/s320/Billede197.jpg" alt="" id="BLOGGER_PHOTO_ID_5296306480879065522" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_6L8OkA0EmwA/SYBCrOYVRGI/AAAAAAAABOA/539DjLkOxzI/s1600-h/Billede196.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 320px; height: 240px;" src="http://4.bp.blogspot.com/_6L8OkA0EmwA/SYBCrOYVRGI/AAAAAAAABOA/539DjLkOxzI/s320/Billede196.jpg" alt="" id="BLOGGER_PHOTO_ID_5296306472149664866" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;img src="http://1.bp.blogspot.com/_6L8OkA0EmwA/SYBE2ytPwJI/AAAAAAAABP4/P6aPCQ-UoBk/s320/Lego+007.jpg" style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 240px; height: 320px;" alt="" id="BLOGGER_PHOTO_ID_5296308869902876818" border="0" /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_6L8OkA0EmwA/SYBCrLf5vWI/AAAAAAAABN4/g2s_DvzZDTs/s1600-h/Billede195.jpg"&gt;&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-6564609813371479161?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/6564609813371479161/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=6564609813371479161' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/6564609813371479161'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/6564609813371479161'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2009/01/pictures-of-turing-machine.html' title='Pictures of the Turing Machine'/><author><name>Martin Have</name><uri>http://www.blogger.com/profile/07000011516463115777</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_6L8OkA0EmwA/SYBE4hpT4ZI/AAAAAAAABQQ/YGHYml2m4DI/s72-c/Lego+010.jpg' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-2895256753671290412</id><published>2009-01-26T13:43:00.004+01:00</published><updated>2009-01-28T11:30:00.620+01:00</updated><title type='text'>Conclusion</title><content type='html'>&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;In the blog about the end course project, we decided that our project would be to construct and program a Turing Machine, a theoretical model of computation described by&lt;span style="font-weight: bold;"&gt;&lt;/span&gt; Alan Mathison Turing in 1936.&lt;br /&gt;The Turing Machine we had planned would consist of three main parts, or functions, to mirror the theoretical design:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;A tape of input symbols which also functions as the working tape&lt;/li&gt;&lt;li&gt;A mechanism to read values from said tape at the Machine's current position&lt;br /&gt;&lt;/li&gt;&lt;li&gt;A mechanism to alter the content of the tape at the current position&lt;/li&gt;&lt;/ol&gt;The machine would also have to be able to move back and forth across the tape.&lt;br /&gt;&lt;br /&gt;In the weeks following the formulation of our statement of intent, we constructed the Lego Turing Machine Robot to be capable of all these things.&lt;br /&gt;The tape was made physical using Lego train tracks, the input symbols represented by Lego bricks encoding binary values.&lt;br /&gt;Reading from the tape would be possible by the use of movable pressure sensors, which would descend onto the tape to detect the position of each "bit block" in turn.&lt;br /&gt;Writing was accomplished by the movement of a sliding "arm" or "claw" which could move the "bit blocks" from one binary position to the other.&lt;br /&gt;&lt;br /&gt;Moving back and forth across the tape was trivial; doing so precisely was another matter. The solution we ended up with uses reactive control to accurately navigate the track. The Turing Machine Robot moves along a strip of alternating black/white squares at the side of the tape by taking readings of it with a light sensor. Two black/white transitions correspond to one shift of binary cell.&lt;br /&gt;&lt;br /&gt;Our success in implementing the Turing Machine as a physical device is exciting because the Turing Machine theoretical construct is such an iconic part of computer science. The Robotic Turing Machine is not in itself a practical machine, but it does illustrate the theoretical points made by Turing, and so could easily find application in the field of teaching. Illustrating the theory of a Turing Machine might be made easier with a physical machine at hand to aid in comprehension. Seeing a physical machine performing TM operations can be easier to follow than the typical java applet example and might give a better intuitive understanding of the TM theory.&lt;br /&gt;&lt;br /&gt;At the moment, however, the Turing Machine does not completely emulate all facets of the theoretical model. For one thing, we don't have access to an infinite tape. As we do have access to quite a lot of tape, this "problem" is pretty academic.&lt;br /&gt;To fully conform to the theoretical model, we want to be able to position the Turing Machine in one spot and performing calculations from that spot, instead of automatically positioning it at the left-hand side of the tape.&lt;br /&gt;A few further expansions could be made on the robot, given another month or so. The fact that the write and read arms are not positioned over the same cell is impractical and could be rectified by combining the two into one mechanism.&lt;br /&gt;In fact, given enough time, a complete overhaul of the Turing Machine to run on more standard-sized Lego tracks would be useful.&lt;br /&gt;Enhancing the user interface might also be a good idea, since at the moment, running a program on the TM Robot requires some degree of insight into its inner workings.&lt;br /&gt;&lt;br /&gt;However, all these modifications are strictly unnecessary as the Turing Machine Robot already runs successfully on many different inputs (including palindrome) and lives up to every expectation we have had.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-2895256753671290412?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/2895256753671290412/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=2895256753671290412' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/2895256753671290412'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/2895256753671290412'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2009/01/conclusion.html' title='Conclusion'/><author><name>Sean Geggie</name><uri>http://www.blogger.com/profile/00618586289925398694</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-3700866645072632604</id><published>2009-01-20T17:36:00.000+01:00</published><updated>2009-01-28T11:18:01.543+01:00</updated><title type='text'>Optimization</title><content type='html'>&lt;div class="post hentry uncustomized-post-template"&gt; &lt;a name="2396122986952641845"&gt;&lt;/a&gt;   &lt;div class="post-body entry-content"&gt; &lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;div   style="border-width: 0px; margin: 0px; padding: 3px; width: auto; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size-adjust: none; font-stretch: normal; text-align: left;font-family:Georgia,serif;font-size:100%;"&gt;&lt;br /&gt;Date: January 22&lt;br /&gt;Duration of activity: 1 hour&lt;br /&gt;Group members participating: Anders, Mikkel, Martin, Sean&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Ignoring redundant write operations&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Goal&lt;/span&gt;: &lt;span&gt;To make optimizations to the robot in order to make it more efficient during its computations&lt;span style="font-weight: bold;"&gt;. &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"&gt;Our first goal, was to make the robot ignore a write request if it knows that the current cell has the same value as it is going to write. &lt;/span&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Experiment - optimizing read/write mechanism &lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span"&gt;Since &lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;the sequence of bluetooth commands is fixed, we know that a write request follows after a read request.&lt;br /&gt;A standard sequence of commands send by bluetooth looks like the following:&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;Read request&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Write request&lt;/li&gt;&lt;li&gt;Move request&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;We maintain the last value read doing the read requests and checks at the write request if the value is the same, if it is, we ignore the write request internally on the robot. We still send the OK signal back via bluetooth.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Result:&lt;br /&gt;&lt;/span&gt;&lt;span&gt;This simple optimization is seen to maximize the efficiency of the robot by a large degree. &lt;/span&gt;Before, the robot could try to write the value already present in the cell, but now, it checks whether it should write the new value. Besides being faster, it is also easier to see what is happening since the naive write commands are gone.&lt;/li&gt;&lt;/ul&gt;&lt;br /&gt;&lt;div class="post hentry uncustomized-post-template"&gt; &lt;a name="2396122986952641845"&gt;&lt;/a&gt;   &lt;div class="post-body entry-content"&gt; &lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;div   style="border-width: 0px; margin: 0px; padding: 3px; width: auto; font-style: normal; font-variant: normal; font-weight: normal; line-height: normal; font-size-adjust: none; font-stretch: normal; text-align: left;font-family:Georgia,serif;font-size:100%;"&gt;Group members participating: Anders, Mikkel, Martin, Sean&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Improving the move function&lt;/span&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Goal&lt;/span&gt;: To move the Turing Machine across the tape, a move function is called repeatedly. This function starts the engine, then waits until the light sensor detects a transition in colour and stops the engine. Calling this function repeatedly means starting and stopping the engine for each transition to be moved, which causes slow and choppy motion in the TM. The goal of this experiment is to improve this code to enhance performance.&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Experiment&lt;/span&gt;&lt;br /&gt;Since the point is to let the TM move across several transitions without stopping at each, a new move function is implemented. The function, which takes as parameter a count of the number of transitions we wish the TM to move,&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;ol&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;li&gt;Starts the motor&lt;/li&gt;&lt;li&gt;Checks the light sensor for colour change&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Counts down the number of transitions remaining by one if a change has occurred&lt;/li&gt;&lt;li&gt;Stops the engine once the count reaches 0&lt;/li&gt;&lt;/span&gt;&lt;/span&gt;&lt;/ol&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;With this new move function implemented, it should be obvious whether it has had a positive or detrimental influence on runtime and efficiency. Due to the architecture of the Turing Machine, no further changes should be made to compensate for the new function.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Result:&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;br /&gt;The effect of the alteration is immediately noticeable. The motion of the Turing Machine is much smoother and quicker, as expected. However, a new concern arises from the faster motion across the track: Will the engine be able to stop "in time" when it crosses a transition?&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;Group members participating: Anders, Mikkel, Martin, Sean&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span style="font-weight: bold;"&gt;Compensating for excessive movement&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Goal&lt;/span&gt;&lt;span&gt;&lt;span style="font-weight: bold;"&gt;:&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt; In testing the new move function it would appear that the machine is prone to stopping "too late" and ending up displaced by one transition. The error seems to depend at least partially on light conditions, as the light sensor might pick up on transitions too late to allow the Machine enough time to come to a complete rest.&lt;br /&gt;The goal of this experiment is to improve the movement code to compensate for this error.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span style="font-weight: bold;"&gt;Experiment&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;:&lt;/span&gt;&lt;br /&gt;The experimental improvement works as follows:&lt;br /&gt;If the robot ever slides too far along the track after a move, the light sensor ends up over a square of the opposite colour to what it is supposed to. If this happens, the robot is instructed to move backwards a single transitions. However, "backwards" is not trivially decidable currently, as the error can occur in both directions of motion.&lt;br /&gt;Therefore, we make the following alterations:&lt;br /&gt;The robot always keeps track of the direction given to the last call to the move function.&lt;br /&gt;Before moving, the move method takes a light reading at the current position. After moving, another reading is taken and compared to the first. If the number of transitions to move was an even number, the light readings should match. On uneven numbers they should be different.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xk9ZXFslxfE/SX2bef5gj8I/AAAAAAAAAA8/1kYj_35lWTg/s1600-h/sensor01.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 298px; height: 247px;" src="http://1.bp.blogspot.com/_Xk9ZXFslxfE/SX2bef5gj8I/AAAAAAAAAA8/1kYj_35lWTg/s400/sensor01.png" alt="" id="BLOGGER_PHOTO_ID_5295559685118660546" border="0" /&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;If a discrepancy is found, the machine is told to move backwards by one transition. This move too, is subject to correction, so theoretically the machine might never STOP correcting its move, if each move goes too far. We do not expect this to occur, however. The error is very infrequent, especially in small moves.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span&gt;&lt;span&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span style="font-weight: bold;"&gt;Result:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/span&gt;Running the Turing Machine robot with the new modification clearly allows it to compensate correctly for faulty moves. Replicating the error is simple, as one can simply force the robot an extra transition forwards by hand, but the correction is also noticeable in standard executions.&lt;br /&gt;With the addition of the compensation modification, the issue of excessive movement has been effectively nullified.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-3700866645072632604?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/3700866645072632604/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=3700866645072632604' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/3700866645072632604'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/3700866645072632604'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2009/01/optimization.html' title='Optimization'/><author><name>Martin Have</name><uri>http://www.blogger.com/profile/07000011516463115777</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Xk9ZXFslxfE/SX2bef5gj8I/AAAAAAAAAA8/1kYj_35lWTg/s72-c/sensor01.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-1977154771300139632</id><published>2009-01-09T17:05:00.002+01:00</published><updated>2009-01-28T11:57:33.207+01:00</updated><title type='text'>Building the GUI</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Settling on the need for a computer-based GUI&lt;/span&gt;&lt;br /&gt;We have discussed at length how big a part of the Turing machine should be handled by the robot and a computer.&lt;br /&gt;Duration of activity: approx 10hrs spread across several days&lt;br /&gt;Group members participating: Mikkel, Martin, Anders, Sean&lt;br /&gt;&lt;br /&gt;In the one extreme, the only thing handled by the computer is sending the transition function and input tape to the robot who then carry out all other operations, and finally either writes the output on the tape or sends it back to the computer.&lt;br /&gt;&lt;br /&gt;In the other extreme, the computer handles most of the operations and the robot has a more mechanical purpose. In that case, the robot only needs the input tape, and in each step of the operation the robot will read the current cell value and ask the computer what to do next.&lt;br /&gt;The transition function will then reside on the computer, and given the input from the robot, the computer will determine the next action and send the corresponding command to the robot.&lt;br /&gt;&lt;br /&gt;We decided to choose the latter, at least to begin with. This decision is based largely on the desire to avoid the added overhead of having to implement a way of serializing, sending and deserialize the transition function to be able to use it on the robot.&lt;br /&gt;Furthermore, this approach will make it much easier to test during development, as we get feedback after each step in the computation, and thus we can easily debug every action the robot carries out. We have planned on implementing the Turing machine as abstractly as possible to allow for various degrees of computer/robot relationships without too much trouble or repeated code.&lt;br /&gt;&lt;br /&gt;In either case, we will need some kind of graphical user interface to be able to input data for the Turing machine, and to be able to transfer the data to the robot. To this end, we decided to build a simple Java GUI application using Swing.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;The requirements of the graphical user interface&lt;/span&gt;&lt;br /&gt;The GUI should allow for various settings and configurations of the Turing machine in addition to specifying the input tape and output values.&lt;br /&gt;Examining the parameters that are required by the Turing machine and the functionality that we would like to have, we arrive at a preliminary number of options that should be available through the GUI.&lt;br /&gt;&lt;br /&gt;The basic options required in the GUI are the following:&lt;br /&gt;&lt;ul&gt;&lt;li&gt; &lt;span style="font-style: italic;"&gt;Number of bits per cell&lt;/span&gt;&lt;br /&gt;This option is for specifying the number of bits that each cell contains, and thus the range of values that the cell can contain. For instance, specifying 1 bit per cell thus allows for {0,1} in the cell and specifying 3 allows for {0,1,2,3,4,5,7} in the cell.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Input tape&lt;/span&gt;&lt;br /&gt;The data to be written on the tape before execution begins. This data must conform to the cell size, so that no cell has an input value less than zero or greater than 2^&lt;span style="font-style: italic;"&gt;i&lt;/span&gt;-1, where &lt;span style="font-style: italic;"&gt;i&lt;/span&gt; is the specified number of bits per cell.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Working tape/output tape&lt;/span&gt;&lt;br /&gt;In addition to the input tape, it would be nice to have a continuous display of the working tape during execution, and finally of the output tape when execution has ended.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Transition function and functionality to load from file&lt;/span&gt;&lt;br /&gt;Naturally, we also need a way of specifying the transition function that will form the foundation that the execution will depend upon. This transition function is based on a format detailed elsewhere. Furthermore, we will like to be able to load the transition function from file in addition to inputting it manually.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Button for running&lt;/span&gt;&lt;br /&gt;We need a button for activating the execution of the Turing machine.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Option for selection which device to run on; the computer or the robot&lt;/span&gt;&lt;br /&gt;This functionality should be for selecting whether the Turing machine should be executed on the computer or the robot. The primary reason to allow execution on the computer, is to test and debug transition systems before having the robot carry operations out on them.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Speed of execution&lt;/span&gt;&lt;br /&gt;We would like to be able to control the speed of execution, both on the computer and the robot. On the computer, this will be important to be able to continuously monitor the execution on the tape, instead of just executing so fast that the output is available instantaneously (in case it doesn't loop). On the robot, it will be nice to be able to set and run at different speeds, slower to allow close observation of its operations, and faster to speed up execution.&lt;/li&gt;&lt;/ul&gt;Below is a screenshot of a preliminary layout of all the above mentioned controls and options required.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://www.daimi.au.dk/%7Eanissen/lego/GUI.png" alt="" border="0" /&gt;&lt;br /&gt;&lt;br /&gt;It is however, still lacking most of the functionality, so this is still to be implemented. We will strive to have the GUI be a thin a layer as possible as it should only invoke the other modules responsible.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-1977154771300139632?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/1977154771300139632/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=1977154771300139632' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/1977154771300139632'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/1977154771300139632'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/12/building-gui.html' title='Building the GUI'/><author><name>Anders Nissen</name><uri>http://www.blogger.com/profile/09289108430925099897</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-2396122986952641845</id><published>2009-01-07T12:30:00.001+01:00</published><updated>2009-01-28T14:42:29.006+01:00</updated><title type='text'>Initialization &amp; testing of the Input tape</title><content type='html'>&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;div style="border-width: 0px; margin: 0px; padding: 3px; width: auto; font-family: Georgia,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; text-align: left;"&gt;Date: December 5&lt;br /&gt;Duration of activity: 3 hours&lt;br /&gt;Group members participating: Anders, Mikkel, Martin, Sean&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Goal&lt;/span&gt;: To implement a functional Initialization method on the robot that knows how to find the leftmost cell and how to setup the inputtape. It should be possible to send an "INITIALIZE" signal via bluetooth, to make the robot run the method.&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Experiments: &lt;span class="Apple-style-span" style="font-weight: normal;"&gt;Before the Turing machine can start on the computation, we need to setup the input tape. We had a little brainstorm on the topic, and we discussed whether to setup the inputtape manualy or letting the robot handle it. We found that the robot should be responsible, since we could use the move/write methods to implement the behavior.&lt;br /&gt;As the first part, the robot should be able to figure out if it is positioned in the middle of the tape or to the side of it. Before we read the bit at the initial position, we have to look if we are positioned on a black or white surface. If we are positioned on a black area, we move on position the left, then read the bit value. If there is a bit at the location, we move left until we spot a cell with no bit in it, then move (cellSize-1)*2 intensitychanges to the right. (The robot's read head is position over the least significant bit in the first cell). If the robot is located to the left of the cells that contain bits, we move right until we spot a bit, then (cellSize-1)*2-2 intensity changes to the right. At present, we do not handle that the robot is positioned to the right of the cells.&lt;br /&gt;&lt;br /&gt;When the robot  is located at the leftmost cell, we send write and move signals to the robot via bluetooth. In a iterated process, we write the i'th value to the current cell, then move to the right cell. We continue until we have written the last entry in the input tape.&lt;br /&gt;When done, we send an "OK" signals to the computer.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Results: &lt;/span&gt;&lt;span style=""&gt;At first, we ran into some trouble since we did not handle the two starting positions of the Turing Machine, as described above. It meant that the robot did not position itselft correctly on the tape and was off by either a half step or a whole step, based on the starting position of the TuringMachine.&lt;br /&gt;&lt;br /&gt;At the present state, the initialization method has been implemented and should be called from the computer that is responsible for handling the abstract turing machine. At the moment, the computer is responsible for setting up the input on the robot by sending the move and write signals via bluetooth.&lt;br /&gt;In the future, we would like the robot to have a method that sets up the input tape. Then, the computer only need to send setup signal and the array of tape entries to the robot via bluetooth.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-2396122986952641845?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/2396122986952641845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=2396122986952641845' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/2396122986952641845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/2396122986952641845'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/12/turing-machine-initialization-testing.html' title='Initialization &amp; testing of the Input tape'/><author><name>Martin Have</name><uri>http://www.blogger.com/profile/07000011516463115777</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-1702481416262014766</id><published>2009-01-04T14:01:00.001+01:00</published><updated>2009-01-28T11:40:27.513+01:00</updated><title type='text'>Bluetooth communication</title><content type='html'>Duration of activity: approx 8hrs spread across several days&lt;br /&gt;Group members participating: Mikkel, Martin, Anders, Sean&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Goal:&lt;br /&gt;&lt;/span&gt;We needed some underlaying structure to handle our communication between the NXT Turing Machine and the PC controlling it. This structure should support handling the communication between the robot and computer. For instance, we need instructions like:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Read cell&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Write cell&lt;/li&gt;&lt;li&gt;Move left/right&lt;/li&gt;&lt;li&gt;Initialize the input tape values&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Setup parameters for tape size, motor speed etc..&lt;br /&gt;&lt;/li&gt;&lt;li&gt;(Transition function)&lt;/li&gt;&lt;li&gt;Commands for testing individual parts of the robot&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;span style="font-weight: bold;"&gt;Experiment:&lt;br /&gt;&lt;/span&gt;To ease the development we used the &lt;a href="http://en.wikipedia.org/wiki/Composite%20pattern"&gt;Composite pattern&lt;/a&gt; and made it event based. When it received an event, it should send that event to the listeners function for handling that specific event. This makes it easy for us to add new event types later, if  we need more, and we can also implement the functionality part by part.&lt;br /&gt;The listener implements an Interface that specifies which functions that handle the events we have implemented. To implement a new type, we add it as an enumeration value, and tell what function in the Listener interface it should call when it should notify the listener. The event is always built up by a Short containing the event type, and a Integer with the value. If we have a function that doesn't take a value (like read), the value is just set to 1, and ignored by the implementing function.&lt;br /&gt;&lt;br /&gt;When starting the Turing machine program on the NXT, it enables the Bluetooth and waits for a connection with a PC. On connection, it creates two streams, a DataInputStream and a DataOutputStream. Now it starts a thread that listens to the input stream, and when it recieves data, it creates events for them, and sends them to the listener.&lt;br /&gt;&lt;br /&gt;We have chosen the PC program, to be the one searching for the robot, and setting the connection up, as this requires a lot of different objects to be set up and activated, and we would like the robot to do as little unnecessary work as possible. Then it has private send and receive methods, to send events to the robot.&lt;br /&gt;We have implemented simple methods to send read and write events, as these are often sent, and therefore should be easy to come by.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Results:&lt;br /&gt;&lt;/span&gt;The first events we implemented were debug methods to check how many tachos the motors should rotate for the reader and writer. Also speed of these debug methods were implemented. When we had these functions going, a big error showed up. If the next event was sent before it was ready to receive it, it would be ignored. Not the behavior we wanted. This meant we have to make sure it was ready to get another event before the PC sent one. This was done by making a new event, called OK, that should be sent back when it was ready to get a new event. The only event now sending back an OK is READ, this sends back an READ_ANSWER instead.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-1702481416262014766?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/1702481416262014766/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=1702481416262014766' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/1702481416262014766'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/1702481416262014766'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/12/bluetooth-communication.html' title='Bluetooth communication'/><author><name>Mikkel Vester</name><uri>http://www.blogger.com/profile/13945104810130037500</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-3541989725096827142</id><published>2009-01-02T17:03:00.004+01:00</published><updated>2009-01-28T11:52:47.502+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='NXT'/><category scheme='http://www.blogger.com/atom/ns#' term='sound'/><category scheme='http://www.blogger.com/atom/ns#' term='LCD'/><category scheme='http://www.blogger.com/atom/ns#' term='testing'/><category scheme='http://www.blogger.com/atom/ns#' term='touch sensor'/><category scheme='http://www.blogger.com/atom/ns#' term='JUnit'/><category scheme='http://www.blogger.com/atom/ns#' term='Bluetooth'/><title type='text'>Internal operations on the robot</title><content type='html'>&lt;span style="font-weight: bold;"&gt;General observations:&lt;/span&gt;&lt;br /&gt;The class which resides on the NXT is responsible for the methods that interact directly with the motors and sensors. That is; reading, writing and moving. These methods have been implemented in the class &lt;span style="font-style: italic;"&gt;Robot.java&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Basically, since the light sensor is positioned above the black track markers on the left side of the track, we use it to detect changes in light intensity, which tells us that it has moved from one black square to a space between squares. The move method turns on the motor and drives forwards as long as no change in intensity is detected.&lt;br /&gt;&lt;br /&gt;The reader arm is five intensity changes away from the writer claw, so some maneuvering is required between reading and writing.&lt;br /&gt;&lt;br /&gt;When the read method is called, the robot swings the read arm down to read the first bit, then moves two intensity-changes (one bit) forwards and reads the next. When it is done, it resets its position over the bit.&lt;br /&gt;&lt;br /&gt;The writer operates in similar fashion, save that it swings back and forth across the track depending on the type of bit that needs to be set.&lt;br /&gt;&lt;br /&gt;Since the move method keeps the motor on until there is a intensity change in the light sensors reading, it is built upon &lt;span class="Apple-style-span" style="font-style: italic;"&gt;&lt;a href="http://www.legolab.daimi.au.dk/DigitalControl.dir/index.html"&gt;reactive control&lt;/a&gt;&lt;span class="Apple-style-span" style="font-style: normal;"&gt;. We have not used an approach where we observe several readings before judging whether or not an intensity change has occurred. The observations of this straight forward implementation gives a solid picture that the robots behavior is indeed correct.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;The model of movement is quite solid, even though that we are not positioned directly above the bit when we have to make a reading. When the read head is extended, it only touches the LEGO bits by half of its surface, as can be seen in the videos posted.&lt;br /&gt;&lt;br /&gt;The amount of movement required to read/write was experimentally established previously.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Test process&lt;br /&gt;&lt;/span&gt;The read/write mechanism, has been tested locally on the NXT by making a simple test method in the robot class that is called on execution. Here, we hardcode the transition function by simple calls to read, write, and move.&lt;br /&gt;&lt;br /&gt;Duration of activity: 2hrs&lt;br /&gt;Group members participating: Mikkel, Martin, Anders, Sean&lt;br /&gt;&lt;br /&gt;First experiment:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Goal:&lt;br /&gt;&lt;/span&gt;Testing the read mechanism.&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;Experiment:&lt;br /&gt;&lt;/span&gt;We started testing the read method, by doing iterated tests on the &lt;span style="font-style: italic;"&gt;cellSize&lt;/span&gt;. At each iteration, we gathered information on the correctness on the value read, the movement between individual bits and the movement back to the least significant bit (the start position of a given cell). We also tested that the conversion from bits to integers was indeed correct.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Results:&lt;br /&gt;&lt;/span&gt;During the testing of the read mechanism, the touch sensors gave us a bit of a problem.  How long do we have to rotate the motor, and what cell position equals one and vice versa. Earlier we tested the rotation of the motor with a Bluetooth connection. When the touch sensors extend, they have to be able to read the correct position of the bit. The problem was, that we had not come up with a convention that says which positions equals what. This is discussed in a previous blog entry.&lt;br /&gt;&lt;br /&gt;To avoid the same mistake again, we chose to use sounds and the LCD display to play/display output during a test run.&lt;br /&gt;&lt;br /&gt;Second experiment:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Goal:&lt;/span&gt;&lt;br /&gt;The write method was tested in the same way. The primary differences are, that we need to convert from integers to bits, which is a little bit different than making the conversion the other way around, and that the rotation of the motor has to be more precise.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Experiment:&lt;br /&gt;&lt;/span&gt;We have made the write method be responsible for checking that we do not write the same value as the last read value, and that we do not try to move a bit to the same position as it is in. At present, to test the first functionality, we manually have to set the input tape to a given value and then try to write the same integer.&lt;br /&gt;&lt;br /&gt;The second case also requires that the tape has been set manually. It is a success if the robot "skips" the bits that do not have to be moved.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Results:&lt;br /&gt;&lt;/span&gt;The write arm functions as expected, no further observations made.&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Conclusion of the tests:&lt;/span&gt;&lt;br /&gt;In testing the above we have found that it is sometimes difficult to determine when the Turing Machine fails and why.&lt;br /&gt;We have been thinking about making the Turing Machine a little bit more responsive the value it reads and writes to the tape. To achieve that, we have had a look at the &lt;span style="font-style: italic;"&gt;Sound.java&lt;/span&gt; class which have the functionality we are looking for. At the moment, if the robot reads a bit with value 1, it plays a positive beep sequence. On the other hand, if it reads a zero, it plays a sad sound. This information is also a good supplement in debugging, since we know what the robot reads and writes.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-3541989725096827142?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/3541989725096827142/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=3541989725096827142' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/3541989725096827142'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/3541989725096827142'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/12/turing-machine-status-update.html' title='Internal operations on the robot'/><author><name>Sean Geggie</name><uri>http://www.blogger.com/profile/00618586289925398694</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-6915963236737865697</id><published>2008-12-22T12:51:00.002+01:00</published><updated>2009-01-28T11:55:14.232+01:00</updated><title type='text'>Calibration of the Read/Write motors</title><content type='html'>&lt;span style="font-weight: bold;"&gt;Experiment: Moving the write claw by tacho.&lt;br /&gt;&lt;/span&gt;Duration of activity: 4hrs&lt;br /&gt;Group members participating: Mikkel, Martin, Anders, Sean&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Goal&lt;br /&gt;&lt;/span&gt;Calibrating the claw to move exactly enough to shift a Lego bit block from one side of a cell to the other.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Plan&lt;br /&gt;&lt;/span&gt;Using the tacho counter we plan to move the engine controlling the write claw by different amounts, to simply establish how many tics on the tacho counter it takes to move the claw from one side of the track to the other, without "grinding" the engine or knocking over the lego block and without leaving the lego block halfway across the track.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Results&lt;/span&gt;&lt;br /&gt;To adjust the motion of the arm, we contructed an experimental test program which allowed us to set the movement amount by bluetooth connection.&lt;br /&gt;&lt;specifics about="" the="" program="" go="" here=""&gt;We tried a number of different values and, using a basic binary search approach, eventually homed in on a set amount b&lt;/specifics&gt;&lt;specifics about="" the="" program="" go="" here=""&gt;y which to rotate the engine controlling the arm.&lt;br /&gt;Mechanically, the write arm is heavily geared down, which means that it moves quite slowly in relation to the engine and offers greater accuracy. It is therefore quite feasible to control it by &lt;/specifics&gt;engine &lt;specifics about="" the="" program="" go="" here=""&gt;tacho count. Due to the low gearing, the arm does not move significantly out of alignment during program execution, and inital tacho values can be relied on throughout.&lt;br /&gt;&lt;br /&gt;However, once we had found a suitable tacho offset, we found that even though the arm moved exactly the width of the track, it would occasionally knock over the bit blocks, rendering the "tape" unread&lt;/specifics&gt;&lt;specifics about="" the="" program="" go="" here=""&gt;able.&lt;br /&gt;&lt;br /&gt;Furthermore, in using the bluetooth con&lt;/specifics&gt;&lt;specifics about="" the="" program="" go="" here=""&gt;nection to transfer orders to the experimental program, we found that the way the robot received orders from the PC was prone to "dropping" messages if it was already working on a previous order at the time of transmission.&lt;br /&gt;&lt;/specifics&gt;This basic problem of distributed systems we had simply had not anticipated initially.&lt;br /&gt;&lt;specifics about="" the="" program="" go="" here=""&gt;We are planning to handle it by letting the NXT send a "ready" signal to the PC when it is done executing an order. This way, the PC won't send messages to the NXT when it is not ready to receive them.&lt;/specifics&gt;&lt;br /&gt;&lt;specifics about="" the="" program="" go="" here=""&gt;&lt;br /&gt;&lt;/specifics&gt;&lt;span style="font-weight: bold;"&gt;Experiment: Improving the claw mechanically&lt;/span&gt;&lt;br /&gt;Duration of activity: 2-3hrs&lt;br /&gt;Group members participating: Mikkel, Martin, Anders, Sean&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Goal&lt;/span&gt;&lt;br /&gt;The mechanical implementation of the claw causes faults when writing; bits fall over and become unreadable when switching the claw from one side of the track to the other. The goal of this excersize is to modify the design of the write claw to avoid this.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Plan&lt;br /&gt;&lt;/span&gt;Examining the claw, it appears that one cause of the problem is&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;that the horisontal alignment of the claw is somewhat unstable. It is clear that the instability is caused by the way the claw rests on the rotating worm gear. Since they are connected by a single, small gear, and stabilized by no other factor, the claw has a tendency to wobble, which causes the fault. The plan is, then, to redesign the claw with this in mind, giving it a wider area of contact with the worm gear. The diagram below illustrates the basic idea.&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_Xk9ZXFslxfE/SXx73YcZkUI/AAAAAAAAAAc/NlgcOzLWSLs/s1600-h/claw01.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://1.bp.blogspot.com/_Xk9ZXFslxfE/SXx73YcZkUI/AAAAAAAAAAc/NlgcOzLWSLs/s400/claw01.png" alt="" id="BLOGGER_PHOTO_ID_5295243453265449282" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;Additionally, the original claw is built of slightly rounded parts, which means that the area which presses against the side of the bit blocks is smaller. This in turn means that the force applied to the bits is applied further up. Since the bottom of the brick scrapes against the surface below, the bricks are more prone to "trip" the further up the force is applied. The claw must therefore also be modified to have a larger area of contact with the bits, as shown in the diagrams below.&lt;br /&gt;&lt;br /&gt;&lt;div style="text-align: center;"&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xk9ZXFslxfE/SXyEcRKqnWI/AAAAAAAAAA0/voAWHsG-BCA/s1600-h/claw02.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://2.bp.blogspot.com/_Xk9ZXFslxfE/SXyEcRKqnWI/AAAAAAAAAA0/voAWHsG-BCA/s400/claw02.png" alt="" id="BLOGGER_PHOTO_ID_5295252883060202850" border="0" /&gt;&lt;/a&gt;Previous claw design&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xk9ZXFslxfE/SXyEOr2vJBI/AAAAAAAAAAs/q_5jXxss3RA/s1600-h/claw03.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://4.bp.blogspot.com/_Xk9ZXFslxfE/SXyEOr2vJBI/AAAAAAAAAAs/q_5jXxss3RA/s400/claw03.png" alt="" id="BLOGGER_PHOTO_ID_5295252649706202130" border="0" /&gt;&lt;/a&gt;New design&lt;br /&gt;&lt;/div&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xk9ZXFslxfE/SXyEOr2vJBI/AAAAAAAAAAs/q_5jXxss3RA/s1600-h/claw03.png"&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;span style="font-weight: bold;"&gt;Result&lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;span&gt;Modifying the claw in this fashion proved quite difficult, from a mechanical point of view. Since the claw needs its full range of&lt;/span&gt;&lt;span&gt; motion across the track, there is little room to add stabilizing structure around it.&lt;br /&gt;In the end, we settled on a design which places a gear rack (as pictured above to the right) against the &lt;span style="font-style: italic;"&gt;front&lt;/span&gt; of the worm gear, where it wouldn't interfere with the motion of the claw.&lt;br /&gt;Also, the contact area was increased by replacing the rounded lego parts with standard flat blocks.&lt;br /&gt;&lt;br /&gt;With these improvements, the machine no longer tips over bits as it did before. If stopped in an improper configuration and then moved across the tape, it is still possible for the TM to knock over bits. In a standard execution, though, it is no longer an issue.&lt;br /&gt;The instabilities are now no longer noticeable, and the increased bit contact area has had an obvious effect on the stability of the bit blocks.&lt;br /&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-6915963236737865697?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/6915963236737865697/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=6915963236737865697' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/6915963236737865697'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/6915963236737865697'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/12/calibration-of-readwrite-motors.html' title='Calibration of the Read/Write motors'/><author><name>Sean Geggie</name><uri>http://www.blogger.com/profile/00618586289925398694</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://1.bp.blogspot.com/_Xk9ZXFslxfE/SXx73YcZkUI/AAAAAAAAAAc/NlgcOzLWSLs/s72-c/claw01.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-975236128889855400</id><published>2008-12-21T15:10:00.002+01:00</published><updated>2009-01-28T15:11:54.921+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='design patterns'/><category scheme='http://www.blogger.com/atom/ns#' term='software architecture'/><category scheme='http://www.blogger.com/atom/ns#' term='Turing Machine'/><category scheme='http://www.blogger.com/atom/ns#' term='GUI'/><category scheme='http://www.blogger.com/atom/ns#' term='Bluetooth'/><title type='text'>Software Architecture of the Turing Machine</title><content type='html'>Duration of activity: discussion across several days&lt;br /&gt;Group members participating: Mikkel, Martin, Anders, Sean&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Goal:&lt;/span&gt; Achieving a flexible and modular software architecture for the Turing Machine system.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Plan:&lt;/span&gt; We are planning on utilizing acknowledged techniques from the area of object oriented software architecture to make the system modular and extensible. Specifically we'll use design patterns to make an abstraction of the Turing Machine and having the implementations hereof deal with the details.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Results:&lt;/span&gt; Our initial idea was to make a completely abstract Turing Machine that only had functionality for the primitive operations such as reading and writing cells and moving the head. Other concrete implementations would then have the responsibility of implementing the corresponding functionality for the primitive operations (ie. the &lt;a href="http://en.wikipedia.org/wiki/Template_method_pattern"&gt;Template Method pattern&lt;/a&gt;). Thus it would be easy to make different implementations, eg. one running on computer and one running on the NXT robot. This allows for easy debugging and less error prone code for the concrete implementations.&lt;br /&gt;&lt;br /&gt;The object structure and relationships that we decided to use is illustrated in the &lt;a href="http://www.uml.org/"&gt;UML&lt;/a&gt; diagram below:&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8SmnTJOwyno/SX2HjseZztI/AAAAAAAAACc/hkXT5v1CRj8/s1600-h/turingmachine2.png"&gt;&lt;img style="cursor: pointer; width: 400px; height: 139px;" src="http://3.bp.blogspot.com/_8SmnTJOwyno/SX2HjseZztI/AAAAAAAAACc/hkXT5v1CRj8/s400/turingmachine2.png" alt="" id="BLOGGER_PHOTO_ID_5295537784161423058" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;TuringMachine&lt;/tt&gt; is the abstract class defining the interface and structures that is required for the Turing Machine to have sufficient functionality. In our project, we have made two implementing classes; &lt;tt&gt;TuringMachinePC&lt;/tt&gt; and &lt;tt&gt;TuringMachineRobot&lt;/tt&gt; which are the versions operating on computer and NXT, respectively.&lt;br /&gt;&lt;br /&gt;&lt;tt&gt;TuringMachinePC&lt;/tt&gt; handle the operations internally as the data is represented on the computer, and &lt;tt&gt;TuringMachineRobot&lt;/tt&gt; consists primarily of invoking the primitive methods on the robot via Bluetooth messages.&lt;br /&gt;&lt;br /&gt;A central part of the design of the Turing Machine is the transition function that specifies the actual operations performed by the machine given a state and a cell value. This we have represented in the class &lt;tt&gt;TransitionFunction&lt;/tt&gt;. This class has a number of &lt;tt&gt;State&lt;/tt&gt; objects, each symbolizing a state in the automaton that make up the transition function. Additionally, the &lt;tt&gt;State&lt;/tt&gt; object has a number of &lt;tt&gt;Action&lt;/tt&gt; objects that maps a value to an operation, thus enabling the Turing Machine to query the next operation given a state and a read value.&lt;br /&gt;&lt;br /&gt;In order to get a continuous feedback on the execution of any Turing Machine, we created a listener interface based on the &lt;a href="http://en.wikipedia.org/wiki/Strategy_pattern"&gt;Strategy pattern&lt;/a&gt;. Hooking this listener to a Turing Machine will cause the listener to be invoked after each step in the computation, and provided with data regarding the current configuration. This means that we can setup the listener to update the graphical user interface whenever the Turing Machine operates, no matter whether the implementation runs on the computer or the NXT or elsewhere. We use this information eg. to update the "working tape" of the GUI to reflect the actual working tape of the configuration.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;The architecture proposed has several advantages. First, it allows us to have a very abstract representation of the Turing Machine that only has the bare-bones functionality such as reading, writing and moving the head. Furthermore the chosen architecture allows us to make new concrete implementations of the Turing Machine with minimal effort. Thus this approach satisfies our initial needs for what problems the architecture should help to solve.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-975236128889855400?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/975236128889855400/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=975236128889855400' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/975236128889855400'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/975236128889855400'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2009/01/software-architecture-of-turing-machine.html' title='Software Architecture of the Turing Machine'/><author><name>Anders Nissen</name><uri>http://www.blogger.com/profile/09289108430925099897</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_8SmnTJOwyno/SX2HjseZztI/AAAAAAAAACc/hkXT5v1CRj8/s72-c/turingmachine2.png' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-8628982694650233013</id><published>2008-12-14T11:09:00.001+01:00</published><updated>2009-01-28T12:05:58.253+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='tape'/><category scheme='http://www.blogger.com/atom/ns#' term='Turing Machine'/><title type='text'>Tape conventions</title><content type='html'>Duration of activity: 1.5hrs&lt;br /&gt;Group members participating: Mikkel, Martin, Anders, Sean&lt;br /&gt;&lt;span&gt;&lt;span style="font-weight: bold;"&gt;Goal: &lt;/span&gt;Establishing general conventions about the tape&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;Problem: &lt;/span&gt;How are bit-patterns represented on the tape?&lt;br /&gt;&lt;br /&gt;In our first test implementations, we experienced a lot of confusion with the order of bits. Early on, we agreed that "right" and "left" on the tape are determined from the point of view of a person reading the display on the NXT, i.e. from the side of the track that does not have the black cell markers which are used for navigation.&lt;br /&gt;In our early tests, we had the least significant bit to the left, in defiance of convention.&lt;br /&gt;We soon found this to be both problematic and confusing, and opted to follow convention instead. This meant rethinking some of the calculations we make to move the robot around the track. See the below for particulars.&lt;br /&gt;&lt;br /&gt;Finally, the following diagram illustrates the conventions that we have (somewhat arbitrarily) chosen for the TM and its tape.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://4.bp.blogspot.com/_Xk9ZXFslxfE/ST0AP2ZhH_I/AAAAAAAAAAM/_fwuKYmGlCc/s1600-h/Turing01.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 400px; height: 124px;" src="http://4.bp.blogspot.com/_Xk9ZXFslxfE/ST0AP2ZhH_I/AAAAAAAAAAM/_fwuKYmGlCc/s400/Turing01.png" alt="" id="BLOGGER_PHOTO_ID_5277374610648670194" border="0" /&gt;&lt;/a&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://2.bp.blogspot.com/_Xk9ZXFslxfE/ST0FIDUqTOI/AAAAAAAAAAU/8r3BsaEqKkg/s1600-h/Turing02.png"&gt;&lt;img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer; width: 283px; height: 194px;" src="http://2.bp.blogspot.com/_Xk9ZXFslxfE/ST0FIDUqTOI/AAAAAAAAAAU/8r3BsaEqKkg/s400/Turing02.png" alt="" id="BLOGGER_PHOTO_ID_5277379974237146338" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Problem&lt;/span&gt;: The robot's read arm and write claw are not centered over the same cell. Which sensor rests over the active cell at what times and how do we maneuver back and forth to read/write the correct bit?&lt;br /&gt;&lt;br /&gt;The calculations used to solve this problem arose from a thorough study and contemplation of the track layout. In other words, we simply counted cells.&lt;br /&gt;Recall that the track is divided into cells, and that each cell is identified by the light sensor by the presence of a black marker on the marker track at the side of the tape. Moving away from one cell to one side or the other is therefore a transition in light value from black to white. Moving from one cell to the next is therefore two transitions, one from black to white and one from white to black.&lt;br /&gt;&lt;br /&gt;The first observation (or design decision, if you will) that we made was that the write claw is five transitions away from the read arm.&lt;br /&gt;The second was that for a cell size &lt;span style="font-style: italic;"&gt;n&lt;/span&gt;, that is, when the number of bits that comprise a symbol on the tape is &lt;span style="font-style: italic;"&gt;n&lt;/span&gt;, the robot has to move (&lt;span style="font-style: italic;"&gt;n&lt;/span&gt; - 1) * 2 transitions on the guide markers to move the reader or the writer from the least significant bit to the most (and vice versa).&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-8628982694650233013?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/8628982694650233013/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=8628982694650233013' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/8628982694650233013'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/8628982694650233013'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/12/tape-conventions.html' title='Tape conventions'/><author><name>Sean Geggie</name><uri>http://www.blogger.com/profile/00618586289925398694</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/_Xk9ZXFslxfE/ST0AP2ZhH_I/AAAAAAAAAAM/_fwuKYmGlCc/s72-c/Turing01.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-2841556382682481838</id><published>2008-12-07T16:40:00.007+01:00</published><updated>2009-01-28T16:12:33.048+01:00</updated><title type='text'>Constructing the Turing Machine</title><content type='html'>The design of the robot is the product of several iterations. At first we wrote down what requirements we had for the robot. We needed a tape with an available alphabet. We also needed that the robot could move on the tape, read from it and manipulate it.&lt;br /&gt;&lt;br /&gt;To make a rigid tape we used the old LEGO train tracks for the tape. This meant that the robot was able to move forward and backwards without us worrying about the robot moving out of alignment and reading the bits wrong. Our first idea was to build the robot from a LEGO train and then have the bits positioned next to the train. We would have like to have tape underneath the reading head, however that was not possible in this approach. So here our problem was that we had no idea how to read and manipulate the tape.&lt;br /&gt;The next idea was to use a mechanism that used bits in the form of bricks and placing these in a booth or removing them. The idea looked like a too big project and instead we considered making a tape with statically placed bits on the track where each bit would represent 0 in one "left-most" position, and 1 in the "right-most". Thus all the available bricks are on the track initially and we only need to move between the 0 and 1 position. This way we couldn't make the tape longer over time, but in the old model there was still a maximum amount of bricks to move. Now we had a much simpler mechanism to build that should only move a brick from one position to another. This approach also meant that we had to have '0' represent the empty cell, and this therefore decreasing the data the bits in the cell could represent by one value.&lt;br /&gt;Next problem was the reader. We decided to use s stack of 2x2 bricks to represent bits, and move them to each side of the train tracks. We tried to use light sensors to read the position of the bit, but tests showed that this approach was highly unreliable and dependent of lighting conditions. Instead we used 2 touch sensors that we would move down on the bits and register which sensor the bit was underneath. This setup required that the tracks was 1 LEGO unit wider to get the sensors to fit by each other. As our train tracks are the 80's 12V tracks, this was an easy adjustment because they consist of single track pieces.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://3.bp.blogspot.com/_OO2Rryo4kMI/SYB0scyD_GI/AAAAAAAAACA/GyrwjJlGRK8/s200/Billede195.jpg" style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 200px; height: 150px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5296361468776938594" /&gt;Now we had simple reading and writing mechanisms and a representation of the tape. These now had to be connected into one robot. As we now had to drive over the bits on the tracks, and it was wider than the original tracks, we couldn't use the original train motors. The first iteration of the robot as shown, is elevated over the bits and is wide enough for the reader but not long enough for both the reader and writer. &lt;br /&gt;&lt;br /&gt;&lt;img src="http://2.bp.blogspot.com/_OO2Rryo4kMI/SYB06IlztII/AAAAAAAAACI/W93WN1GP2sY/s200/oldWriter.jpg" style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 150px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5296361703874999426" /&gt;The biggest problem was the writer. It has to be controlled with a 1 width brick, span over 5 and be able to move 3. The first working writer made us rebuilt the base of the robot, but now we could built a whole robot that could do what we needed.&lt;br /&gt;&lt;br /&gt;We now had to place the mechanisms on the base and also have room for motors them and one for moving. None of these motors should block for the bits while moving, so we had to elevate them and use gears to move. The first motor was the one for moving, simply placed in the one of the ends and going upwards to use as little space as possible. Now the writer was added in the other side, and the motor placed close by also in a standing position. The third motor placed just beside to make it symmetric. Then we made room on the other side of the motors to the reader, and connected it to the other motor. To stabilize the motors we connected them using the NXT and fastened it. Now we had a working Turing Machine, just without code.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Optimizations to the robot&lt;/span&gt;&lt;br /&gt;The robot was built up by modules which made it easy for us to remove a single module, rebuilt it and place it again without disassembling any other part of the robot.&lt;br /&gt;&lt;br /&gt;The first optimization made was to the wheels, they sometimes jumped over ticks on the cogs. We tried a lot of different cog sizes, and tried many methods for keeping them together. We ended up using gear chains, as these made it more stable.&lt;br /&gt;The reader also had problems with gears jumping, mostly due to the fact that there didn't exist gears that fit with the distance we needed. Even gear chains didn't fit here. This was fixed later by using more cogs, and fastening them on both sides. It changed the direction the motor had to move, but fortunately this could be fixed by negating a constant in our program.&lt;br /&gt;&lt;br /&gt;&lt;img src="http://3.bp.blogspot.com/_OO2Rryo4kMI/SYB06BmEJ0I/AAAAAAAAACQ/SeU27FgpOdU/s200/newWriter.jpg" style="float:left; margin:0 10px 10px 0;cursor:pointer; cursor:hand;width: 200px; height: 150px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5296361701997029186" /&gt;The writer was our biggest problem. It used to tip over bits when moving them and didn't always move back to the start position, making it move in to the other bits while moving, causing it to stop or pushing bits in to some of the other bits' room.&lt;br /&gt;The optimized writer used a gear rack to stabilize it and used old "LEGO Technic" parts to make it longer, thus pushing with a larger area. It was also constructed using bars, so we could adjust the distance between the arms more precisely.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;References:&lt;/span&gt;&lt;br /&gt;&lt;a href="http://en.wikipedia.org/wiki/Turing_machine"&gt;Turing Machine on Wikipedia&lt;/a&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Build Guide:&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://www.daimi.au.dk/~vester/turing.lxf"&gt;Newest design&lt;/a&gt;&lt;/div&gt;&lt;div&gt;For use in LEGO Designer&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-2841556382682481838?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/2841556382682481838/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=2841556382682481838' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/2841556382682481838'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/2841556382682481838'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/12/noter-omkring-konstruktionen-af.html' title='Constructing the Turing Machine'/><author><name>Anders Nissen</name><uri>http://www.blogger.com/profile/09289108430925099897</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_OO2Rryo4kMI/SYB0scyD_GI/AAAAAAAAACA/GyrwjJlGRK8/s72-c/Billede195.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-7613600693626760618</id><published>2008-12-01T13:31:00.020+01:00</published><updated>2009-01-28T12:07:53.412+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='design'/><category scheme='http://www.blogger.com/atom/ns#' term='architecture'/><category scheme='http://www.blogger.com/atom/ns#' term='Turing Machine'/><title type='text'>Turing Machine Architecture</title><content type='html'>&lt;span style="font-style: italic;"&gt;This post describes the general discussions we have regarding the architecture of the Turing Machine robot.&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Participants: Anders, Martin, Mikkel and Sean&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Topics of discussion regarding the architecture of the Turing Machine.&lt;br /&gt;In this log entry four central problems are presented along with the gist of our discussions on the topics and, in some cases, suggestions for solutions or concrete implementations.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Blank input symbols&lt;/span&gt;.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Problem: &lt;/span&gt;A Turing machine has an input alphabet and a blank symbol in its tape alphabet. Our Lego tape can only hold two different symbols (represented by shifting a Lego block to the right and left sides of the containing bit field). We cannot currently represent a blank symbol with a Lego brick.&lt;br /&gt;&lt;br /&gt;One solution would be letting more than one Lego bit blocks represent a single character in the input alphabet. With two bits we have four possible symbols, or three input alphabet symbols and a blank symbol. We plan to use a binary input alphabet, which leaves us with an "extra" bit configuration if we use the idea of two bits per symbol. Using more bits would enable us to represent decimal numbers or even alphabetical A-Z symbols.&lt;br /&gt;We will need a couple of methods to handle bits. When reading an input character that stretches across several bits, we will be reading the bits one at a time, and we will need a method that takes this stream of bits and converts it to a symbol in the input alphabet.&lt;br /&gt;When writing, we will need to reverse the process, converting a symbol in the input alphabet to a stream of bits.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Reading, sending.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;Problem: &lt;/span&gt;We plan to distribute the complete functionality of the Turing Machine across a PC and the NXT via Bluetooth connection. At which end does computation take place, who waits for signals and when?&lt;br /&gt;&lt;br /&gt;The initial idea for control-flow went as follows:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Write initial tape configuration to the tape&lt;/li&gt;&lt;li&gt;Read the initial state&lt;/li&gt;&lt;li&gt;Send value to PC&lt;/li&gt;&lt;li&gt;React to answer (from PC)&lt;/li&gt;&lt;li&gt;Repeat steps 3-4 until a halting (accept or reject) state is entered&lt;/li&gt;&lt;/ol&gt;The NXT idles while waiting for a movement signal from the PC. When this is received, the PC waits for a confirmation signal from the NXT while it maneuvers the robot into position over a cell/bit, reads it and sends its contents.&lt;br /&gt;In this model, the PC performs the Turing Machine computations and simply sends movement, read and write calls to the robot.&lt;br /&gt;&lt;br /&gt;The PC could also take a hands-off approach, and simply starts the Machine by sending the transition function to the robot which performs all calculations and movements independently on the NXT.&lt;br /&gt;&lt;br /&gt;Due to the limitations that the NXT imposes on java code, we have found that keeping a lot of the calculations on the PC might be easier to implement.&lt;br /&gt;More specifically, it appears that maps aren't supported. Our implementation of the transition function uses two maps, one for states and one for input symbols. We find this to be the most intuitive and natural way of representing the transition table.&lt;br /&gt;&lt;br /&gt;Converting bits to integers is simply a case of adding 2^i to the result for the i'th bit if it is 1.&lt;br /&gt;Converting integers to bits is a question of taking the remainder of a division by 2 and the dividing the input by 2, rounding down, until the input is 0.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;How are states represented?&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;Convention: &lt;/span&gt;What Turing called &lt;span style="font-style: italic;"&gt;m-configurations&lt;/span&gt;, that is, the part of the Turing Machine that tells it what to do depending on the current input symbol, we have decided to call &lt;span style="font-style: italic;"&gt;states&lt;/span&gt;, to avoid confusion.&lt;br /&gt;Turing's original &lt;span style="font-style: italic;"&gt;state&lt;/span&gt; concept has not been renamed, to increase confusion.&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Concrete implementation: &lt;/span&gt;States are currently represented in the code as a map from input symbol to &lt;span style="font-style: italic;"&gt;Action&lt;/span&gt; tuples, an &lt;span style="font-style: italic;"&gt;Action&lt;/span&gt; tuple being a three-tuple of actions to perform on the given input: what to write, which way to shift and which state to enter next.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Initial state in input file?&lt;/span&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Problem:&lt;/span&gt; We want to be able to give the transition function of the Turing Machine as input, but how do we know which state is the initial state and which states are final?&lt;br /&gt;&lt;br /&gt;One solution to the first problem is simply  to demand that the first state in the input always be the initial state.&lt;br /&gt;The final, or halting state doesn't need a separate state in the input. Rather, we allow states to point to a next-state "HALT" which doesn't exists in the input. This we are able to do since we know that no actions can be taken once a halt state has been entered, and so we do not need to keep track of the information pertaining to the actions in the halt state.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-7613600693626760618?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/7613600693626760618/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=7613600693626760618' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/7613600693626760618'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/7613600693626760618'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/12/turing-machine-architecture.html' title='Turing Machine Architecture'/><author><name>Sean Geggie</name><uri>http://www.blogger.com/profile/00618586289925398694</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-6193615428071935370</id><published>2008-11-27T14:21:00.011+01:00</published><updated>2008-12-08T11:15:23.343+01:00</updated><title type='text'>Week 12 - End course projects</title><content type='html'>The purpose of this lab session is to discuss various candidates for our final End Course Project. For each suggestion we will discuss what sort of architecture would be used and what problems might be involved.&lt;br /&gt;Here is a list of brief idea descriptions:&lt;br /&gt;&lt;ol&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Synthetic creatures&lt;/span&gt;. Robot or robots trying to mimick simple insect-like behavoir.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Balancing "butler" robot&lt;/span&gt;. A robot which is able to drive across rough terrain while keeping a part of itself perfectly level. The purpose would be to carry a drink without spilling.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Room Mapper&lt;/span&gt;. A robot that maps the boundaries of a room by way of (for instance) the ultrasonic range sensor and a steady form of motion.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Turing Machine.&lt;/span&gt; A lego robot which emulates the action of a Turing Machine on a finite tape made up of Lego train tracks.&lt;/li&gt;&lt;/ol&gt;The "&lt;span style="font-weight: bold;"&gt;Synthetic creatures&lt;/span&gt;" robots would be an exercise in trying to build robots that act like primitive insects-like creatures. This project would include modelling simple behavior for searching for food, avoiding obsticles and dangers, sleeping etc.. It would be based largely on the ideas for insect-like robots presented in the lectures and articles on behavior by Thiemo Krink.&lt;br /&gt;Further development could include adding more robots and creating a reasonable interaction between them. They could, for instance, inform others of found food, dangers etc. and have boids-like behaviors that makes them flock and move together.&lt;br /&gt;&lt;br /&gt;The "&lt;span style="font-weight: bold;"&gt;Butler&lt;/span&gt;" robot would be largely an excercise in balancing, much like the balancing robot discussed in the course. The main problem is that it is no longer possible to gauge balance by looking at the distance to the ground, since the robot will be traveling over rough ground. Thus a new sensor type would most likely need to be incorporated (acceleration, gyroscopic).&lt;br /&gt;Lots of parameter-tweaking is probably to be expected.&lt;br /&gt;Presentation of this robot would obviously be to have it drive up with an open Coca Cola and present it to, for instance, the lecturer of the course.&lt;br /&gt;&lt;br /&gt;The "&lt;span style="font-weight: bold;"&gt;Room Mapper&lt;/span&gt;" would use the distance sensor to gauge distances to its surroundings. It would drive around a room, hopefully completing a closed circuit while measuring distances at each point. Finally, the data it captures could be used to reconstruct the room for whatever purpose. One example might be allowing a lego robot to traverse the room more efficiently, for instance, as discussed in the example project page. Active elements might be added to make waypoints for this bot.&lt;br /&gt;Problems involved include keeping accurate track of the robot's position in the room. To mitigate this, a more precise control method would have to be implemented. The robot might only be able to make turns "on the spot", for instanced, using other methods than the wheels, to avoid changing position and direction at the same time.&lt;br /&gt;Inaccuracies on the distance sensor would also have to be taken into account.&lt;br /&gt;Finally, the algorithm that compiles the data to a model of the room could prove tricky to implement.&lt;br /&gt;Demonstration of the Room Mapper might be accomplished by constructing a small "room", using cardboard obstacles and simple NXTs as active elements or similar. The room mapper would map the room and would then either display the computed map somehow (by bluetooth transmission to a PC) or it would demonstrate that a traversal of the room could be computed from the data it had gathered.&lt;br /&gt;&lt;br /&gt;The "&lt;span style="font-weight: bold;"&gt;Turing Machine&lt;/span&gt;" will need to traverse a track of some kind, reading marks on the track and altering them.&lt;br /&gt;Reading and altering bits on a track entails three things: Detecting that the machine is over a cell, detecting the state of the cell and altering the state of the cell. These three problems will each be solved by careful application of various sensors. Many solutions exist for each problem and much experimentation will be needed to find out which yields the most stable results.&lt;br /&gt;Architecturally speaking, the Turing Machine robot could be in contact with a PC via bluetooth connection. Via this connection, the robot could leave some calculations to the PC which would send back instructions. One example of this could be that the PC handles all the "boring" Turing Machine calculations while the robot itself could be in charge only of cell and bit state detection as well as motor control.&lt;br /&gt;The main part of this project would be getting the robot to accurately read and set the bits on the track. The implementation of the turing machine itself is trivially accomplished. The "meat" of the project is embedding the program in a machine that actually performs computations in a physical environment.&lt;br /&gt;&lt;br /&gt;Having discussed the above options for end course project, we have decided to build the &lt;span style="font-weight: bold;"&gt;Turing Machine&lt;/span&gt; as our end course project. This project seems both feasible and interesting: Feasible, since it requires no "exotic" sensors, all detection can be accomplished by either light or touch sensor, and interesting, because the Turing Machine is such an iconic part of Computer Science. Building a Turing Machine in Lego would make Lego Turing Complete, which is an interesting consequence in itself.&lt;br /&gt;Furthermore we anticipate that working with the robot and making it precisely manipulate the "tape" will prove challenging enough to give us a lot of material for discussion in project logs.&lt;br /&gt;Depending on how we implement the tape (and thus, the length of the tape available) we will be able to have our robot perform all sorts of simple calculations, from palindrome to "busy beavers".&lt;br /&gt;&lt;br /&gt;The other projects we have discussed each had shortcomings in relation to the Turing Machine project.&lt;br /&gt;The "Synthetic Creatures" is an interesting idea and would be fun to implement, but the most interesting aspect - the group interaction - seems very troublesome to implement so that it works in pratice, especially the boids behavior. Besides which, we feel that this idea has already been covered in previous years, and we'd like to make a more "unusual" project.&lt;br /&gt;The "Butler" hinges too much on the availability of special sensors to measure balance.&lt;br /&gt;The "Room mapper" presents too many technical difficulties in precisely tracking robot position, we might end up with hitting a limit on precision due to either robot motion or sensor accuracy.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-6193615428071935370?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/6193615428071935370/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=6193615428071935370' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/6193615428071935370'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/6193615428071935370'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/11/week-12-end-course-projects.html' title='Week 12 - End course projects'/><author><name>Sean Geggie</name><uri>http://www.blogger.com/profile/00618586289925398694</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-2192879404150452124</id><published>2008-11-20T15:43:00.016+01:00</published><updated>2008-11-26T14:42:28.017+01:00</updated><title type='text'>Week 11 - Behavior</title><content type='html'>Date: November 21&lt;br /&gt;Duration of activity: 2 hours&lt;br /&gt;Group members participating: Anders, Mikkel, Martin, Sean&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Goal&lt;/span&gt;: To examine, analyze and discuss the details of the example "BumperCar" project that utilize the leJOS subsumption API to implement a behavior-based control architecture.&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Results: &lt;/span&gt;&lt;span&gt;We will now answer the questions that relates to the inner workings of the example project.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Press the touch sensor and keep it pressed. What happends ? Explain.&lt;/span&gt;&lt;span style="font-style: italic;"&gt;&lt;br /&gt;Most likely the car will never try to drive forwards, but will continue to back up, since HitWall will always return true on TakeControl() and has the highest  priority besides.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Both DriveForward and HitWall have a method takeControl that are called in the Arbitrator. Investigate the source code for the &lt;/span&gt;&lt;t style="font-weight: bold;"&gt;Arbitrator&lt;/t&gt;&lt;span style="font-weight: bold;"&gt;  and figure out if takeControl of DriveForward is called when HitWall is active.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;Yes, takeControl() is called from Monitor. However, even though DriveForward is the only behavior requesting control it isn't granted control because HitWall is still active and has higher priority. As soon as HitWall is finished, DriveForward will be granted control.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Implement a third behavior, &lt;/span&gt;&lt;t style="font-weight: bold;"&gt;Exit&lt;/t&gt;&lt;span style="font-weight: bold;"&gt;. This behavior should react to the ESCAPE button and call &lt;/span&gt;&lt;t style="font-weight: bold;"&gt;System.Exit(0)&lt;/t&gt;&lt;span style="font-weight: bold;"&gt; if ESCAPE is pressed. &lt;/span&gt;&lt;t style="font-weight: bold;"&gt;Exit&lt;/t&gt;&lt;span style="font-weight: bold;"&gt; should be the highest priority behavior.  Try to press ESCAPE when &lt;/span&gt;&lt;t style="font-weight: bold;"&gt;HitWall&lt;/t&gt;&lt;span style="font-weight: bold;"&gt; is active  (hint: set the back up time to 10 sec to be sure &lt;/span&gt;&lt;t style="font-weight: bold;"&gt;HitWall&lt;/t&gt;&lt;span style="font-weight: bold;"&gt; is active when ESCAPE is pressed). The &lt;/span&gt;&lt;t style="font-weight: bold;"&gt;Exit&lt;/t&gt;&lt;span style="font-weight: bold;"&gt; behavior is not activated immediately. Why (hint: look in the &lt;/span&gt;&lt;t style="font-weight: bold;"&gt;Arbitrator&lt;/t&gt;&lt;span style="font-weight: bold;"&gt;) ? Can it happend that HitWall continues controlling the motors even after the suppress method has been called from the &lt;/span&gt;&lt;t style="font-weight: bold;"&gt;Arbitrator &lt;/t&gt;(hint: the answer is yes, explain) ?&lt;br /&gt;&lt;span style="font-style: italic;"&gt;The while-loop in the start() method waits for the last call to action() to complete before calling the next action() method, regardless of whether the last behavior was suppressed or not.&lt;/span&gt; &lt;span style="font-style: italic;"&gt;The action call of HitWall contains a call that sleeps the thread for one second, so before HitWall is done executing chances are that the Exit bottom is unpressed and thus Exit does now not request control.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Implement a fourth behavior PlaySound that react to the ENTER button and play a sound when the ENTER button is pressed. Insert an instance of this behavior in the Behavior array between the instances of Drive Forward and HitWall. Now Drive Forward has the lowest priority, PlaySound is next, then comes HitWall and Exit has the highest priority. Activate HitWall by a touch sensor press. While HitWall is active press ENTER and then ESCAPE. What happens  ? Explain.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-style: italic;"&gt;PlaySound is given high priority by the Monitor when Enter is pressed. It does not, however, interrupt HitWall, since it has lower pirority. If Escape is pressed before the Monitor has a chance to reassign priority (giving it to DriveForward if both keys and the sensors are unpressed)&lt;/span&gt;&lt;span style="font-style: italic;"&gt; and while HitWall is still running its action() it will interrupt PlaySound but not HitWall.&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-2192879404150452124?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/2192879404150452124/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=2192879404150452124' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/2192879404150452124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/2192879404150452124'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/11/week-11-behavior-kladde.html' title='Week 11 - Behavior'/><author><name>Sean Geggie</name><uri>http://www.blogger.com/profile/00618586289925398694</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-6087837640791326717</id><published>2008-11-17T11:12:00.012+01:00</published><updated>2008-11-21T09:52:29.606+01:00</updated><title type='text'>Week 10 - Navigator</title><content type='html'>Date: November 15&lt;br /&gt;Duration of activity: 2 hours&lt;br /&gt;Group members participating: Anders, Mikkel, Martin, Sean&lt;br /&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Goal&lt;/span&gt;: To create a Lego car from the instructions in Brian Bagnalls &lt;span style="font-style: italic;"&gt;Maximum Lego NXTBuilding Robots with Java Brains&lt;/span&gt;,  Chapter 12, and to implement a navigator/"BlightBot" who can find its way around.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Plan&lt;/span&gt;: We plan to start out by building the LEGO car from the exercise. When this is done, we'll implement the Navigator program and test it according to the test on the lab assignment. Furthermore, we plan to make additional tests to get a feeling on the error in the navigator.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Problems encountered:&lt;/span&gt; We had some minor problems with regard to the construction of the robot. The sketch was quite poor, which meant that we had to guess a couple of times which ended up with parts that could not be assembled&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Experiments &amp;amp; results:&lt;/span&gt; The implementation of the program went quite smoothly. Since we build the robot from the article, we decided to use the parameters mentioned. We revised the "goTo" test by dividing every number by a factor of two, so we could test the robot in our office where the floor space is a bit cramped. The goal of the program was to have the robot return to its initial position after completing the assigned route. Results of the test showed that the robot returned to the start position, and was only off by approximately 1 cm. We did the test multiple times, and the result was the same.&lt;/li&gt;&lt;/ul&gt;          To test if the parameters was set at correct value, we toyed around with the arguments. Trying to tweak the parameters only resolved in a larger error between its starting and ending position.&lt;br /&gt;&lt;br /&gt;  As a last test we decided to test how the robot would manage a longer route that also involved more turns. The route that we devised for the robot to travel was arranged in 10 rows, 10 cm apart. The BlightBot thus had to go 10 cm forward, then right for 1 m., then left for 10 cm., left for 1 m. and so on.&lt;br /&gt;When the robot reach the end of the last row,  it goes back to the starting position. The error is the difference between the start and endpoint. Unfortunately the error was about 20 cm. We tried tweaking the parameters, but to no avail; it only increased the error.&lt;br /&gt;&lt;br /&gt;In conclusion it's pretty clear to see that the TachoNavigator class and the technique of using the tacho counters has its merits, but it also has some disadvantages. On the plus side, it can be used to quite accurately find its way back on simple routes. On the other side, once the route gets a bit complicated or involves too many turns, the acuracy quickly drops. This corresponds quite well with Brian Bagnall experiences with this technique as he noted that "(...) his [the BlighBot's] weekness arises when he rotates".&lt;br /&gt;&lt;br /&gt;Further improvements could involve more tweaking with parameters, or perhaps continously calculating an estimated probability of the robot to arrive within a certain distance from the starting position. Another possibility could involve other auxiliary sensors, for instance in the form of fixed stations where the robot can synchronize its position. This could perhaps even generate some statistics on how the synchronized position corresponds to its believed position and be used to "train" the robot to learn to calibrate for its error.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-6087837640791326717?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/6087837640791326717/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=6087837640791326717' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/6087837640791326717'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/6087837640791326717'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/11/week-10-navigator.html' title='Week 10 - Navigator'/><author><name>Martin Have</name><uri>http://www.blogger.com/profile/07000011516463115777</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-8708277331490923170</id><published>2008-11-07T11:57:00.006+01:00</published><updated>2008-11-09T15:29:14.395+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='subsumption architecture'/><category scheme='http://www.blogger.com/atom/ns#' term='sound sensor'/><category scheme='http://www.blogger.com/atom/ns#' term='behavior'/><category scheme='http://www.blogger.com/atom/ns#' term='LCD'/><title type='text'>Week 8.b - Driving towards light</title><content type='html'>&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;div style="border-width: 0px; margin: 0px; padding: 3px; width: auto; font-family: Georgia,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; text-align: left;"&gt;&lt;b&gt;Date:&lt;/b&gt; November 7&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;div style="border-width: 0px; margin: 0px; padding: 3px; width: auto; font-family: Georgia,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 100%; line-height: normal; text-align: left;"&gt;&lt;b&gt;Duration of activity:&lt;/b&gt; 3 hours&lt;br /&gt;&lt;b&gt;Group members participating:&lt;/b&gt; Anders, Mikkel, Martin, Sean&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Goal:&lt;/span&gt; To implement the SoundCar from Lesson 8 and to add extra behaviors the the model.&lt;br /&gt;&lt;a href="http://www.legolab.daimi.au.dk/DigitalControl.dir/NXT/Lesson8.dir/Lesson.html"&gt;http://www.legolab.daimi.au.dk/DigitalControl.dir/NXT/Lesson8.dir/Lesson.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Plan:&lt;/span&gt; We plan to fetch the available source code, and add extra functionality, "Drive towards light".&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Experiments &amp;amp;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;problems encountered: &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"&gt;In order to implement the extra behavior, we had to spent some time looking at the code. One thing becomes clear. It does not look like a subsumption architecture but rather an inhibit mechanism controlled by a boolean, "Suppressed". &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;&lt;br /&gt;Another thing is, that for every behavior, the constructor takes n arguments, the behaviors to suppress. This could be done more elegantly, ie. a list of behaviors. Since the program is structured this way, it is necessary to modify a lot of existing code, which should be avoided.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Results: &lt;/span&gt;We had to decide where to put the "Drive towards light" behavior in the model. We chose to make it the highest priority and make it suppress the other behaviors.&lt;br /&gt;&lt;br /&gt;On the matter of understanding the LCD output, The LCD write a "1" to the right of the behavior if it is being suppressed and a "0" if not. When the "drives towards light" behavior is running, the display reads 1 on all other behaviors, since the drive behavior has the highest priority.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-8708277331490923170?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/8708277331490923170/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=8708277331490923170' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/8708277331490923170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/8708277331490923170'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/11/week-8b.html' title='Week 8.b - Driving towards light'/><author><name>Martin Have</name><uri>http://www.blogger.com/profile/07000011516463115777</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-5290852091026388492</id><published>2008-11-07T10:43:00.003+01:00</published><updated>2008-11-09T16:13:51.617+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Breitenberg'/><category scheme='http://www.blogger.com/atom/ns#' term='RCX'/><category scheme='http://www.blogger.com/atom/ns#' term='light sensor'/><title type='text'>Week 8.a - Breitenberg robots</title><content type='html'>&lt;b&gt;Date:&lt;/b&gt; October 31&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;div style="border-width: 0px; margin: 0px; padding: 3px; width: auto; font-family: Georgia,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 100%; line-height: normal; text-align: left;"&gt;&lt;b&gt;Duration of activity:&lt;/b&gt; 3 hours&lt;br /&gt;&lt;b&gt;Group members participating:&lt;/b&gt; Anders, Mikkel, Martin, Sean&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Goal:&lt;/span&gt; To implement and test the three types of &lt;a href="http://en.wikipedia.org/wiki/Braitenberg_Vehicles"&gt;Braitenberg robots&lt;/a&gt; and observe how they react to light sources.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Plan:&lt;/span&gt; We plan to implement the Breitenberg robots as explained and detailed at the lectures and in &lt;a href="http://www.cs.brown.edu/people/tld/courses/cs148/02/introduction.html" target="_top"&gt;Introduction to Machina Speculatrix and Braitenberg Vehicles&lt;/a&gt;.&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;We will use the &lt;span style="font-family:courier new;"&gt;Datalogger&lt;/span&gt; class from the Lejos framework to get the light and power settings plotted to a graph. &lt;span class="Apple-style-span"  style="font-family:Georgia;"&gt;The assignment is located here: &lt;a href="http://www.legolab.daimi.au.dk/DigitalControl.dir/NXT/Lesson7.dir/Lesson.html"&gt;legolab.daimi.au.dk/DigitalControl.dir/NXT/Lesson7.dir/Lesson.html&lt;/a&gt; &lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Experiments &amp;amp;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;problems encountered: &lt;/span&gt;&lt;span class="Apple-style-span"&gt;The implementation and testing phase went quite smoothly.&lt;br /&gt;At first, we used both a NXT light sensor and a RCX light sensor (as the other NXT light sensor was used in another robot). This proved a bit troublesome however, as the different readings were hard to compare. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"&gt;To be sure that the readings of the two sensors were matching&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"&gt; we ended up prying out the other NXT light sensor and using that as well.&lt;br /&gt;&lt;br /&gt;To test the different programs, we decided to use two light sources displaced on the floor. &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;Then, for each of the three programs, we started the car from the same starting location. &lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;The results can be seen in the results section.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Results: &lt;span class="Apple-style-span" style="font-weight: normal;"&gt;We have used&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span style=""&gt; a direct linear mapping between the light reading and the power setting of the motors. We have implemented two applications, one which uses a direct mapping between the sensors and actuators, and one that has a cross mapping, meaining that the left sensors input is sent to the right motor and the right sensors input is sent to the left motor.&lt;br /&gt;&lt;br /&gt;The first car drives forward as long as there is sufficient light. The second car tries to get near the light source, and the third, wants to get away from the light. This makes sense in regard to the mapping between light input and motor control.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-5290852091026388492?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/5290852091026388492/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=5290852091026388492' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/5290852091026388492'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/5290852091026388492'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/11/week-8a.html' title='Week 8.a - Breitenberg robots'/><author><name>Martin Have</name><uri>http://www.blogger.com/profile/07000011516463115777</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-6210361809733850747</id><published>2008-10-09T12:00:00.008+02:00</published><updated>2008-11-09T16:41:14.453+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='racer'/><category scheme='http://www.blogger.com/atom/ns#' term='speed'/><category scheme='http://www.blogger.com/atom/ns#' term='speed racer'/><category scheme='http://www.blogger.com/atom/ns#' term='robots'/><category scheme='http://www.blogger.com/atom/ns#' term='race'/><title type='text'>Week 7 - Robot race</title><content type='html'>Lesson 6 - The Robot Race&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Goal&lt;/span&gt;&lt;br /&gt;Our goal this week was to build and program a robot which would "win the race", ie a robot that follows a line as fast as possible. We took this challenge to mean that the robot should be able to follow any given line (black on white background) from one end to the other as closely as possible and in as little time as possible.&lt;div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Plan&lt;/span&gt;&lt;br /&gt;Our hypothesis was that we could accomplish this with a robot design based on a modified version of the standard robot as described in the NXT set manual. That is, a robot with two powered front wheels controlled by independent motors which manoeuvres the track by applying varied torque to each of the powered wheels. We would add a set of front-mounted light sensors to sense the lay of the track.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Experiments, results, revision&lt;/span&gt;&lt;br /&gt;In early experiments with the standard robot chassis, we felt that for a cheap increase in speed we might simply exchange the standard wheels with much larger ones. Results of this modification were largely as expected, save that the reconstruction forced us to lower the unpowered rear wheel to match the height of the new wheels. Speed increase was not overwhelming, but we decided to stick with the larger wheels in future experiments.&lt;br /&gt;&lt;br /&gt;The standard line following car as described in the NXT manual has only one light sensor, which meant that a "bang-bang" mode of control had to be employed. We hoped that adding a second light sensor would enable us to control the car in smoother movements.&lt;br /&gt;Results of the modification were positive: The car now had two light sensors, mounted to take readings on either side of the track. The idea was that the car would be able to detect when it was directly over the track (both sensors reading white) and thereby gain a speed increase on long straight segments.&lt;br /&gt;Further testing, however, showed that this speed increase would send it too far out in relation to the track. The car would end up oscillating back and forth across the track, increasing angle of entry each time, leading to more oscillation. Much like the original bang-bang controller.&lt;br /&gt;In essence, we had simply added a third "bang" for straight segments, still a quite unsophisticated method of control.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Experiment: Adding a third sensor&lt;br /&gt;&lt;/span&gt;To approach a more analogue steering method we had the idea of introducing a third light sensor, set some distance forward of the first two. This light sensor would detect the lay of track ahead of the robot. Through this additional knowledge of upcoming curves and straight segments we would be able to construct a control program that would be more sensitive to changes in the track,  the idea being that we would thereby avoid sending the robot careening out across the edges.&lt;br /&gt;In addition to this change, we would attempt a more state-based control program. We would "remember" the last state and act according to this. With the 3 sensors we now knew on which side of the line we were, even when they all read white. This was accomplished by saving which of the left and right sensor last saw black.&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Final program&lt;/span&gt;&lt;/div&gt;&lt;div&gt;In our final code we had made a class "ColorSensors" which had 3 booleans, each one saying if a colorsensor was black. It also had a boolean for checking if all sensors saw blue. These were updated in every with a call to update(). It also came with its own calibration program, so we could store what was black, white and blue in the light we were in at the moment.&lt;/div&gt;&lt;div&gt;Now, the only thing the main program had to handle was to call update, and else act acording the the following cases:&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Middle sensor black and the two other white&lt;/span&gt;&lt;img src="http://3.bp.blogspot.com/_OO2Rryo4kMI/SRb41VSNGzI/AAAAAAAAAAs/Ow6LLTIRKtg/s400/ahead.jpg" style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 100px; height: 100px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5266670409386629938" /&gt;&lt;br /&gt;This means we are on track, and give it full speed&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Two sensors black&lt;br /&gt;&lt;/span&gt;&lt;img src="http://4.bp.blogspot.com/_OO2Rryo4kMI/SRb41Z8yCYI/AAAAAAAAAA0/w0dOBIB7Ctw/s400/slightLeft.jpg" style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 100px; height: 100px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5266670410638952834" /&gt;We are on a slight curve, and choose to speed down left motor, to turn left. As we only turn slightly means our car doesn't go too far off the line on the other side&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;One side sensor black&lt;img src="http://4.bp.blogspot.com/_OO2Rryo4kMI/SRb41nmBsAI/AAAAAAAAAA8/tLdagt3jfDM/s400/sharp+left.jpg" style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 100px; height: 100px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5266670414301605890" /&gt;&lt;/span&gt;&lt;br /&gt;The curve is shaper thus we have to turn even more&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;All sensors white&lt;br /&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;img src="http://1.bp.blogspot.com/_OO2Rryo4kMI/SRb419TFhTI/AAAAAAAAABE/Db8Cg-ZKGl8/s400/really+sharp+left.jpg" style="float:right; margin:0 0 10px 10px;cursor:pointer; cursor:hand;width: 100px; height: 100px;" border="0" alt="" id="BLOGGER_PHOTO_ID_5266670420127745330" /&gt;Here we act acording to the last sensor which was black.&lt;br /&gt;If the left one was black, we make a sharp turn to the left. Opposite for right.&lt;br /&gt;If the last reading wasn't one of these 2, we slow down. The option could happen at a sharp curve, as our front sensor was further ahead than the two others. In this case we slowed down, as we soon had to do a turn, and thus would be faster reacting when we knew what to do.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;While not entirely analogue, this method has enough different cases that we feel that the robots motions will be adequately smooth, avoiding unnecessary oscillation.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;Results&lt;/span&gt;&lt;br /&gt;Results of this final modification were very positive. When properly calibrated the robot would adjust its speed in accordance with the cases above to take turns with great precision and speed. The calibration was a sticking point, however, as the performance hinged greatly on the threshold values for black and white that had been set for each light sensor. Taking readings, altering code and recompiling soon proved tedious, and we implemented a simple function that would allow us to take readings of black and white values before each execution of the race program.&lt;/div&gt;&lt;div style="background: #eee"&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold; "&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 51, 153); "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;public void&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: bold; "&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; calibrateBlue&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;() {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;NXTBlueThreshold = (&lt;/span&gt;&lt;span class="Apple-style-span" style="color: rgb(153, 51, 153); "&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;)((left.readValue() + right.readValue()) / 2);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;RCXBlueThreshold = middle.readValue();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Sound.playTone(500, 20);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre; "&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;With this system in place we were able to shave out time to about 20 seconds for the entire track.&lt;/div&gt;&lt;div&gt;As far as our original goal was concerned, we had two practical measures of success: The time the robot took to complete the track and the degree to which the robot followed the line. It is difficult to set a hard target for both of these measures, especially since one is usually inversely proportionate to the other. In both aspects, we found our robot adequate to our original goal.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;The results of our robot were satisfactory only in the sense that they met our expectations to the original design strategy. Shaving further seconds off our final time, we feel, can at this point only be accomplished be changing the fundamental workings of our design.&lt;br /&gt;Having observed the results of the other groups participating in the course, such changes might be a speed increase through gearing or the inclusion of differential steering, which would allow for much smoother turns.&lt;br /&gt;Given more time, our immediate strategy would be to redesign the robot to use improved gearing and differential steering, and we did in fact make such an attempt at the eleventh hour of the race. Unexpectedly, we failed to make the deadline and abandoned the project before the robot became fit for competition.&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-6210361809733850747?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/6210361809733850747/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=6210361809733850747' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/6210361809733850747'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/6210361809733850747'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/10/week-7-robot-race.html' title='Week 7 - Robot race'/><author><name>Sean Geggie</name><uri>http://www.blogger.com/profile/00618586289925398694</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_OO2Rryo4kMI/SRb41VSNGzI/AAAAAAAAAAs/Ow6LLTIRKtg/s72-c/ahead.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-8062800098901221675</id><published>2008-09-24T14:09:00.001+02:00</published><updated>2008-11-09T15:19:23.960+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='segway'/><category scheme='http://www.blogger.com/atom/ns#' term='PID'/><category scheme='http://www.blogger.com/atom/ns#' term='balance'/><title type='text'>Week 3.b - Balancing robot</title><content type='html'>&lt;b&gt;Date:&lt;/b&gt; September 24&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;div style="border-width: 0px; margin: 0px; padding: 3px; width: auto; font-family: Georgia,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; text-align: left;"&gt;&lt;b&gt;Duration of activity:&lt;/b&gt; 3 hours&lt;br /&gt;&lt;b&gt;Group members participating:&lt;/b&gt; Anders, Mikkel, Martin, Sean&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Goal:&lt;/span&gt; To construct and code a LEGO robot that is capable of balancing upright on two wheels.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Plan:&lt;/span&gt; &lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;At first we'll try finding out how to construct the robot so that it is possible of balancing at some later point.&lt;br /&gt;When the model is completed, we will implement code that will actually allow the robot to balance by reading from a light sensor and utilizing the motor controlled wheels to counter any diversion from the balancing.&lt;br /&gt;We suspect that the primary challenge will consist of tweaking the parameters that control the balancing behavior.&lt;br /&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Results: &lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://www.philohome.com/nxtway/nw12.jpg"&gt;&lt;img style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer; width: 200px;" src="http://www.philohome.com/nxtway/nw12.jpg" alt="" border="0" /&gt;&lt;/a&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;At first, we needed to find out how the robot model was to be con&lt;span style=""&gt;structed. In that respect there are several issues that needs to be considered. The robot should have wheels mounted so that it can be balanced, and it needs to have a light sensor mounted so that it can measure the light reflection from the surface. Furthermore, it needs to have a low center of gravity to be easier to balance.&lt;br /&gt;In the end, we chose to follow the construction guide from &lt;a href="http://www.philohome.com/nxtway/nxtway.htm"&gt;http://www.philohome.com/nxtway/nxtway.htm&lt;/a&gt;, so our robot looks exactly like it. Unfortunately, constructing this robot meant tearing apart our old beloved robot.&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Experiments &amp;amp;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;problems encountered: &lt;/span&gt;After we had implemented the code, inspired by "SeyWay.java", we ran into a lot of problems with the tuning parameters related to the PID controls. We tried tweaking the different parameters, but we did not end up with a robot that could keep its balance appropriately. The best result achieved is when the robot managed to balance for 5 seconds.&lt;br /&gt;We've tried several tweaks to the parameters and in the end simply ran out of time to tweak them further. Our plan, however, was to tweak the value of p until we had a smoothly oscillating motion and then adjust the scale value to make the oscillations as small and slow as possible. Watching the videos on the site linked from the course homepage it seemed that a good strategy would be to have the wheels turn as slowly as possible rather than oscillate wildly across an upright position (which also makes sense given previous discussion in the course).&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/span&gt;&lt;div style="text-align: center;"&gt;&lt;object width="320" height="266" class="BLOG_video_class" id="BLOG_video-3e7eaaf500edb462" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"&gt;&lt;param name="movie" value="http://www.youtube.com/get_player"&gt;&lt;param name="bgcolor" value="#FFFFFF"&gt;&lt;param name="allowfullscreen" value="true"&gt;&lt;param name="flashvars" value="flvurl=http://v21.nonxt6.googlevideo.com/videoplayback?id%3D3e7eaaf500edb462%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1330208191%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D3030FA2A54501BDE53746AFF86B57F5E7261DFB7.1B6E02F9327C4AB69CFDD27215A4887DF44E3E6D%26key%3Dck1&amp;amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3D3e7eaaf500edb462%26offsetms%3D5000%26itag%3Dw160%26sigh%3DTTnrrcbpWO-xiWlJGMeum4qWGVI&amp;amp;autoplay=0&amp;amp;ps=blogger"&gt;&lt;embed src="http://www.youtube.com/get_player" type="application/x-shockwave-flash"width="320" height="266" bgcolor="#FFFFFF"flashvars="flvurl=http://v21.nonxt6.googlevideo.com/videoplayback?id%3D3e7eaaf500edb462%26itag%3D5%26app%3Dblogger%26ip%3D0.0.0.0%26ipbits%3D0%26expire%3D1330208191%26sparams%3Did,itag,ip,ipbits,expire%26signature%3D3030FA2A54501BDE53746AFF86B57F5E7261DFB7.1B6E02F9327C4AB69CFDD27215A4887DF44E3E6D%26key%3Dck1&amp;iurl=http://video.google.com/ThumbnailServer2?app%3Dblogger%26contentid%3D3e7eaaf500edb462%26offsetms%3D5000%26itag%3Dw160%26sigh%3DTTnrrcbpWO-xiWlJGMeum4qWGVI&amp;autoplay=0&amp;ps=blogger"allowFullScreen="true" /&gt;&lt;/object&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-8062800098901221675?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='enclosure' type='video/mp4' href='http://www.blogger.com/video-play.mp4?contentId=3e7eaaf500edb462&amp;type=video%2Fmp4' length='0'/><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/8062800098901221675/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=8062800098901221675' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/8062800098901221675'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/8062800098901221675'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/09/week-3b.html' title='Week 3.b - Balancing robot'/><author><name>Anders Nissen</name><uri>http://www.blogger.com/profile/09289108430925099897</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-186441641595977060</id><published>2008-09-17T14:59:00.001+02:00</published><updated>2008-11-09T15:21:31.204+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='NXT Train'/><category scheme='http://www.blogger.com/atom/ns#' term='sound sensor'/><category scheme='http://www.blogger.com/atom/ns#' term='Low Rider'/><category scheme='http://www.blogger.com/atom/ns#' term='sound'/><title type='text'>Week 3.a - Sound controlled robots</title><content type='html'>&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;div style="border-width: 0px; margin: 0px; padding: 3px; width: auto; font-family: Georgia,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; text-align: left;"&gt;&lt;b&gt;Date:&lt;/b&gt; September 17&lt;br /&gt;&lt;b&gt;Duration of activity:&lt;/b&gt; 3 hours&lt;br /&gt;&lt;b&gt;Group members participating:&lt;/b&gt; Anders, Mikkel, Martin, Sean&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Goal:&lt;/span&gt; To build various different types of sound controlled robots.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Plan:&lt;/span&gt; Add a sound sensor, test it and code two different types of robots responding to sound.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Results: &lt;/span&gt;&lt;span style=""&gt;We've gotten a good understanding of the sound sensor and managed to implement the two programs.&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Experiments &amp;amp;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;problems encountered: &lt;/span&gt;&lt;span class="Apple-style-span" style=""&gt;This&lt;img src="http://2.bp.blogspot.com/_OO2Rryo4kMI/SNeSCGGQ9kI/AAAAAAAAAAc/LAPGGAuFTF8/s200/Billede180.jpg" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" alt="" id="BLOGGER_PHOTO_ID_5248824455417886274" border="0" /&gt; time we did not have that many problems compared to the wall follower.&lt;br /&gt;We started with a simple test program to find out how the sensor reacted to different sounds. We tried to make noises at different volume levels and also to knock on the sensor itself. The result was that the sensor was quite effective a registering the sounds in the surroundings.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;The second assignment was to download the program "SoundCtrCar" and test how the robot would react to sounds. When a sound with a high enough volume has been registered, the car goes forward, waits for another sound, then turns, waits, turns, waits,  and stops.&lt;/li&gt;&lt;/ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Other experiments&lt;/span&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-style: italic;"&gt;Low Rider&lt;/span&gt;: We have tried getting the NXT to play "Low Rider" by War. We have converted an midi with Bricl's Music Studio. The NXT plays sounds, but we can't get it to sound right. We have tried tweeking the wait-time and tone by multiplying them with different values in the funcion call, but haven't found a way where we can recognize the song. We will try harder next week&lt;blockquote&gt;&lt;/blockquote&gt;&lt;/li&gt;&lt;li&gt;NXT Train: This week we have also createt a new connecto&lt;img src="http://1.bp.blogspot.com/_OO2Rryo4kMI/SNeRZITjD6I/AAAAAAAAAAU/pnHG64tqBe4/s200/Billede182.jpg" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer;" alt="" id="BLOGGER_PHOTO_ID_5248823751635832738" border="0" /&gt;r to another actuator, namely the lego 12V train from the 80's. Now we can control the train with power from the NXT, meaning we can control the train forward and backwards in different speeds. This we can maybe use for our project, we just havent testet how much weight the train can handle with sensors and more lego added.&lt;blockquote&gt;&lt;/blockquote&gt;&lt;/li&gt;&lt;li&gt;Improvements on the line follower: Unfinished.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-186441641595977060?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/186441641595977060/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=186441641595977060' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/186441641595977060'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/186441641595977060'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/09/week-3a-beta.html' title='Week 3.a - Sound controlled robots'/><author><name>Anders Nissen</name><uri>http://www.blogger.com/profile/09289108430925099897</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_OO2Rryo4kMI/SNeSCGGQ9kI/AAAAAAAAAAc/LAPGGAuFTF8/s72-c/Billede180.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-5404338451314664968</id><published>2008-09-12T10:57:00.002+02:00</published><updated>2008-11-09T15:22:40.060+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ultrasonic sensor'/><category scheme='http://www.blogger.com/atom/ns#' term='wall follower'/><title type='text'>Week 2.b - Wall following robot</title><content type='html'>&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;div style="border-width: 0px; margin: 0px; padding: 3px; width: auto; font-family: Georgia,serif; font-style: normal; font-variant: normal; font-weight: normal; font-size: 100%; line-height: normal; font-size-adjust: none; font-stretch: normal; text-align: left;"&gt;&lt;b&gt;Date:&lt;/b&gt; September 12&lt;br /&gt;&lt;b&gt;Duration of activity:&lt;/b&gt; 3 hours&lt;br /&gt;&lt;b&gt;Group members participating:&lt;/b&gt; Anders, Mikkel, Martin, Sean&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Goal:&lt;/span&gt; To build and implement a functional wall following robot.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Plan:&lt;/span&gt; Add a ultrasonic sensor the the side of the robot, and program it to detect nearby walls and follow them at a certain distance.&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Results: &lt;/span&gt;&lt;span style=""&gt;We have a functional wall follower,  but it still needs some tweaking.&lt;/span&gt; &lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Experiments &amp;amp;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt; &lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;problems encountered: &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;At first, we tested how the sonic sensor measured distances on different update intervals. It turned out that on close distances sleep intervals of 100ms worked fine with respect to the update speed of the sensor. However, when measuring on longer distances then update speed of the sensor slowed to a point where it were causing problems.&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;br /&gt;At first, we tried mounting the sonic sensor on the side of the robot so that it was orthogonal to the forward direction of the robot. The hope was then to also keep the sensor orthogonal to the wall, and thus allowing the robot to follow along the wall. However, we quickly discovered that when the error (that is; the difference between the measured distance and the desired distance) grew, the turning of the robot would cause further increase of the error, and thus an even steeper turning. In the end the robot could have to misfortune to either crash into the wall or just circling around itself.&lt;br /&gt;Investigating the cause of this behavior we could observe that the distance to the wall obviously increased when we turned either way because of the increased angle with respect to the wall. In order to avoid these unfortunate readings, we tried mounting the sonic sensor at a 45 degree angle from the forward direction of the robot.&lt;br /&gt;Experiments proved that this position eliminated the misleading readings we had before; when the robot turned toward the wall, the distance decreased and when turning away the distance increased. So now, we had a much more stable set of readings to base our (re)actions on.&lt;br /&gt;Now we could tweak the desired distance to wall, the amount the error influences the turning speed, and the amount of error required before we start trying to correct it.&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;Another difficulty we encountered, was that we had a hard time computing the correct error value to be applied to the power of the motors. We tried solving this by simply tweaking the numbers. &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span style="font-weight: bold;"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span" style=""&gt;&lt;span style="font-weight: bold;"&gt;Measurements: &lt;/span&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8SmnTJOwyno/SND5VjludyI/AAAAAAAAAAQ/qu4yOhOl7dI/s1600-h/graph1_uncropped.png"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_8SmnTJOwyno/SND5VjludyI/AAAAAAAAAAQ/qu4yOhOl7dI/s320/graph1_uncropped.png" alt="" id="BLOGGER_PHOTO_ID_5246967714612672290" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span style="font-style: italic;"&gt;Graph 1&lt;/span&gt;: Distance measurements over time.&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://1.bp.blogspot.com/_8SmnTJOwyno/SND5Vj4QNZI/AAAAAAAAAAY/7esYZL1di6c/s1600-h/graph1_cropped.png"&gt;&lt;img style="cursor: pointer;" src="http://1.bp.blogspot.com/_8SmnTJOwyno/SND5Vj4QNZI/AAAAAAAAAAY/7esYZL1di6c/s320/graph1_cropped.png" alt="" id="BLOGGER_PHOTO_ID_5246967714690381202" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span style="font-style: italic;"&gt;Graph 2&lt;/span&gt;: Same as &lt;span style="font-style: italic;"&gt;Graph 1&lt;/span&gt;, but cropped.&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8SmnTJOwyno/SND5V0dJChI/AAAAAAAAAAg/PuSZv6bXp84/s1600-h/graph2_uncropped.png"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_8SmnTJOwyno/SND5V0dJChI/AAAAAAAAAAg/PuSZv6bXp84/s320/graph2_uncropped.png" alt="" id="BLOGGER_PHOTO_ID_5246967719140067858" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span style="font-style: italic;"&gt;Graph 3&lt;/span&gt;: Distance, left power and right power over time.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://3.bp.blogspot.com/_8SmnTJOwyno/SND5WK_I-jI/AAAAAAAAAAo/nKPNIbAcmAw/s1600-h/graph2_cropped.png"&gt;&lt;img style="cursor: pointer;" src="http://3.bp.blogspot.com/_8SmnTJOwyno/SND5WK_I-jI/AAAAAAAAAAo/nKPNIbAcmAw/s320/graph2_cropped.png" alt="" id="BLOGGER_PHOTO_ID_5246967725188250162" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span class="Apple-style-span"  style="font-family:'Times New Roman';"&gt;&lt;span style="font-style: italic;"&gt;Graph 4&lt;/span&gt;: Same as &lt;span style="font-style: italic;"&gt;Graph 3&lt;/span&gt;, but cropped.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;/div&gt;&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-5404338451314664968?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/5404338451314664968/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=5404338451314664968' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/5404338451314664968'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/5404338451314664968'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/09/week-2-linefollower.html' title='Week 2.b - Wall following robot'/><author><name>Martin Have</name><uri>http://www.blogger.com/profile/07000011516463115777</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_8SmnTJOwyno/SND5VjludyI/AAAAAAAAAAQ/qu4yOhOl7dI/s72-c/graph1_uncropped.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-1713623987268503986</id><published>2008-09-11T15:24:00.001+02:00</published><updated>2008-11-09T15:24:23.256+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='line follower'/><category scheme='http://www.blogger.com/atom/ns#' term='light sensor'/><title type='text'>Week 2.a - Improving the line following robot</title><content type='html'>&lt;b&gt;Date:&lt;/b&gt; September 11&lt;br /&gt;&lt;b&gt;Duration of activity:&lt;/b&gt; ? hours&lt;br /&gt;&lt;b&gt;Group members participating:&lt;/b&gt; Anders, Mikkel, Martin, Sean&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Goal:&lt;/span&gt; Getting input from a third light sensor, positioned between the two other light sensors. Then we'll use that input to improve the speed of which the car can correctly finish tracks.&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Plan:&lt;/span&gt; At first we'll refer to the lejos API for documentation on how to use the light sensor (we are using the older version of the light sensor). Once we are able to get sensible input from the sensor, we'll move on to using it for improving the track results. We'll do that by designing an algorithm that takes advantage of the additional knowledge gained from having a light sensor positioned in the middle. We are then going to try out the different approaches&lt;/li&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Results&lt;/span&gt;&lt;/li&gt;&lt;ul&gt;&lt;li&gt;&lt;span style="font-weight: bold;"&gt;Experiments:&lt;/span&gt; After attaching the middle light sensor, we tried an aproach where we move forward if the middle sensor senses black, and if both left &amp;amp; right sensors spots white, we move forward at an increased speed. If the middle sensor senses white, we look at what sensor spots black and what sensor spots white.&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;Problems encountered: &lt;/span&gt;We had a concern about the placement of the middle sensor. We thought it probably was placed to close to the ground in order to pick up the correct raw values. Aside from problems with detection, The sensors proximity to the ground ment it would get stuck on cracks and bumps in the ground. At the end, we got a Linefollower that is better at following lines, that with only two sensors.&lt;/li&gt;&lt;/ul&gt;&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-1713623987268503986?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/1713623987268503986/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=1713623987268503986' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/1713623987268503986'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/1713623987268503986'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/09/week-2-beta.html' title='Week 2.a - Improving the line following robot'/><author><name>Anders Nissen</name><uri>http://www.blogger.com/profile/09289108430925099897</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-706984626399123757</id><published>2008-09-05T10:49:00.001+02:00</published><updated>2008-11-09T15:27:57.867+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='LCD'/><category scheme='http://www.blogger.com/atom/ns#' term='light sensor'/><category scheme='http://www.blogger.com/atom/ns#' term='memory'/><category scheme='http://www.blogger.com/atom/ns#' term='oscilation'/><title type='text'>Week 1.b - Improving the line following robot</title><content type='html'>In an effort to reduce oscilation we have added a second light sensor to the standard car model. The idea is that with one sensor on each side of the black track, the car will know to go forwards when both sensors are over the white background. At first we had the sensors mounted quite close together, meaning that the car would move forward when both sensors were above the track. This proved problematic, however, as the narrowness of the track meant that there was little room for error: The car had to adjust its direction quite often, and the oscillation persisted.&lt;div&gt;Mounting the sensors to the sides of the track meant that we had a few more centimeters of "give".&lt;/div&gt;&lt;div&gt;We still need to make some adjustments to the program. The turn speed in particular needs fine-tuning: we want the car to make small adjustments when turning so we don't tend to oscillate across long straight sections of the track, but it also needs to turn enough that the car doesn't run off the track on sharp corners.&lt;/div&gt;&lt;br /&gt;Finally, we have added a larger wheel type to the car which gives it a significant speed increase, but also a tendency to fall over on sharp corners. Additionally, we need to tweak the parameters for turning around cornes because of the added speed and as the increased wheel-size causes the turning radius to be larger compared to the previous wheels. We still need to adjust the program with these new factors taken into consideration.&lt;br /&gt;&lt;br /&gt;We tried turning off the floodlight function of the light sensor. By measurements, it turned out that it decreased the light sensitivity and made the boundary threshold between black and white smaller, thus not providing an attractive solution when we are trying to stick to the black road. However, if we were trying to use the sensor to detect colors, it might be better to deactivate the floodlight to avoid measuring the reflection of red.&lt;br /&gt;&lt;br /&gt;We modified our code to use &lt;span style="font-style: italic;"&gt;Runtime.getRuntime().freeMemory()&lt;/span&gt;, and to print out the result to the LCD screen. When the text strings are stored as strings, the memory usage was constant when the program was executing. When using strings directly in method calls, however, the free heap memory quickly shrunk in size. This is apparently caused by the program allocating space for the string at each iteration of the loop. When the heap was quite low in size, the garbage collector kicked in and started freeing some of the memory.&lt;br /&gt;&lt;br /&gt;Next week onward we will try to stick more to the "recipe" of  the lab logs in order to get a more structured reports from each lab session.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-706984626399123757?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/706984626399123757/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=706984626399123757' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/706984626399123757'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/706984626399123757'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/09/week-1b.html' title='Week 1.b - Improving the line following robot'/><author><name>Martin Have</name><uri>http://www.blogger.com/profile/07000011516463115777</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-5860596819436718192</id><published>2008-09-02T15:09:00.002+02:00</published><updated>2008-11-09T15:26:33.018+01:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='NXT Train'/><category scheme='http://www.blogger.com/atom/ns#' term='firmware'/><category scheme='http://www.blogger.com/atom/ns#' term='line follower'/><category scheme='http://www.blogger.com/atom/ns#' term='light sensor'/><category scheme='http://www.blogger.com/atom/ns#' term='Mindstorms'/><category scheme='http://www.blogger.com/atom/ns#' term='ultrasonic sensor'/><title type='text'>Week 1.a - Setting up and testing the NXT</title><content type='html'>We've been playing around with our Mindstorms set a lot this week, trying to get the hang of both the building and coding aspects of the set.&lt;br /&gt;&lt;br /&gt;First order of business was, of course, to flash the NXT unit's firmware. This proved more difficult than anticipated as the USB connection drivers proved incompatible with the Windows Vista machine we were attempting connection with. Disastrously so, in fact, as the incompatible drivers rendered the computer unable to even connect to its own usb-based devices.&lt;br /&gt;Specifically the "libusb" file in the 3rd party folder ws incompatible with Vista's usb handling. We found no other compatibility problems with Vista.&lt;br /&gt;&lt;br /&gt;When we tried connecting through an XP machine, the process went a lot smoother and we were able to install the new software without further disaster.&lt;br /&gt;&lt;br /&gt;Meanwhile, construction on the sample car/robot (as described in the manual accompanying the Mindstroms set) was going smoothly, and we were able to construct the fully enhanced robot and to test its capabilities using the sample programs already present on the unflashed NXT unit.&lt;br /&gt;&lt;br /&gt;With the robot constructed and the firmware installed we were able to install the "Line follow program" which worked fully as expected. We added support for the ultrasonic sensor in order to avoid obstacles on a course.&lt;br /&gt;&lt;br /&gt;Inspired by the standard claw parts present in the Mindstorms box, we have started construction on a claw-like appendage for the robot. At the time of writing it is fully capable of opening and closing by power supplied by a standard motor and has a touch-sensor embedded in between its claws.&lt;br /&gt;The dimensions were chosen to match the size of the red and blue balls in the standard Mindstorms set, so that it might eventually be programmed to pick up these balls, as they appear to be designed to be distinguishable by the light-sensor attachment.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-5860596819436718192?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/5860596819436718192/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=5860596819436718192' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/5860596819436718192'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/5860596819436718192'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/09/week-1a.html' title='Week 1.a - Setting up and testing the NXT'/><author><name>Martin Have</name><uri>http://www.blogger.com/profile/07000011516463115777</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7120877094656561813.post-2423364320829763531</id><published>2008-09-02T15:06:00.000+02:00</published><updated>2008-09-02T15:09:07.070+02:00</updated><title type='text'>Hello World</title><content type='html'>In following the course "Embedded Systems - Embodied Agents" at the Computer Science dept. of Århus University, this blog will serve both as a repository of knowledge for our group, "Lego of Doom", and as a source of information for other interested groups.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7120877094656561813-2423364320829763531?l=legoofdoom.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://legoofdoom.blogspot.com/feeds/2423364320829763531/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7120877094656561813&amp;postID=2423364320829763531' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/2423364320829763531'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7120877094656561813/posts/default/2423364320829763531'/><link rel='alternate' type='text/html' href='http://legoofdoom.blogspot.com/2008/09/hello-world.html' title='Hello World'/><author><name>Martin Have</name><uri>http://www.blogger.com/profile/07000011516463115777</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
