<?xml version="1.0" encoding="UTF-8" standalone="yes"?><oembed><version><![CDATA[1.0]]></version><provider_name><![CDATA[The Osmosian Order of Plain English Programmers Welcomes You]]></provider_name><provider_url><![CDATA[http://osmosianplainenglishprogramming.blog]]></provider_url><author_name><![CDATA[gerryrzeppa]]></author_name><author_url><![CDATA[https://osmosianplainenglishprogramming.blog/author/gerryrzeppa/]]></author_url><title><![CDATA[Robotics]]></title><type><![CDATA[link]]></type><html><![CDATA[<header class="entry-header">
<h1 class="entry-title"></h1>
</header>
<div class="entry-content">
<p>Kids (and adults) love robotics. And now, by combining control boards made by these folks…</p>
<p><a href="https://www.pc-control.co.uk/">https://www.pc-control.co.uk/</a></p>
<p>…with the free Osmosian Plain English programming language, kids (and adults) can program their robotic creations in a language they already know: English.</p>
<p>My 12-year-old son and I thought that automating this LEGO maze…</p>
<p><img loading="lazy" class="alignnone size-medium wp-image-312222" src="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/photo-03-lego-maze-in-box-300x248.jpg" alt="" width="300" height="248" /></p>
<p>…would be a good test of the system. So we assembled the LEGO maze base as instructed. The knob on the front tilts the maze left and right; the knob on the side tilts the maze foward and back.</p>
<p><img loading="lazy" class="alignnone size-full wp-image-312223" src="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/photo-04-lego-frame.jpg" alt="" width="640" height="575" /></p>
<p>We then bought a control board kit from the PC-Control folks that came with battery pack, some servos, and a USB cable:</p>
<p><img loading="lazy" class="alignnone size-full wp-image-312221" src="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/photo-02-starter-pack.jpg" alt="" width="640" height="417" /></p>
<p>We built a LEGO sub-base to hold the battery pack and the control board, and we mounted the servos so they would mate with the knobs on the LEGO base:</p>
<p><img loading="lazy" class="alignnone size-full wp-image-312226" src="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/photo-07-platform.jpg" alt="" width="640" height="545" /></p>
<p>Then we used the built-in Osmosian wysiwyg page editor to plan our maze pattern…</p>
<p><img loading="lazy" class="alignnone size-full wp-image-312224" src="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/photo-05-lego-maze-plan.png" alt="" width="640" height="512" /></p>
<p>…and built the top layer of the maze to match (give or take some decorative trees and buildings):</p>
<p><img loading="lazy" class="alignnone size-full wp-image-312227" src="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/photo-08-whole-shebang.jpg" alt="" width="640" height="548" /></p>
<p>It was then time to program. We started with a few type defintions:</p>
<p><span style="color:#00ccff;">A setting is a number.</span></p>
<p><span style="color:#00ccff;">A knob has a setting.</span></p>
<p><span style="color:#00ccff;">The front knob is a knob.</span><br />
<span style="color:#00ccff;"> The side knob is a knob.</span></p>
<p>Then we added in the low-level helper routines we needed to talk to the well-documented Dynamic Link Library (DLL) provided by the PC-Control folks:</p>
<p><span style="color:#00ccff;">To start up the Hawk servo board:</span><br />
<span style="color:#00ccff;"> Call &#8220;hawk.dll&#8221; &#8220;Sys_Initialise&#8221; returning a number.</span></p>
<p><span style="color:#00ccff;">To set the servos:</span><br />
<span style="color:#00ccff;"> Call &#8220;hawk.dll&#8221; &#8220;Servo_SetServos&#8221; with 1</span><br />
<span style="color:#00ccff;"> and the front knob&#8217;s setting and the side knob&#8217;s setting</span><br />
<span style="color:#00ccff;"> and 0 and 0 and 0 and 0 and 0 and 0 returning a number.</span></p>
<p><span style="color:#00ccff;">To shut down the Hawk servo board:</span><br />
<span style="color:#00ccff;"> Call &#8220;hawk.dll&#8221; &#8220;Sys_CloseAllDevices&#8221; returning a number.</span></p>
<p>Then we stuck in some mid-level helpers, to get us closer to where we wanted to be:</p>
<p><span style="color:#00ccff;">To center a knob:</span><br />
<span style="color:#00ccff;"> Put 512 into the knob&#8217;s setting.</span><br />
<span style="color:#00ccff;"> Set the servos.</span></p>
<p><span style="color:#00ccff;">To turn a knob to the left:</span><br />
<span style="color:#00ccff;"> Put 712 into the knob&#8217;s setting.</span><br />
<span style="color:#00ccff;"> Set the servos.</span></p>
<p><span style="color:#00ccff;">To turn a knob to the right:</span><br />
<span style="color:#00ccff;"> Put 312 into the knob&#8217;s setting.</span><br />
<span style="color:#00ccff;"> Set the servos.</span></p>
<p>And finally, we added the high-level routines that would serve as our official Application Programming Interface (API):</p>
<p><span style="color:#00ccff;">To center both knobs:</span><br />
<span style="color:#00ccff;"> Center the front knob.</span><br />
<span style="color:#00ccff;"> Center the side knob.</span></p>
<p><span style="color:#00ccff;"> To tilt the board forward and right:</span><br />
<span style="color:#00ccff;"> Turn the side knob to the right. Wait for 1/10 second.</span><br />
<span style="color:#00ccff;"> Turn the front knob to the right. Wait for 1 second.</span></p>
<p><span style="color:#00ccff;">To tilt the board forward and left:</span><br />
<span style="color:#00ccff;"> Turn the side knob to the right. Wait for 1/10 second.</span><br />
<span style="color:#00ccff;"> Turn the front knob to the left. Wait for 1 second.</span></p>
<p><span style="color:#00ccff;">To tilt the board backward and right:</span><br />
<span style="color:#00ccff;"> Turn the side knob to the left. Wait for 1/10 second.</span><br />
<span style="color:#00ccff;"> Turn the front knob to the right. Wait for 1 second.</span></p>
<p><span style="color:#00ccff;">To tilt the board backward and left:</span><br />
<span style="color:#00ccff;"> Turn the side knob to the left. Wait for 1/10 second.</span><br />
<span style="color:#00ccff;"> Turn the front knob to the left. Wait for 1 second.</span></p>
<p><span style="color:#00ccff;">To tilt the board left and forward:</span><br />
<span style="color:#00ccff;"> Turn the front knob to the left. Wait for 1/10 second.</span><br />
<span style="color:#00ccff;"> Turn the side knob to the right. Wait for 1 second.</span></p>
<p><span style="color:#00ccff;">To tilt the board left and backward:</span><br />
<span style="color:#00ccff;"> Turn the front knob to the left. Wait for 1/10 second.</span><br />
<span style="color:#00ccff;"> Turn the side knob to the left. Wait for 1 second.</span></p>
<p><span style="color:#00ccff;">To tilt the board right and forward:</span><br />
<span style="color:#00ccff;"> Turn the front knob to the right. Wait for 1/10 second.</span><br />
<span style="color:#00ccff;"> Turn the side knob to the right. Wait for 1 second.</span></p>
<p><span style="color:#00ccff;">To tilt the board right and backward:</span><br />
<span style="color:#00ccff;"> Turn the front knob to the right. Wait for 1/10 second.</span><br />
<span style="color:#00ccff;"> Turn the side knob to the left. Wait for 1 second.</span></p>
<p>It was then easy to write the application, since all we had to say was WHAT we wanted the maze to do, rather than HOW to do it:</p>
<p><span style="color:#00ccff;">To do the lego maze:</span><br />
<span style="color:#00ccff;"> Start fresh.</span><br />
<span style="color:#00ccff;"> Start up the hawk servo board.</span><br />
<span style="color:#00ccff;"> Center both knobs.</span><br />
<span style="color:#00ccff;"> Write and say &#8220;MAKE SURE THE BOARD IS LEVEL, THEN PRESS ENTER&#8221;.</span><br />
<span style="color:#00ccff;"> Wait for the enter key.</span><br />
<span style="color:#00ccff;"> Tilt the board backward and right.</span><br />
<span style="color:#00ccff;"> Write and say &#8220;PUT THE BALL ON THE GREEN SQUARE, THEN PRESS ENTER&#8221;.</span><br />
<span style="color:#00ccff;"> Wait for the enter key.</span><br />
<span style="color:#00ccff;"> Tilt the board forward and right.</span><br />
<span style="color:#00ccff;"> Write and say &#8220;THIS IS FUN&#8221;.</span><br />
<span style="color:#00ccff;"> Tilt the board left and forward.</span><br />
<span style="color:#00ccff;"> Write and say &#8220;UNDER THE BRIDGE&#8221;.</span><br />
<span style="color:#00ccff;"> Tilt the board backward and right.</span><br />
<span style="color:#00ccff;"> Tilt the board left and backward.</span><br />
<span style="color:#00ccff;"> Tilt the board forward and right.</span><br />
<span style="color:#00ccff;"> Tilt the board left and forward.</span><br />
<span style="color:#00ccff;"> Tilt the board backward and left.</span><br />
<span style="color:#00ccff;"> Write and say &#8220;ABOUT HALF-WAY, I THINK&#8221;.</span><br />
<span style="color:#00ccff;"> Tilt the board right and forward.</span><br />
<span style="color:#00ccff;"> Tilt the board backward and right.</span><br />
<span style="color:#00ccff;"> Tilt the board left and backward.</span><br />
<span style="color:#00ccff;"> Tilt the board forward and left.</span><br />
<span style="color:#00ccff;"> Tilt the board right and backward.</span><br />
<span style="color:#00ccff;"> Tilt the board forward and right.</span><br />
<span style="color:#00ccff;"> Tilt the board left and backward.</span><br />
<span style="color:#00ccff;"> Write and say &#8220;THROUGH THE RIVER&#8221;.</span><br />
<span style="color:#00ccff;"> Tilt the board forward and left.</span><br />
<span style="color:#00ccff;"> Tilt the board right and backward.</span><br />
<span style="color:#00ccff;"> Tilt the board forward and right.</span><br />
<span style="color:#00ccff;"> Tilt the board left and forward.</span><br />
<span style="color:#00ccff;"> Write and say &#8220;ALMOST THERE&#8221;.</span><br />
<span style="color:#00ccff;"> Tilt the board backward and left.</span><br />
<span style="color:#00ccff;"> Shut down the hawk servo board.</span><br />
<span style="color:#00ccff;"> Write and say &#8220;ALL DONE&#8221;.</span><br />
<span style="color:#00ccff;"> Write and say &#8220;COOL&#8221;.</span></p>
<p>The output on the screen, when the program is run, looks like this:</p>
<p><img loading="lazy" class="alignnone size-full wp-image-312256" src="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/photo-98-terminal-output.jpg" alt="" width="720" height="326" /></p>
<p>The words are spoken as they are displayed on the screen.</p>
<p>And the happy (and confident) aspiring engineer looks like this:</p>
<p><img loading="lazy" class="alignnone size-medium wp-image-312237" src="https://cdncontribute.geeksforgeeks.org/wp-content/uploads/photo-15-chuckles-with-maze-278x300.jpg" alt="" width="278" height="300" /></p>
<p>Simple, fast, flexible. Good clean stuff. Good clean fun.</p>
</div>
]]></html><thumbnail_url><![CDATA[https://i1.wp.com/cdncontribute.geeksforgeeks.org/wp-content/uploads/photo-03-lego-maze-in-box-300x248.jpg?fit=440%2C330&ssl=1]]></thumbnail_url><thumbnail_width><![CDATA[300]]></thumbnail_width><thumbnail_height><![CDATA[248]]></thumbnail_height></oembed>