<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
<link rel="self" type="application/atom+xml" href="http://forum.robosavvy.com/feed.php?f=15&amp;t=5539" />

<title>RoboSavvy Forum</title>
<subtitle>Robosavvy Forum: The largest online community of Humanoid Robot Builders</subtitle>
<link href="http://forum.robosavvy.com/index.php" />
<updated>2010-03-18T23:41:57+01:00</updated>

<author><name><![CDATA[RoboSavvy Forum]]></name></author>
<id>http://forum.robosavvy.com/feed.php?f=15&amp;t=5539</id>
<entry>
<author><name><![CDATA[l3v3rz]]></name></author>
<updated>2010-03-18T23:41:57+01:00</updated>
<published>2010-03-18T23:41:57+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=5539&amp;p=25964#p25964</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=5539&amp;p=25964#p25964"/>
<title type="html"><![CDATA[Maze solving - with L#]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=5539&amp;p=25964#p25964"><![CDATA[
Another potential problem is if the readdistance command fails - bad comms for instance - a null string (rather than a 0) is returned that also generates this same message about &quot;Input String Format ..&quot;<br /><br />This is easily fixed and I've just uploaded a new version of maze2,lisp. The essential difference being it now checks and set to 0 if a null or empty string is returned:<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>&#40;def readDistance   &#40;&#41; <br />    &#40;with &#40;x &#40;readdistance&#41;&#41; <br />        &#40;do &#40;exit?&#41; <br />              &#40;if &#40;or &#40;is x &quot;&quot;&#41; &#40;is x null&#41;&#41; &#40;= x 0&#41; &#41;<br />              &#40;prn &quot;distance = &quot; x&#41;<br />      &#41;&#41;&#41;<br /></code></dd></dl><br /><br />regards<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1101">l3v3rz</a> — Thu Mar 18, 2010 11:41 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[l3v3rz]]></name></author>
<updated>2010-03-16T18:43:36+01:00</updated>
<published>2010-03-16T18:43:36+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=5539&amp;p=25934#p25934</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=5539&amp;p=25934#p25934"/>
<title type="html"><![CDATA[Maze solving - with L#]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=5539&amp;p=25934#p25934"><![CDATA[
Its great hear someone try and using it.  The problem might be down to the lack of parameter checking on putmap - and the .substring command fails. Try putting a test for x and y values between 0 and 7.<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1101">l3v3rz</a> — Tue Mar 16, 2010 6:43 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[ebrand]]></name></author>
<updated>2010-03-16T16:28:21+01:00</updated>
<published>2010-03-16T16:28:21+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=5539&amp;p=25933#p25933</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=5539&amp;p=25933#p25933"/>
<title type="html"><![CDATA[Distance Sensor Error]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=5539&amp;p=25933#p25933"><![CDATA[
I've set this up on my robobuilder and it is pretty sweet. I've just run into one problem. I get this exception when the robobuilder gets too close to an object:<br /><br />Exception : Input string was not in a correct format.<br /><br />If you can just try to point me in the right direction in the code I bet I can figure out the error. I am using maze2.lisp and LSharpConsole.exe.<br /><br />Any help will be greatly appreciated!<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=2020">ebrand</a> — Tue Mar 16, 2010 4:28 pm</p><hr />
]]></content>
</entry>
<entry>
<author><name><![CDATA[l3v3rz]]></name></author>
<updated>2010-01-08T19:27:43+01:00</updated>
<published>2010-01-08T19:27:43+01:00</published>
<id>http://forum.robosavvy.com/viewtopic.php?t=5539&amp;p=24589#p24589</id>
<link href="http://forum.robosavvy.com/viewtopic.php?t=5539&amp;p=24589#p24589"/>
<title type="html"><![CDATA[Maze solving - with L#]]></title>

<content type="html" xml:base="http://forum.robosavvy.com/viewtopic.php?t=5539&amp;p=24589#p24589"><![CDATA[
In the Robobuilder C programming tutorial there is an application written in C to enable the robot to traverse a maze using the distance sensor. You have to compile it in AVR C and download to the RBC.  To make this easier to do,  I've converted it to L#/Lsharp.Net. A simple scripting language.  It uses the lisp code explained here <!-- m --><a class="postlink" href="http://robosavvy.com/forum/viewtopic.php?t=4800">http://robosavvy.com/forum/viewtopic.php?t=4800</a><!-- m -->.  (Or downloaded as a word document here : <!-- m --><a class="postlink" href="http://robobuildervc.googlecode.com/files/final.doc">http://robobuildervc.googlecode.com/files/final.doc</a><!-- m --> )<br /><br />You need final.lisp from here  <!-- m --><a class="postlink" href="http://robobuildervc.googlecode.com/files/Lisp.zip">http://robobuildervc.googlecode.com/files/Lisp.zip</a><!-- m --> to connect to Robobuilder. The maze application code is available here <!-- m --><a class="postlink" href="http://robobuildervc.googlecode.com/files/maze2.lisp">http://robobuildervc.googlecode.com/files/maze2.lisp</a><!-- m --><br /><br />The code builds a map on screen of the maze as the robot moves around. It uses the distance sensor to identify the walls and then the following algorithm:<br /><br />1. If there is no wall, move forward.<br />2. If the wall is detected, check left side.<br />3. If front and left side wall are detected, check right side. <br />4. If front, left and right side walls detected, go to opposite way.<br /><br />You can run it in a simulate mode without the robot. Here's an example of it in action:<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code> &gt; &#40;maze&#41;<br />  ........ <br />  ........<br />  ........<br />  ........<br />  ....^...<br />  ........<br />  ........<br />  ........<br />  distance ?<br />  : 20<br />  LT90<br />  Run motion 3<br />  Run motion 3<br />  Run motion 3<br />  ........<br />  ........<br />  ........<br />  ........<br />  ....&lt;...<br />  ........<br />  ........<br />  ........<br /></code></dd></dl><br /><br />The program defines a number of simple primitive motions based on the built in motions:<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>&#40;def leftturn90   &#40;&#41; &#40;prn &quot;LT90&quot;&#41;   &#40; runMotion 3&#41; &#40;runMotion 3&#41; &#40;runMotion 3&#41;&#41;<br />&#40;def leftturn180 &#40;&#41; &#40;prn &quot;LT180&quot;&#41; &#40; runMotion 3&#41; &#40;runMotion 3&#41; &#40;runMotion 3&#41; &#40;runMotion 3&#41; &#40;runMotion 3&#41;&#41;<br />&#40;def rightturn90 &#40;&#41; &#40;prn &quot;RT90&quot;&#41;  &#40; runMotion 5&#41; &#40;runMotion 5&#41; &#40;runMotion 5&#41; &#40;runMotion 5&#41;&#41;<br />&#40;def forward      &#40;&#41; &#40;prn &quot;FWD&quot;&#41;   &#40; runMotion 4&#41; &#40;runMotion 4&#41; &#40;runMotion 5&#41; &#41;<br />&#40;def back           &#40;&#41; &#40;prn &quot;BACK&quot;&#41;  &#40; runMotion 10&#41;&#41;<br /></code></dd></dl><br /><br />The maps is created using a simple string to represent 8x8 grid. And some functions that display and show the robot a simple character. <br /><br />The function <span style="font-weight: bold">maze</span> then uses these routines to solve the maze, by walking the robot around, and measuring the distances to the nearest wall using the PSD.<br /><br />The code is written so that it uses two key routines from final.lisp <span style="font-weight: bold">runMotion</span> that plays the motion turn left etc and <span style="font-weight: bold">readdistance</span> that reads the PSD sensor. These routines are initially defined in maze2.lisp to allow user to simulate by entering the distance and then printing the motion to be called - so it can be run without a robot attached. <br /><br />To run fully all that is required is to load final.lisp which will redefine <span style="font-weight: bold">runMotion</span> and <span style="font-weight: bold">readdistance</span> to be the actual routines. Call (run_robobuilder) and connect the PC to robot. Select &quot;Basic Posture&quot; and then exit the menu. Now type (maze) and off it goes, showing its its progress on the map!<br /><br /><dl class="codebox"><dt>Code: </dt><dd><code>;maze algorithm<br />&#40;def maze &#40;&#41; <br />  &#40;= px 4&#41; &#40;= py 4&#41;          ; assume center of maze<br />  &#40;= pd 0&#41;                   ; facing up<br />  &#40;= pt '&#40;&quot;^&quot; &quot;&gt;&quot; &quot;v&quot; &quot;&lt;&quot;&#41;&#41;  ; maze turtle character<br />  &#40;= cs 0&#41;                   ; current state = 0<br />  &#40;clrmap&#41;                   ; reset map<br />  <br />  &#40;while true<br />     &#40;= pd &#40;mod pd 4&#41;&#41;<br />     &#40;putmap px py &#40;nth pt pd&#41;&#41; &#40;showmap&#41; <br />     &#40;= d &#40;readDistance&#41;&#41;<br />     &#40;if  &#40;&gt; 12 d&#41;                   &#40;back&#41;<br />     <br />          &#40;and &#40;is cs 0&#41; &#40;&gt; 30 d&#41;&#41;   &#40;do &#40;leftturn90&#41;  &#40;= pd &#40;+ pd 3&#41;&#41; &#40;= cs 1&#41;&#41;<br /><br />          &#40;and &#40;is cs 1&#41; &#40;&gt; 30 d&#41;&#41;   &#40;do &#40;leftturn180&#41; &#40;= pd &#40;+ pd 2&#41;&#41; &#40;= cs 2&#41;&#41;<br /><br />          &#40;and &#40;is cs 2&#41; &#40;&gt; 30 d&#41;&#41;   &#40;do &#40;rightturn90&#41; &#40;= pd &#40;+ pd 1&#41;&#41; &#40;= cs 0&#41;&#41;<br />          <br />          &#40;do <br />             &#40;= cs 0&#41;  <br />             &#40;forward&#41; <br />             <br />             ; update map       <br />             &#40;putmap px py &quot;*&quot;&#41;<br />             <br />             &#40;= pd &#40;mod pd 4&#41;&#41;<br />             &#40;if &#40;is pd 0&#41; &#40;= py &#40;- py 1&#41;&#41; <br />                   &#40;is pd 1&#41; &#40;= px &#40;+ px 1&#41;&#41; <br />                   &#40;is pd 2&#41; &#40;= py &#40;+ py 1&#41;&#41; <br />                   &#40;is pd 3&#41; &#40;= px &#40;- px 1&#41;&#41;&#41;<br />             &#40;if &#40;&lt; px 0&#41; &#40;= px 0&#41; &#40;&lt; py 0&#41; &#40;= py 0&#41; &#40;&gt; px 7&#41; &#40;= px 7&#41; &#40;&gt; py 7&#41; &#40;= px 7&#41;&#41;<br />           &#41; <br />      &#41;<br />  &#41;<br />&#41;<br /></code></dd></dl><br /><br />You may well have to tune the motion routines to optimise performance. You you could add a test to see if the robot has fallen over - and if it does, get it to stand up, reset the maze and start again.<br /><br />Have fun!<p>Statistics: Posted by <a href="http://forum.robosavvy.com/memberlist.php?mode=viewprofile&amp;u=1101">l3v3rz</a> — Fri Jan 08, 2010 7:27 pm</p><hr />
]]></content>
</entry>
</feed>