tag:blogger.com,1999:blog-12284147162085933212024-03-13T00:10:17.865+01:00Lego International Lab NotesDyhrberghttp://www.blogger.com/profile/15764682796259349694noreply@blogger.comBlogger25125tag:blogger.com,1999:blog-1228414716208593321.post-72179591106916744652011-01-19T07:08:00.002+01:002011-01-19T07:16:54.659+01:00End Course Project 14: ConclusionThe full PDF report for this project can be downloaded at the following address :<br />
<blockquote><a href="http://code.google.com/p/legointernational/downloads/list">http://code.google.com/p/legointernational/downloads/list</a></blockquote><br />
<div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283178950"><span lang="EN-US">1<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Results and testing on the battlefield</span></a></h2></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"><h3><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283178951"><span lang="EN-US">1.1<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Goal achieved?</span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Discussing and planning a lot at the beginning of the project helped us defining an achievable goal that did not change much during the process. We therefore agree on saying that we have fulfilled our main task and that we have created a game interesting to play and with only minor flaws. We are however aware that there is still room for lots of improvements.</span><br />
<span lang="EN-US"><br />
</span></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"><h3><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283178952"><span lang="EN-US">1.2<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Testing on the battlefield</span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The tests went even better that expected; by placing both computers at the middle of the sides of the battlefield, we were able to have a full coverage of the area. We had for sure to fix some part of the code before having a fully working game, even when we were on the playfield for the first time, but once done, we could be confident.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The final test happened almost seamlessly and we were able to play our game as we expected it to be. Once the process of starting the game is understood, one never encounters communication problems at all. </span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">One added value of our game is that it can be played everywhere in numerous configurations. We basically only need a floor with obstacles (that can be doll or LEGO houses or chairs and tables as well), and the players can even play in separate rooms thanks to our All-Wireless communications. A user can play sat in front his computer or can follow his robot unit by moving at its sides.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Since a video is better than a long description, below are some excerpts of our games played during the testing (shown during our presentation, on the 13th of January 2011).</span><br />
<span lang="EN-US"><br />
</span><br />
<div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dy46yNQc2NgnDsG1YCmg8fUNr68jjkRXqIDM_ZPjoirsY2YD2jlE1d66DbpxDPkyyaKm_AFDcu85NG8TLcwTw' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div class="separator" style="clear: both; text-align: center;">A first person point of view while wandering through the city</div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div style="text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dxGJvjDAgqoF4J7NuFRPmuKWijpWs618SbU1Dg9kjC5W-QNq5ORNR4zygWrPOOhNVaCylCm-9kuP7ZUACo' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div class="separator" style="clear: both; text-align: center;">Overall presentation of a game</div><br />
</div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2 style="background: #DBE5F1; mso-background-themecolor: accent1; mso-background-themetint: 51; text-align: justify; text-justify: inter-ideograph;"><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283178953"><span lang="EN-US">2<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Involving other external users - feedback</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">So we realized after our examination presentation and the interest from the company Rezultat <span class="MsoSubtleReference">(see part below: 16.4.2) </span>that maybe we had something good going here. It was clear that it was working from a Technical perspective. But is it working from Kids perspectives, which don’t care about WiFi and BT interfaces?</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">We decided to benchmark our game against our top priority from the beginning. Is it fun to play?</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">So we invited two kids to play the game for an hour, and filmed their response. It was Laurits 8 years old “almost” and Frede 9½ years old.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Before showing them the game field, we did a small test where we had them playing the classic game of Simon<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn1" name="_ftnref1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[1]</span></span></span></a> to get a sense of the length of color sequence they could remember, since this would prevent them from winning as CTU if the sequence was too long.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The result was that we should not expect them to remember more then 5-7 colors in the game.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">To adjust this during the game we just helped the remembering the remaining 5 colors of the 10 in the sequence. This strategy worked well.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">They really fast understood the strategy of the game. And after 2 games they were controlling the robots perfect. Using the Xbox controller clearly helped them adopting the control part of the game. It was a major advantage that the controllers were wireless. They quickly adopted that they could just move freely around the game field and back to the computer. And it was very interesting that we could se them moving to and from the computer several times during a game.</span><br />
<span lang="EN-US"><br />
</span><br />
<div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dz8uij8-es2AKfNiahsPOD_wvatYa4SriZ4bHl07-andZU4ZxKAY0xx_Yxr6ZvZxEJKH-8OvMu0zPlJqiqtww' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div class="separator" style="clear: both; text-align: center;">CTU Wins !</div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div style="text-align: center;"><object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/hKmCy1_ZrTk/0.jpg" height="266" width="320"><param name="movie" value="http://www.youtube.com/v/hKmCy1_ZrTk?f=user_uploads&c=google-webdrive-0&app=youtube_gdata" /><param name="bgcolor" value="#FFFFFF" /><embed width="320" height="266" src="http://www.youtube.com/v/hKmCy1_ZrTk?f=user_uploads&c=google-webdrive-0&app=youtube_gdata" type="application/x-shockwave-flash"></embed></object></div><div class="separator" style="clear: both; text-align: center;">CTU loses... Great remarks and reactions to the result from the boys, in the end.</div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div style="text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/qaQQHDLcOiE?feature=player_embedded' frameborder='0'></iframe></div><div style="text-align: center;"><span lang="EN-US">Video that has some good elements where we see Laurits start of the game by running to control the unit on the field. and a little later we see Frede go from the field instead to use the computer view mid-game.</span></div><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span class="Apple-style-span" style="color: red;"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">As they had played the game +5 times, they started to challenge the game a lot.</span></div><div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l3 level1 lfo4; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">They started to drive around the edges of the play field where the Bluetooth range was a little challenged.</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l3 level1 lfo4; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">They started to fight with the robots, and obstruct each other from pushing the ball of the bomb, which clearly uncovered a few weaknesses in our LEGO constructions.</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l3 level1 lfo4; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">They started to insist that they wanted to remember more of the color sequence them self.</span></div><div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l3 level1 lfo4; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">They started to have stronger opinions about whose turn to place the bomb or defuse the bomb. There was a tendency that it was more fun to defuse the bomb. Mainly because it was fun to push of the ball, and cut the wires.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">After the hours of playing we did a small interview, about the game. They had some good comments. The journalistic quality of the interview can most likely be disputed. But we are quite satisfied about the comments received from the boys. It was clear that was very fun for them.</span><br />
<span lang="EN-US"><br />
</span><br />
<div class="separator" style="clear: both; text-align: center;"><object class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/RgL_ESEv77o/0.jpg" height="266" width="320"><param name="movie" value="http://www.youtube.com/v/RgL_ESEv77o?f=user_uploads&c=google-webdrive-0&app=youtube_gdata" /><param name="bgcolor" value="#FFFFFF" /><embed width="320" height="266" src="http://www.youtube.com/v/RgL_ESEv77o?f=user_uploads&c=google-webdrive-0&app=youtube_gdata" type="application/x-shockwave-flash"></embed></object></div><div style="text-align: center;">Interview of the two boys who tested the game (in Danish).</div></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span class="Apple-style-span" style="color: blue;"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span class="MsoSubtleEmphasis"><span lang="EN-US"><i>Thanks to Frede and Laurits for helping us testing the game.<o:p></o:p></i></span></span><br />
<span class="MsoSubtleEmphasis"><span lang="EN-US"><br />
</span></span></div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2 style="background: #DBE5F1; mso-background-themecolor: accent1; mso-background-themetint: 51; text-align: justify; text-justify: inter-ideograph;"><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283178954"><span lang="EN-US">3<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Playing in a physical/virtual world?</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Why is it so funny and interesting to play such a game, that is neither like Counter Strike (a videogame) nor like playing paintball (real game) but rather in-between? It may precisely be because it is a different kind of gameplay that involves both reality and a virtual world. It is nice to play Counter Strike since you just need some computers and a not a lot of material with a big playground; it is fun to play real paintball since you get thrilling and real sensations, with the added feeling of playing almost like “for real”, with good equipment that provides great feedback.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">In a 100% virtual world, you can get the advantages of getting things you could not have if you would like to play the game for real, with for instance an improved head-up display and other augmented reality features. In a 100% real world, you don’t have to comply with some developers’ constraints and you can go wherever you want and do whatever is physically possible to do – the world seems less closed and provides the player with an improved feeling of freedom. </span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Our game is in the middle of those worlds and tries to take the best from both. And in fact a player can also choose to limit himself to one of those realities, either by only focusing on his screen and almost leaving aside the real robot behind the game, or by never looking at his screen and following his real robot (like sometimes the kids were doing during our experiment). Obviously, you always have to take both virtual and real parts into account while playing (you have to be aware of the physical limitations of the robots and you need your screen to at least defuse the bomb by cutting the wires).</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Besides, having physical robots playing in a small but “real” city implies more fun for spectators that can physically move around the playfield to have their very own point of view on the action. They can act as supporters for the player and be part of the game themselves by providing them with information on the action.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">And there may be a lot more reasons to explain the interest of such a concept. Still, watching the enjoyment children may have while playing this game is a satisfaction that may asks for no explanation in itself…</span><br />
<span lang="EN-US"><br />
</span></div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2 style="background: #DBE5F1; mso-background-themecolor: accent1; mso-background-themetint: 51; text-align: justify; text-justify: inter-ideograph;"><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283178955"><span lang="EN-US">4<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Improvements</span></a></h2></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"><h3><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283178956"><span lang="EN-US">4.1<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">What we would like to improve</span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><i><span lang="EN-US">“What could we do if we had some extra time?”<o:p></o:p></span></i><br />
<i><span lang="EN-US"><br />
</span></i></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">This is the question we’ll answer in the next part. Indeed the version of the game is the v1.0. We cannot even stop to come up with new ideas every time we make brainstorming. But here is a list of things that will are likely to be implemented within the next months (knowing that it’s highly likely that we will continue this project).</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoListParagraphCxSpFirst" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Being a terrorist is thrilling when you’re the one deciding where and when to plant the bomb. The only thing is that when you’ve planted it, there’s nothing left for you but trying to block the counter terrorist in the defusing mode. So as to change that, we thought about</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level2 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: 'Courier New';">o<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Giving perks to the terrorist as soon as he drops the bomb</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 108.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level3 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Wingdings;">§<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Disable video of the counter-terrorist unit</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 108.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level3 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Wingdings;">§<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Invert commands of the counter terrorist</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 108.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level3 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Wingdings;">§<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Reverse the defusing sequence</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 108.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level3 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Wingdings;">§<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">…</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level2 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: 'Courier New';">o<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Implementing a combat system between the terrorist and the counter-terrorist in which every unit gets life points (losing all the point would lead to a temporary curse).</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-left: 72.0pt; mso-add-space: auto; text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Put another webcam on the field (this could be linked to the perks: a unit could use the “sky view” in order to have a better understanding of the map and locate some strategic points). See the video below to get an idea of this feature.</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 106.2pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; text-align: justify; text-justify: inter-ideograph;"><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/9n6EkC1rbNg?feature=player_embedded' frameborder='0'></iframe></div><div class="separator" style="clear: both; text-align: center;">Switching the video feed in real time</div></div><div class="MsoListParagraphCxSpMiddle" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Improve the program so as to have a quicker way to get the game started and upgrade the “Server-Client” protocol (as we mentioned before).</span></div><div class="MsoListParagraphCxSpMiddle"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Improve the mechanical part: robots more aggressive, more stable, a new system of claw for the bomb (which would lead to the ability of re-attachment for the bomb…).</span></div><div class="MsoListParagraphCxSpMiddle" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Add autonomous units on the field which could be decoy or try to search and defuse the bomb. Those units could be deployed when the bomb is planted or at another time.</span></div><div class="MsoListParagraphCxSpMiddle"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">The latest testing with the kids revealed that users are not always as careful as we are while we test our game by ourselves, and as a consequence, some mechanical flaws are to be fixed :</span></div><div class="MsoListParagraphCxSpMiddle"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 90.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level2 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: 'Courier New';">o<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">The spear pole is not sturdy enough and may break when robots collide into each other (and kids love that!) or into a building.</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 90.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level2 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: 'Courier New';">o<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">The claw that attaches the bomb unit to the CTU may open by itself if the carrier unit makes a sharp turn or run over a small obstacle. Once the children noticed that, they were yet more careful and managed more often to plant the bomb where they wanted. Still, the mechanism needs to be improved – we already have ideas for that.</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 90.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level2 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: 'Courier New';">o<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Since running into the opponent is something quite fun (even if not yet really awarded by the game rules), we have to make sure that the robots are more steady and can systematically keep their balance if they run into or over an obstacle. This is especially needed when dealing with children users.</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 72.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoListParagraphCxSpLast" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Play again, again and again in order to balance the game and see how things can be even more improved (settle the game time, the penalty that the bomb chooses and many other details that we didn’t think about yet).</span><br />
<span lang="EN-US"><br />
</span></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"><h3><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283178957"></a><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Ref283171872"><span lang="EN-US">4.2<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Fortunately, we will get this extra time…</span></a></h3></div><div class="MsoNormal"><span class="MsoSubtleEmphasis"><span lang="EN-US">… since a company is interested by our project!<o:p></o:p></span></span><br />
<span class="MsoSubtleEmphasis"><span lang="EN-US"><br />
</span></span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">As a part of developing this project we had the opportunity to apply the concept working for at specific and well developed game field. The motivation for using the game field was mainly to increase the quality of the play experience from the Point Of View video stream from the robots.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">This game field owned by Rezultat, was agreed to be used for our free disposal<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn2" name="_ftnref2" style="mso-footnote-id: ftn2;" title=""><span class="MsoFootnoteReference"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[2]</span></span></span></a>. </span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">We started the project by going to see the game field mainly for Inspiration, on how to use it to our best advantage.</span><br />
<span lang="EN-US"><br />
</span></div><div align="center" class="MsoNormal" style="text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaOJKzbBV9ph0zT5m-zIh2PkulJdG4rjQ8RtFMtg5jLoqLwKHui3oKR0NvVmlXT87SatZedBHB03tBdELXF18_XEoXmc7u3nKE6k_7pYz0T7CnlCtMVD-vmPpLNkf20LgSZLElK8XtwV0/s1600/city.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="267" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjaOJKzbBV9ph0zT5m-zIh2PkulJdG4rjQ8RtFMtg5jLoqLwKHui3oKR0NvVmlXT87SatZedBHB03tBdELXF18_XEoXmc7u3nKE6k_7pYz0T7CnlCtMVD-vmPpLNkf20LgSZLElK8XtwV0/s400/city.jpg" width="400" /></a></div><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">But we did not return to the game field before entering the New Year, because it did not make sense to go there again before we were ready to begin testing the concepts.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The last two weeks of the project we were at the game field several times testing the concepts as it grew more and more complete. While we were doing this testing the owner of the game field became more and more interested in the game concept we have developed. As he saw the final tests occur. He mentioned that he found several of the concepts of our game much better than the game he is using today, and asked us if we would allow him to <b style="mso-bidi-font-weight: normal;">adopt our game and shape it to suit his concept</b>. He also asked us if we would like to be a part of this process of finalizing the gamer into something that can be used in a commercial context. All members of the group agree to this, and all would like to some extend to be a part of the finalization process. The process for the finalization is TBD. But the group expects to meet week 4, to discuss the plan with Rezultat. </span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div style="mso-element: footnote-list;"><br />
<hr align="left" size="1" width="33%" /><div id="ftn1" style="mso-element: footnote;"><div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref1" name="_ftn1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[1]</span></span></span></span></a><span lang="EN-US"> <a href="http://en.wikipedia.org/wiki/Simon_(game)">http://en.wikipedia.org/wiki/Simon_(game)</a></span><o:p></o:p></div></div><div id="ftn2" style="mso-element: footnote;"><div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref2" name="_ftn2" style="mso-footnote-id: ftn2;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[2]</span></span></span></span></a><span lang="EN-US"> <a href="http://www.rezultat.dk/UNDERHOLDNING/BATTLESTATION/spiltyper.htm"><span class="MsoSubtleReference"><span style="text-decoration: none;">http://www.rezultat.dk/UNDERHOLDNING/BATTLESTATION/spiltyper.htm</span></span></a></span><o:p></o:p></div></div></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com1tag:blogger.com,1999:blog-1228414716208593321.post-43038631434593283422011-01-19T05:49:00.000+01:002011-01-19T05:49:58.447+01:00End Course Project 13: How to start the game<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">In order to start a game, the user must follow a certain protocol so as to make everything work properly. To make it easier, make sure to proceed as follow in the right order:</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoListParagraphCxSpFirst" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo1; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Start the android phones video application, note the <b><i>address:port</i></b> information and place them accordingly on the right units;</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo1; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Start the bricks (every single brick should be in “<i>Waiting for PC</i>” mode);</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo1; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Set the settings (on the settings.java file) in order to ensure connectivity (video, Bluetooth, client-server communication)</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo1; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Start the server (server.java)</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo1; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">As soon as the server machine displays the window “<i>Waiting for client</i>”, start the client (client.java)</span></div><div class="MsoListParagraphCxSpMiddle" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo1; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">From then on, everything should be working by itself. Every player should have a GUI on his screen within few seconds and wait for the game to start. In order to start, the server has to settle everything and as soon as it’s done, a window is displayed on the computer side so as to start the game;</span></div><div class="MsoListParagraphCxSpLast" style="margin-bottom: 10.0pt; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo1; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Click on “<i>Start Game</i>” and enjoy.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">You might experience a few problems starting the game. In order not to lose time if you want to fix the problems, try to use every device on a local network, make sure to have a suitable port and try to run the application without firewall (it saved us a couple of times).</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The next step in our development of the program would be to make an easier interface, something more user-friendly if we want the game to be more “commercially” attractive.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">For the time being, the communication between all the different features works as the scheme shows us on the picture below.</span></div><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" /> </span> <div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAD5SkvPdX-G70tAQi-hZLy-n0WCI4lXQtIavW2y4Wa_Pt4EcMnrLF7fNrnkUvMdPApjCNV3WyzBKEFUuSvKMtCJG6RkAeduAF66m4beGnytvez6c6Y62R6w0GMqr78YK-PvDT-TtMEz8/s1600/startingGame.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAD5SkvPdX-G70tAQi-hZLy-n0WCI4lXQtIavW2y4Wa_Pt4EcMnrLF7fNrnkUvMdPApjCNV3WyzBKEFUuSvKMtCJG6RkAeduAF66m4beGnytvez6c6Y62R6w0GMqr78YK-PvDT-TtMEz8/s1600/startingGame.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">Sequence diagram of the game</td></tr>
</tbody></table><div class="MsoNormal"><br />
</div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-74710476374964840662011-01-19T05:47:00.001+01:002011-01-19T18:41:03.526+01:00End Course Project 12: Programming the bomb<div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283171636"><span lang="EN-US">1<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">General description</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">One of the most important roles it the Lego Strike game, plays the bomb. It’s an NXT unit equipped with 2 lights (green and red), a touch sensor, a motor, an IR ball and build-in LCD display (see </span><span lang="EN-US">Picture 30 : Bomb unit with active countdown</span><span lang="EN-US">). Lights are used to inform player (Counter Terrorist) if he cuts the right cable. The green light flashes on correct color and the red one on incorrect. Motor has a function of claws which holds to terrorist unit. They open only when the terrorist plants the bomb.</span><br />
<span lang="EN-US"><br />
</span><br />
<span lang="EN-US">The touch sensor is used as a trigger for a state “defusable”. It is important to mention that there was a <b style="mso-bidi-font-weight: normal;">bouncing problem</b> we had to solve. During the drive the IR ball was bouncing on the touch sensor causing it to trigger a defusable state in the wrong moment. There was also the same problem while the bomb was planted and CTU was trying to push the ball off the bomb. We solved this problem by simply giving a 2 seconds delay during which we checked if the touch sensor was pressed again. </span><br />
<span lang="EN-US"><br />
</span></div><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPjlfxraJkDznPckaCOKeQ1NGC-s8jBnCj2UjYhZjH_QBxjnYcOLQxZRnQW-RiUbolRCsr0uDwYUm0xvckLxD-ASpHdRysinxobwpLz2-zPljQxHNidaH7h-ZLgSweFJTT2O3hS4h1E7c/s1600/bomb_code1.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiPjlfxraJkDznPckaCOKeQ1NGC-s8jBnCj2UjYhZjH_QBxjnYcOLQxZRnQW-RiUbolRCsr0uDwYUm0xvckLxD-ASpHdRysinxobwpLz2-zPljQxHNidaH7h-ZLgSweFJTT2O3hS4h1E7c/s1600/bomb_code1.PNG" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><div align="center" class="MsoCaption" style="font-size: medium; text-align: center;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span lang="EN-US">Picture </span><span lang="EN-US">37</span><span lang="EN-US"> : How to give a delay for the touch sensor in order to avoid taking ball bouncing into account</span></div></div></td></tr>
</tbody></table><br />
</div><div class="MsoCaption" style="text-align: center;"><div style="text-align: justify;">When counter terrorist pushes the IR ball from it, the bomb will generate and send the color sequence which is a string of 10 letters [ygbr] where y-yellow, g-green, b-blue, r-red. </div><div style="text-align: justify;"><br />
</div></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">LCD display shows the countdown timer. We used image converter<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn1" name="_ftnref1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[1]</span></span></span></a> which can convert general format images into LeJOS NXJ source code or LeJOS NXT format images and saved them in the source code file. We may use that countdown timer on NTX LCD for further improvements for example we may hide remaining time from game interface so it will be only visible on the bomb.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdTWMEdpPa0Ij-HKduopGAeMjrvLS9Tj1R7EzJW0Di8dszbc3tzeJoeOFKHszyePD3om8i7SZc_B_H6GSMk0ulddF-c50Lc_C1BJ4hFS7M0paYZRO48EOH0l_bmXW_ziKWlO2CeQ8gd1c/s1600/bombDisplay.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdTWMEdpPa0Ij-HKduopGAeMjrvLS9Tj1R7EzJW0Di8dszbc3tzeJoeOFKHszyePD3om8i7SZc_B_H6GSMk0ulddF-c50Lc_C1BJ4hFS7M0paYZRO48EOH0l_bmXW_ziKWlO2CeQ8gd1c/s320/bombDisplay.png" width="317" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><div align="center" class="MsoCaption" style="font-size: medium; text-align: center;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Ref283151678"><span lang="EN-US">Picture </span></a><span lang="EN-US">38</span><span lang="EN-US"> : Bomb unit with active countdown</span></div></div></td></tr>
</tbody></table><br />
<div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/fhvuPbP149E?feature=player_embedded' frameborder='0'></iframe></div><br />
</div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283171637"><span lang="EN-US">2<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Bomb states</span></a></h2></div><div class="MsoNormal"><span lang="EN-US">The bomb is running through different states that are (see also </span><span lang="EN-US">Picture 31: Block diagram of bomb states</span><span lang="EN-US"> and </span><span lang="EN-US">Picture 32: Bomb decision diagram</span><span lang="EN-US">):</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l1 level1 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US">1.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Waiting for PC connection – is passed when there is a connection between host and the bomb (when the game is launched). </span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l1 level1 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US">2.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Waiting for Game Start – is passed when a method recievedNewMessage receives a “GT####” message with the game time in seconds. </span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l1 level1 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US">3.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Waiting for planted – after the game is started, the bomb can explode (random chance or timeout) and can be planted. </span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l1 level1 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US">4.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Waiting for “defusable” – when the bomb is planted it can be set to “defusable” (by pushing the IR ball off) or can explode because of timeout or random chance. </span></div><div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l1 level1 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US">5.<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Waiting for Defuse Sequence (but could explode or be defused)</span></div><div class="MsoNormal" style="page-break-after: avoid; text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoNormal" style="page-break-after: avoid; text-align: justify; text-justify: inter-ideograph;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfabfypBIac0WpAKzS0FjgNpLvioJ3SYeDSE9G-57gWKbGNIwcSMcM88h1F8anwTmQutcBtPi06QRYWV586PCI3FMyalJUsX_JKwDTBCfCVE_bW9VcSFbnIkbKaQoBLXdTUXtnN4jGvSc/s1600/bombDiagram.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjfabfypBIac0WpAKzS0FjgNpLvioJ3SYeDSE9G-57gWKbGNIwcSMcM88h1F8anwTmQutcBtPi06QRYWV586PCI3FMyalJUsX_JKwDTBCfCVE_bW9VcSFbnIkbKaQoBLXdTUXtnN4jGvSc/s1600/bombDiagram.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><div align="center" class="MsoCaption" style="font-size: medium; text-align: center;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Ref283151758"><span lang="EN-US">Picture </span></a><span lang="EN-US">39</span><span lang="EN-US">: Block diagram of bomb states</span></div></div><div class="MsoNormal" style="font-size: medium; page-break-after: avoid; text-align: justify;"></div></td></tr>
</tbody></table><br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxdUef5pZ6cVuD9_MzX8bim-hvMNu6h1avt2TfTPhPsG13zu1zYWwY_SPJGIXm-dMWzCCHq6WutY4xbUL-PbYynD_74Kv1t2j-MO_8eK6OVonmJlrgqnG0KPa11xgSdydaCbPqp7ZuHkM/s1600/bombDecisionDiagram.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgxdUef5pZ6cVuD9_MzX8bim-hvMNu6h1avt2TfTPhPsG13zu1zYWwY_SPJGIXm-dMWzCCHq6WutY4xbUL-PbYynD_74Kv1t2j-MO_8eK6OVonmJlrgqnG0KPa11xgSdydaCbPqp7ZuHkM/s1600/bombDecisionDiagram.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"></span><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-size: small;"><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Ref283151813"><span lang="EN-US">Picture </span></a><span lang="EN-US">40</span><span lang="EN-US">: Bomb decision diagram</span></span></div></td></tr>
</tbody></table></div><div align="center" class="MsoCaption" style="text-align: center;"><br />
</div><div align="center" class="MsoCaption" style="text-align: center;"><br />
</div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283171638"><span lang="EN-US">3<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">The bomb autonomous functions</span></a></h2></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"><h3><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283171639"><span lang="EN-US">3.1<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Chance of explosion</span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">During the game there is a chance that the bomb will explode without warning (sudden death mode). Here are the chances (Default, editable values):</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoListParagraphCxSpFirst" style="mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">For the first half time the chance is 0%</span></div><div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">For next ¾ of time the chance raises to 1%</span></div><div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Between ¾ and 7/8 of game time the chance is 5%</span></div><div class="MsoListParagraphCxSpLast" style="mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">And from 7/8 till 8/8 of game time the chance is 15%</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The source code for Sudden death mode:</span><span lang="EN-US" style="color: black; font-family: 'Courier New';"> <o:p></o:p></span><br />
<span lang="EN-US"><br />
</span></div><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic4A_HARV7th92wyQWwr8e717e2osRKT6kOTes955MQqR5T3E0YO4coEK037EPzZpM5W5WuAyLbkLOJOdW9ECQVZk8L2nhPNL5NrbqLiaHjew55q0UDoN8f7ZTk8t-uMlGZjOOtm-v4T0/s1600/bomb_code2.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEic4A_HARV7th92wyQWwr8e717e2osRKT6kOTes955MQqR5T3E0YO4coEK037EPzZpM5W5WuAyLbkLOJOdW9ECQVZk8L2nhPNL5NrbqLiaHjew55q0UDoN8f7ZTk8t-uMlGZjOOtm-v4T0/s1600/bomb_code2.PNG" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"></span><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-size: small;"><span lang="EN-US">Picture </span><span lang="EN-US">41</span><span lang="EN-US"> : source code for Sudden Death mode</span></span></div></td></tr>
</tbody></table><span class="Apple-style-span" style="font-family: 'Courier New';"><br />
</span></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"><h3><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283171640"><span lang="EN-US">3.2<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Sequence generation / verification</span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">When the bomb is becoming defusable (and each time CTU will cut incorrect cable), it will generate a sequence of randomly placed colors in a string.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Method checkSequence will verify if the cable cut was correct:</span><br />
<span lang="EN-US"><br />
</span></div><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN5RoCZySS9G_nOrloawscE3BUNJffVGknLfzBPQq3rOYW7WpJAYFF-q7yRvYV_8C3kavbgYJCXwU9BVWWENDaD_3YCRcCI_KFcsFmYdrljsBuc7WkSnnbzfMO14f5S-7yMG39YV7aO3c/s1600/bomb_code3.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhN5RoCZySS9G_nOrloawscE3BUNJffVGknLfzBPQq3rOYW7WpJAYFF-q7yRvYV_8C3kavbgYJCXwU9BVWWENDaD_3YCRcCI_KFcsFmYdrljsBuc7WkSnnbzfMO14f5S-7yMG39YV7aO3c/s1600/bomb_code3.PNG" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><div align="center" class="MsoCaption" style="font-size: medium; text-align: center;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span lang="EN-US">Picture </span><span lang="EN-US">42</span><span lang="EN-US"> : checking that the cable cut is correct</span></div></div></td></tr>
</tbody></table></div><br />
<div class="MsoNormal"><br />
</div><div style="mso-element: footnote-list;"><br />
<hr align="left" size="1" width="33%" /><div id="ftn1" style="mso-element: footnote;"><div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref1" name="_ftn1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[1]</span></span></span></span></a><span lang="EN-US"> </span><span lang="EN-US"><a href="http://code.google.com/p/nxtprojects/wiki/NXTImageConverter"><span class="MsoSubtleReference"><span lang="NL" style="text-decoration: none;">http://code.google.com/p/nxtprojects/wiki/NXTImageConverter</span></span></a></span><span lang="NL"><o:p></o:p></span></div></div></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-69072732550717926742011-01-19T05:35:00.000+01:002011-01-19T05:35:13.920+01:00End Course Project 11: Graphical User Interface (GUI) layout<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The general GUI concept for our game was an ongoing process. Generally as a good design practice we have created a clean cut, between the GUI and the Game model. This turned out to be a good idea, since we changed the GUI layout several times during out process. With the GUI clearly decoupled for the model, we could easily experiment and change the without interrupting those working on the game model.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"> <h2 style="background: #DBE5F1; mso-background-themecolor: accent1; mso-background-themetint: 51; text-align: justify; text-justify: inter-ideograph;"><a href="" name="_Toc283171632"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">1<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Early stage layout</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">A GUI was quickly necessary to run different kinds of test, for the widgets, the video streaming, the timer, etc. So we ended up with a first version, still buggy but efficient in its tasks.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgB20YDQi623usjkpE2-N40hUJhBtOP9ShqR5gOI4xobcaAR0DdM5yXgrCoxQah88xSfSD0zbyRzaOK3mLC6X8F1749_Y7w0FXn1tR_PiN82z9pjsoMFt9Ta6a63mBOr75xSDrB-wjGPKI/s1600/displayBug.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgB20YDQi623usjkpE2-N40hUJhBtOP9ShqR5gOI4xobcaAR0DdM5yXgrCoxQah88xSfSD0zbyRzaOK3mLC6X8F1749_Y7w0FXn1tR_PiN82z9pjsoMFt9Ta6a63mBOr75xSDrB-wjGPKI/s640/displayBug.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"><span lang="EN-US">Picture </span><span lang="EN-US"><span>34</span></span><span lang="EN-US"> : Our early stage layout</span></span></td></tr>
</tbody></table><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><span style="mso-ansi-language: FR; mso-bidi-language: AR-SA; mso-fareast-language: FR; mso-no-proof: yes;"><br />
<!--[endif]--></span></div><div align="center" class="MsoCaption" style="text-align: center;"><br />
</div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"> <h2><a href="" name="_Toc283171633"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">2<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Improving the layout</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">In order to achieve a nice layout we have used layout managers. This is always a little troublesome to get right, but there is a well written set of official articles on how to achieve the goals that we wanted<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn1" name="_ftnref1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[1]</span></span><!--[endif]--></span></span></a><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn2" name="_ftnref2" style="mso-footnote-id: ftn2;" title=""><span class="MsoFootnoteReference"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[2]</span></span><!--[endif]--></span></span></a>.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">We mainly used two types of layout managers.</span></div><ul style="margin-top: 0cm;" type="disc"><li class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-top: 0cm; mso-list: l1 level1 lfo2; tab-stops: list 36.0pt; text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Box Layout to achieve the Horizontal layout or the Vertical layout.</span></li>
<li class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-top: 0cm; mso-list: l1 level1 lfo2; tab-stops: list 36.0pt; text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Flow Layout as the std. layout. Where nothing particular was requested</span></li>
</ul><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The final layout ended like the sketch below, mainly based on the BoxLayout.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><table border="1" cellpadding="0" cellspacing="0" class="MsoTableGrid" style="border-bottom-style: none; border-collapse: collapse; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; margin-left: -1.7pt; width: 652px;"><tbody>
<tr style="height: 263.35pt; mso-yfti-firstrow: yes; mso-yfti-irow: 0; mso-yfti-lastrow: yes;"> <td style="border: none; height: 263.35pt; padding: 0cm 1.4pt 0cm 1.4pt; width: 329.15pt;" valign="top" width="439"> <table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2dqr0cSTQZhEoCSnHZ0zsQsmA0Kqwt0V8Al9Gp_27JyS5zJFlFHxIXbmkI_J1ifQds_aVw8JPL2_Eby0QJDHW6-E1vlzCQ5UcZ96PhM2kABFK_5uJ6fl6qNMOUtl3h7EezovFa9hjY8I/s1600/layout.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="300" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi2dqr0cSTQZhEoCSnHZ0zsQsmA0Kqwt0V8Al9Gp_27JyS5zJFlFHxIXbmkI_J1ifQds_aVw8JPL2_Eby0QJDHW6-E1vlzCQ5UcZ96PhM2kABFK_5uJ6fl6qNMOUtl3h7EezovFa9hjY8I/s400/layout.PNG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="border-collapse: collapse; font-size: small;"><span lang="EN-US">Picture </span><span lang="EN-US"><span>35</span></span><span lang="EN-US"> : Sketch for the final layout</span></span></td></tr>
</tbody></table><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; page-break-after: avoid; text-align: justify; text-justify: inter-ideograph;"><span style="mso-ansi-language: FR; mso-bidi-language: AR-SA; mso-fareast-language: FR; mso-no-proof: yes;"><br />
<!--[endif]--></span></div><div align="center" class="MsoCaption" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: center;"><br />
</div></td> <td style="border: none; height: 263.35pt; padding: 0cm 1.4pt 0cm 1.4pt; width: 159.9pt;" valign="top" width="213"> <div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;"><span class="MsoSubtleEmphasis"><span lang="EN-US">Orange Color is Vertical BoxLayout JPanel<o:p></o:p></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;"><span class="MsoSubtleEmphasis"><span lang="EN-US"><br />
</span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm;"><span class="MsoSubtleEmphasis"><span lang="EN-US">Yellow Color is Horizontal BoxLayout JPanel<o:p></o:p></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-indent: -18.0pt;"><!--[if !supportLists]--><span class="MsoSubtleEmphasis"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">1.<span style="font: 7.0pt "Times New Roman";"> </span></span></span></span><!--[endif]--><span class="MsoSubtleEmphasis"><span lang="EN-US"><span style="mso-spacerun: yes;"> </span>Obstacle RadarWidget<o:p></o:p></span></span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-indent: -18.0pt;"><!--[if !supportLists]--><span class="MsoSubtleEmphasis"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">2.<span style="font: 7.0pt "Times New Roman";"> </span></span></span></span><!--[endif]--><span class="MsoSubtleEmphasis"><span lang="EN-US">Streaming Component Widget<o:p></o:p></span></span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-indent: -18.0pt;"><!--[if !supportLists]--><span class="MsoSubtleEmphasis"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">3.<span style="font: 7.0pt "Times New Roman";"> </span></span></span></span><!--[endif]--><span class="MsoSubtleEmphasis"><span lang="EN-US">IR Radar Widget<o:p></o:p></span></span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-indent: -18.0pt;"><!--[if !supportLists]--><span class="MsoSubtleEmphasis"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">4.<span style="font: 7.0pt "Times New Roman";"> </span></span></span></span><!--[endif]--><span class="MsoSubtleEmphasis"><span lang="EN-US">Time Panel<o:p></o:p></span></span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-indent: -18.0pt;"><!--[if !supportLists]--><span class="MsoSubtleEmphasis"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">5.<span style="font: 7.0pt "Times New Roman";"> </span></span></span></span><!--[endif]--><span class="MsoSubtleEmphasis"><span lang="EN-US"><span style="mso-spacerun: yes;"> </span>Info Panel<o:p></o:p></span></span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-indent: -18.0pt;"><!--[if !supportLists]--><span class="MsoSubtleEmphasis"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">6.<span style="font: 7.0pt "Times New Roman";"> </span></span></span></span><!--[endif]--><span class="MsoSubtleEmphasis"><span lang="EN-US">Map Panel<o:p></o:p></span></span></div><div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 36.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l2 level1 lfo3; text-indent: -18.0pt;"><!--[if !supportLists]--><span class="MsoSubtleEmphasis"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">7.<span style="font: 7.0pt "Times New Roman";"> </span></span></span></span><!--[endif]--><span class="MsoSubtleEmphasis"><span lang="EN-US">Wirecut Widget<o:p></o:p></span></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; text-align: justify; text-justify: inter-ideograph;"><br />
</div></td> </tr>
</tbody></table><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The final result of the layout is as shown below, based on the layout above.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMPfjtTr3JxryDbV1Ws4KvrjJmqgLfcfDhlOIVFDRO58eE-rENnwgfdnZJ9mPJ1rMbnyj2Ktuuc6JDHh-cnEnFQO-lyW82zMkc7l2yDVa91cx9cULqtlBrck85ku0rd5FybcN4-PbWbiI/s1600/GameWindowCapture.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMPfjtTr3JxryDbV1Ws4KvrjJmqgLfcfDhlOIVFDRO58eE-rENnwgfdnZJ9mPJ1rMbnyj2Ktuuc6JDHh-cnEnFQO-lyW82zMkc7l2yDVa91cx9cULqtlBrck85ku0rd5FybcN4-PbWbiI/s640/GameWindowCapture.PNG" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"><span lang="EN-US">Picture </span><span lang="EN-US"><span>36</span></span><span lang="EN-US"> : Final layout in action</span></span></td></tr>
</tbody></table><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><br />
</div><div style="mso-element: footnote-list;"> <hr align="left" size="1" width="33%" /> <!--[endif]--> <div id="ftn1" style="mso-element: footnote;"> <div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref1" name="_ftn1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[1]</span></span><!--[endif]--></span></span></span></a><span lang="EN-US"> <a href="http://download.oracle.com/javase/tutorial/uiswing/layout/using.html"><span class="MsoSubtleReference"><span style="text-decoration: none; text-underline: none;">http://download.oracle.com/javase/tutorial/uiswing/layout/using.html</span></span></a></span><span style="mso-ansi-language: FR;"><o:p></o:p></span></div></div><div id="ftn2" style="mso-element: footnote;"> <div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref2" name="_ftn2" style="mso-footnote-id: ftn2;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[2]</span></span><!--[endif]--></span></span></span></a><span class="MsoSubtleReference"><span lang="EN-US"> </span></span><span lang="EN-US"><a href="http://download.oracle.com/javase/tutorial/uiswing/layout/visual.html"><span class="MsoSubtleReference"><span style="text-decoration: none; text-underline: none;">http://download.oracle.com/javase/tutorial/uiswing/layout/visual.html</span></span></a></span><span style="mso-ansi-language: FR;"><o:p></o:p></span></div></div></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-64251850763867532162011-01-19T05:33:00.000+01:002011-01-19T05:33:31.814+01:00End Course Project 10: Designing the widgets<blockquote><i>Widgets are reusable elements of a graphical user interface that displays an information arrangement and provides standardized data manipulation<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn1" name="_ftnref1" title=""><span class="MsoFootnoteReference"><span class="MsoFootnoteReference"><span lang="EN-US">[1]</span></span></span></a>.</i></blockquote><div class="MsoQuote" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">We needed to implement many widgets to make a proper GUI for both players, in order to show them more information -got by the sensors data- that they could just get by the streaming video.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"> <h2 style="background: #DBE5F1; mso-background-themecolor: accent1; mso-background-themetint: 51; text-align: justify; text-justify: inter-ideograph;"><a href="" name="_Toc283171628"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">1<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">IR Radar widget</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">During the early stage of our game design, we needed to detect when the CTU had found and achieved access to the bomb. For this purpose we add the IR ball to the game <span class="MsoSubtleReference">(see </span><span style="mso-field-code: " REF _Ref283165268 \\w \\h \\* MERGEFORMAT ";"><span class="MsoSubtleReference">8.1</span><!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F005200650066003200380033003100360035003200360038000000</w:data> </xml><![endif]--></span><span class="MsoSubtleReference">)</span>. With the IR Ball available in the game it was quite obvious to include a sensor that could detect the presence if a ball. After a little research we found the IR Seeker V2 from Hitechnic<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn2" name="_ftnref2" style="mso-footnote-id: ftn2;" title=""><span class="MsoFootnoteReference"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[2]</span></span><!--[endif]--></span></span></a>. </span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">This sensor could, detect the direction from where the IR light source is coming. This image below is from Hitechnic homepage gave us the inspiration for the IR Radar.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmJHORLdAgyROUQcj3Mc3p0i5GSui5EVrhvU5buKPGSHDcHtYh38wuetLZKk1Iv0TdeObxQxqR1ydi6LW8bIqbpadDftaOCkzXFCQmJ0zTaS8Oj1mOzPz1lCqOGNsWqwdZeAAEO7JvdVU/s1600/irSensor.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="127" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhmJHORLdAgyROUQcj3Mc3p0i5GSui5EVrhvU5buKPGSHDcHtYh38wuetLZKk1Iv0TdeObxQxqR1ydi6LW8bIqbpadDftaOCkzXFCQmJ0zTaS8Oj1mOzPz1lCqOGNsWqwdZeAAEO7JvdVU/s320/irSensor.PNG" width="320" /></a></div><div align="center" class="MsoNormal" style="text-align: center;"><span style="mso-ansi-language: FR; mso-bidi-language: AR-SA; mso-fareast-language: FR; mso-no-proof: yes;"><br />
<!--[endif]--></span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">From the documentation it is stated that two sets of information is available.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">There are 5 sensors in a horizontal row in the sensor. The sensor values can be read directly. The sensor itself derive 1 of 9 possible directions as shown in the image above, form the light intensity in these 5 sensors. This direction can also be read form the sensor.<span style="mso-spacerun: yes;"> </span>From this we sketched our IR Radar Widget.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUMTwFd1VoC_9dFDmjdiCVlMuZYUGlqP_mG31W1WN2l5ShjnyypfEC0rzBLU6uA_sxyDqxiY4bZEHhEwhqbIHG0DzqpUN3JeRUNkS0S4URrFlQRY4yl0zgfiYRcAF9bKDpaPJ2H3eanjc/s1600/irWidget.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjUMTwFd1VoC_9dFDmjdiCVlMuZYUGlqP_mG31W1WN2l5ShjnyypfEC0rzBLU6uA_sxyDqxiY4bZEHhEwhqbIHG0DzqpUN3JeRUNkS0S4URrFlQRY4yl0zgfiYRcAF9bKDpaPJ2H3eanjc/s1600/irWidget.PNG" /></a></div><div align="center" class="MsoNormal" style="text-align: center;"><span style="mso-ansi-language: FR; mso-bidi-language: AR-SA; mso-fareast-language: FR; mso-no-proof: yes;"><br />
<!--[endif]--></span></div><div align="center" class="MsoNormal" style="text-align: center;"><span style="mso-ansi-language: FR; mso-bidi-language: AR-SA; mso-fareast-language: FR; mso-no-proof: yes;"><br />
</span></div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dzJueYcGJaeAODxH4ihyT4_GLOpMrNj1dN0eogiQQFaFYxi8qRX7WVB-EDLccjYF9wkP6d0NRLeOCt9QAyR7g' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div class="separator" style="clear: both; text-align: center;">Testing the new widget and the range of the IR Seeker</div><div align="center" class="MsoNormal" style="text-align: center;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Coding the Radar Widget was fairly straight forward. Half way result can be seen above to the right. At this stage we actually thought we could read the intensity in the direction also, but this was a misunderstanding from the interpretation of the documentation and in the end result direction is only on or off, and only one at a time.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dxSUR6V5V5CWspC1i-HePv3qa1zJsR6wAjjH0UdRjbo2qMSfQZno1DIO0PJiBLAkF6frQA19VqTYkt_hdDoBA' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div class="MsoNormal" style="text-align: center;">Demo of the IR Radar during a game</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US" style="color: red;"><br />
</span></div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"> <h2 style="background: #DBE5F1; mso-background-themecolor: accent1; mso-background-themetint: 51; text-align: justify; text-justify: inter-ideograph;"><a href="" name="_Toc283171629"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">2<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Obstacle radar widget</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">During the early stage of our game design stage it was quite clear that, while driving around in the city with this narrow camera view, we need to assist the player with more information to ease his navigation in the play field. We decided to build classical obstacle radar. Initially there were some, mechanical issues to overcome, e.g. classical radars rotate continuously in the same direction, but with a wire connected to the sensor, we need to switch direction every 360 degrees. For more mechanical info, <span class="MsoSubtleReference">see article 5</span><span style="mso-field-code: " REF _Ref283165352 \\r \\h \\* MERGEFORMAT ";"><span class="MsoSubtleReference">.2.2</span><!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F005200650066003200380033003100360035003300350032000000</w:data> </xml><![endif]--></span><span style="color: blue;">.</span></span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><span style="color: blue;"><br />
</span></span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">We decided that we wanted to give the Obstacle Radar a classical look’n’feel. So a little research on Google, basically just confirmed what we already had in our minds. </span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSdsTKsRLrD8-LTujxPqkrMrxyZFNtqwu5dMdgnutMEfLF4vV1YEyHnKo1AUAfHCESv5eIcPWqD8VQZvVySaWrxGGK8Y5bJPfpr-k8tk_rPUytJOOKjx8GgoPsPHAU38MtJtdGUi98j1g/s1600/radarExamples.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiSdsTKsRLrD8-LTujxPqkrMrxyZFNtqwu5dMdgnutMEfLF4vV1YEyHnKo1AUAfHCESv5eIcPWqD8VQZvVySaWrxGGK8Y5bJPfpr-k8tk_rPUytJOOKjx8GgoPsPHAU38MtJtdGUi98j1g/s1600/radarExamples.PNG" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><div align="center" class="MsoCaption" style="font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"><span lang="EN-US">Picture </span><span lang="EN-US"><span>29</span></span><span lang="EN-US">: A few inspirational examples from making an image search for a radar on Google<span class="MsoFootnoteReference"><span><span class="MsoFootnoteReference"><b><span lang="EN-US" style="color: #365f91; font-family: Calibri, sans-serif; font-size: 8pt; line-height: 12px;"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn3" name="_ftnref3" title="">[3]</a></span></b></span></span></span></span></div></td></tr>
</tbody></table><div class="MsoNormal" style="page-break-after: avoid; text-align: justify; text-justify: inter-ideograph;"><span style="mso-ansi-language: FR; mso-bidi-language: AR-SA; mso-fareast-language: FR; mso-no-proof: yes;"><br />
<!--[endif]--></span></div><div class="MsoCaption" style="text-align: justify;">At the time of the OR widget development it was not decided yet what the final size would be. So it was a requirement that the widget should scale to any size. IT was also know from our lab experiment during our Lab session 2: Experimenting with the ultrasonic sensor<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn4" name="_ftnref4" style="mso-footnote-id: ftn4;" title=""><span class="MsoFootnoteReference"><span style="mso-special-character: footnote;"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[4]</span></span></span></span></a> , that the range is around ~2,5m and no matter what size the final size of the radar was, it should be available for the application creator to scale the range to make the highest resolution of the dots in the radar.</div><div class="MsoCaption" style="text-align: justify;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The interface to use the radar was quite simple. </span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Add the Radar to the GUI. It inherited from JPanel and can be treated as such. Setting up the radar requires only 2 settings from the application GUI:</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US" style="font-family: "Courier New";">setCmToPixelRelation(double factor)<o:p></o:p></span></div><div class="MsoListParagraphCxSpMiddle" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">This factor is used to set a factor of how many pixels should represent the distance 1 cm on the size of the radar. This was a functional solution, but if we should spend more time in improving the radar widget, it would be more use full to set the range of the radar, and then this Cm to Pixel calculation can be calculated automatically. </span></div><div class="MsoListParagraphCxSpMiddle" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US" style="font-family: "Courier New";">setObjectAge(int timeInMs)<o:p></o:p></span></div><div class="MsoListParagraphCxSpLast" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">As it can be seen in the video, the objects detected by the radar, fades as they get older. This setting sets the lifespan of the objects. Setting this to 5000 indicates that instantly an object is added it will appear at full brightness, and the it will laniary fade over the next 5000ms to have the same color as the background, when this occurs it will be removed from the array of objects known by the radar.</span></div><div class="MsoListParagraphCxSpLast" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">To put the radar in action only thing required is to call the function </span><span lang="EN-US" style="font-family: "Courier New";">addObject(int Xcm, int Ycm)</span><span lang="EN-US"> to indicate where there is a new obstacle detected. The rest is handled by the radar.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The final result can be seen below.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirnE0HOZuhRuAtkIveWzkjSVCmyqGpEtMQy4n-uZ87weeiAdnT6o-QDhm4Jt0PSnOApirVc6nbI1TRnfapUnGlaGYXN3n5a7j9DZV3P_oZ7yRdf3uzVYQat4cge2nA4mM0YI-2X9QPvAw/s1600/radarWidget.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEirnE0HOZuhRuAtkIveWzkjSVCmyqGpEtMQy4n-uZ87weeiAdnT6o-QDhm4Jt0PSnOApirVc6nbI1TRnfapUnGlaGYXN3n5a7j9DZV3P_oZ7yRdf3uzVYQat4cge2nA4mM0YI-2X9QPvAw/s1600/radarWidget.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><div align="center" class="MsoCaption" style="font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"><span lang="EN-US">Picture </span><span lang="EN-US"><span>31</span></span><span lang="EN-US"> : Final result for the obstacle radar widget</span></div></td></tr>
</tbody></table><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><span style="mso-ansi-language: FR; mso-bidi-language: AR-SA; mso-fareast-language: FR; mso-no-proof: yes;"><br />
<!--[endif]--></span></div><div class="MsoCaption" style="text-align: justify;">The distance rings all indicate 1 meter. Hence this image if from before we achieved the correct scaling. The actual calculation of the radar dots is done on the brick. It is a simple SIN/COS calculation based on the distance measured by the sensor and the angle measured by the tacho in the LEGO motor. <span class="MsoSubtleReference">(see 7</span><span style="mso-field-code: " REF _Ref283165422 \\r \\h \\* MERGEFORMAT ";"><span class="MsoSubtleReference">.2.1</span></span><span class="MsoSubtleReference"> for the calculation)</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">A last minute improvement on this widget was to overlay the compass direction of the unit. This can also be seen above. To use this function only two functions are required.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoListParagraphCxSpFirst" style="mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US" style="font-family: "Courier New";">setShowCompass(bool enable)<o:p></o:p></span></div><div class="MsoListParagraphCxSpMiddle" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">This function is used to enable the compass feature. It is disabled by default.</span></div><div class="MsoListParagraphCxSpMiddle" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US" style="font-family: "Courier New";">setCompassDirection(int angleDeg)<o:p></o:p></span></div><div class="MsoListParagraphCxSpLast" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">This is used to set the last know direction sent from the unit.</span></div><div class="MsoListParagraphCxSpLast" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">We considered improvements for the Obstacle radar. In most common radars there is a sweep indication of where the scanner is currently searching for obstacles. We considered to add this feature, but were afraid to overload the BT bandwidth by adding another 200-400 mgs/second in order to achieve a fluent correct sweep, so this was omitted. But with more time we could implement a sweep that would simulate the sweep, and only require re sync at every time we switch direction, show should work good enough for a game concept.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2><a href="" name="_Toc283171630"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">3<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Wire cutter widget</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The game was designed to include a bomb and our originally idea was just to present the button press sequence. For the user to remember similar to the image below</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj3VHdVBMMLMHLFfVArkDqJpAuvTV1QbV5qndoZRveCRek43r47s4FFwAyHzqiCmg5nd9sibT5M0sGs_VoSJXAUQC5JQGY2IwpnHiy71wSGzi6P9EL4F7eWNAnvAy_UNvOEzzVOvSvWdw/s1600/360buttons.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhj3VHdVBMMLMHLFfVArkDqJpAuvTV1QbV5qndoZRveCRek43r47s4FFwAyHzqiCmg5nd9sibT5M0sGs_VoSJXAUQC5JQGY2IwpnHiy71wSGzi6P9EL4F7eWNAnvAy_UNvOEzzVOvSvWdw/s1600/360buttons.png" /></a></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">This would have worked perfectly for the game. But we keep thinking that normally (in movies) when you defuse a bomb you have to cut the right wires. So we decided to combine this idée with wire cutting. So instead of pressing a color sequence, you cutting a colored wire sequence. It is the exact same exercise and complexity, but more fun in the game context. </span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">So we found an image of some pretty wires on the net.<span class="MsoFootnoteReference"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn5" name="_ftnref5" style="mso-footnote-id: ftn5;" title="">[5]</a></span></span><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn5" name="_ftnref5" title=""><!--[endif]--></a></span></span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><span class="MsoFootnoteReference"><span class="MsoFootnoteReference"><br />
</span></span></span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlTa8zHbuaI3V0hjS5ovyKTrwxeBJohJrsG1OjhBXOorANDQ8DrKwsQfc5v01G8z_sWDlyYnuwS2-sd1qdFnybsAZe0OmsmzuoSXrvjy8onqGIZ85eiMWisRvvJ1artd028Ghv03DlAHg/s1600/startingPoint.bmp" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="109" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlTa8zHbuaI3V0hjS5ovyKTrwxeBJohJrsG1OjhBXOorANDQ8DrKwsQfc5v01G8z_sWDlyYnuwS2-sd1qdFnybsAZe0OmsmzuoSXrvjy8onqGIZ85eiMWisRvvJ1artd028Ghv03DlAHg/s320/startingPoint.bmp" width="320" /></a></div><div align="center" class="MsoNormal" style="text-align: center;"><span class="Apple-style-span" style="color: blue;"><br />
</span></div><div class="MsoNormal"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">From this image we just did a little make over using GIMP, to achieve the GFX we wanted. And we drew a se of uncut wires and a set of cut wires, in the color range we required. The result can be seen in the two images below.</span></div><div class="separator" style="clear: both; text-align: center;"></div><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBfLuVC6t6YDBpAZob95_PSlz6WvAFmmxd3eCixWH_GXSHgaTzFupnHcrOixD4IYYkCGNtUN6uWnE8iNG6xPUErzYQajMs5HUGohhehR-vxCwqs0f33HD3fW5_GH9Wc-Hw6pLIFFT3xbg/s1600/wires_cutNoCut.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="192" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjBfLuVC6t6YDBpAZob95_PSlz6WvAFmmxd3eCixWH_GXSHgaTzFupnHcrOixD4IYYkCGNtUN6uWnE8iNG6xPUErzYQajMs5HUGohhehR-vxCwqs0f33HD3fW5_GH9Wc-Hw6pLIFFT3xbg/s320/wires_cutNoCut.PNG" width="320" /></a></div><div align="center" class="MsoNormal" style="text-align: center;"><span style="mso-ansi-language: FR; mso-bidi-language: AR-SA; mso-fareast-language: FR; mso-no-proof: yes;"><br />
<!--[endif]--></span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">With this graphics available it was quite simple to show the color sequence generated by the bomb.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The widget only requires a few functions to use it:</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoListParagraphCxSpFirst" style="mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US" style="font-family: "Courier New";">setSequence(String sequence)<o:p></o:p></span></div><div class="MsoListParagraphCxSpMiddle" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The string must consist of the letters g, b, r, y, each representing the next color in the sequence, Green, Blue, Red, and Yellow respectively. The string can be any length from 1 to 10 chars, the widget will adjust accordingly. And the color combination can be any possible combination.</span></div><div class="MsoListParagraphCxSpMiddle" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US" style="font-family: "Courier New";">setShowColor(bool enabled)<o:p></o:p></span></div><div class="MsoListParagraphCxSpMiddle" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">This function will either allow the player to show the colors of the current wires or turn all the wires white. This is used in the game, when the player presses the first color. Then all the wires turn white, and the player is required to remember the rest.</span></div><div class="MsoListParagraphCxSpMiddle" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="mso-list: l2 level1 lfo3; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><!--[if !supportLists]--><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;">·<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US" style="font-family: "Courier New";">nextWireColorCut(char color)<o:p></o:p></span></div><div class="MsoListParagraphCxSpLast" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">This function will just allow the application designer just to forward the color press from the user and the widget will handle the rest. If the color is right, the widget will show the wire as cut.. if it is wrong it will clear the screen and just await a new sequence from the bomb.</span></div><div class="MsoListParagraphCxSpLast" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">One improvement for the architecture of the game should be revised here. Both this widget and the bomb independently do this evaluation of the wire cur, and this could potentially lead to an inconsistent state between the wire cut widget and the bomb. This should in an improved version of the game only be evaluated one place. In our model I would be most appropriate for the bomb to tell if it was a success or not.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The widget in action can be seen in the video below.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dyllMZc4sLCRHDEsIeAJ1EA59W8rSUXV7dNTcu1ooRegoFh-nif6zYMIoMJFZPAInd6AB0GVIwRagnhXx_aoQ' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div class="MsoNormal"><br />
</div><div style="mso-element: footnote-list;"><!--[if !supportFootnotes]--><br clear="all" /> <hr align="left" size="1" width="33%" /> <!--[endif]--> <div id="ftn1" style="mso-element: footnote;"> <div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref1" name="_ftn1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[1]</span></span><!--[endif]--></span></span></span></a><span lang="EN-US"> <a href="http://en.wikipedia.org/wiki/GUI_widget"><span class="MsoSubtleReference"><span style="text-decoration: none; text-underline: none;">http://en.wikipedia.org/wiki/GUI_widget</span></span></a></span><span style="mso-ansi-language: FR;"><o:p></o:p></span></div></div><div id="ftn2" style="mso-element: footnote;"> <div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref2" name="_ftn2" style="mso-footnote-id: ftn2;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[2]</span></span><!--[endif]--></span></span></span></a><span lang="EN-US"> <a href="http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&key=NSK1042"><span class="MsoSubtleReference"><span style="text-decoration: none; text-underline: none;">http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&key=NSK1042</span></span></a></span><span style="mso-ansi-language: FR;"><o:p></o:p></span></div></div><div id="ftn3" style="mso-element: footnote;"> <div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref3" name="_ftn3" style="mso-footnote-id: ftn3;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[3]</span></span><!--[endif]--></span></span></span></a><span lang="EN-US"> <a href="http://www.google.dk/images?q=radar&um=1&ie=UTF-8&source=og&sa=N&hl=da&tab=wi&biw=1358&bih=1128"><span class="MsoSubtleReference"><span style="text-decoration: none; text-underline: none;">http://www.google.dk/images?q=radar&um=1&ie=UTF-8&source=og&sa=N&hl=da&tab=wi&biw=1358&bih=1128</span></span></a></span><span style="mso-ansi-language: FR;"><o:p></o:p></span></div></div><div id="ftn4" style="mso-element: footnote;"> <div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref4" name="_ftn4" style="mso-footnote-id: ftn4;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[4]</span></span><!--[endif]--></span></span></span></a><span lang="EN-US"> <span class="MsoSubtleReference">http://legointernational.blogspot.com/2010/09/lab-session-2-experimenting-with.html</span></span><span style="mso-ansi-language: FR;"><o:p></o:p></span></div></div><div id="ftn5" style="mso-element: footnote;"> <div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref5" name="_ftn5" style="mso-footnote-id: ftn5;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[5]</span></span><!--[endif]--></span></span></span></a><span lang="EN-US"> <a href="http://myg37.com/forums/misc-vendor-items/182792-bettys-garage-grounding-wires.html"><span class="MsoSubtleReference"><span style="text-decoration: none; text-underline: none;">http://myg37.com/forums/misc-vendor-items/182792-bettys-garage-grounding-wires.html</span></span></a></span><span style="mso-ansi-language: FR;"><o:p></o:p></span></div></div></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-42464296478701845632011-01-19T05:10:00.000+01:002011-01-19T05:10:57.826+01:00End Course Project 9: Communication layers<div align="center" class="MsoNormal" style="text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0THhheAj-fVPwfo8jppFtJQ2edgevFYhIVN47zjJKoA_5tTb27bM_RwtRw14jIVMacJQYRxYYQFfoRvPUFFjy2_lqr4-s9nXkHu5KbxeDfUMEFAau5fqXgBWSwXZOQE1MajOnP6IEVDw/s1600/communicationLayers.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj0THhheAj-fVPwfo8jppFtJQ2edgevFYhIVN47zjJKoA_5tTb27bM_RwtRw14jIVMacJQYRxYYQFfoRvPUFFjy2_lqr4-s9nXkHu5KbxeDfUMEFAau5fqXgBWSwXZOQE1MajOnP6IEVDw/s1600/communicationLayers.PNG" /></a></div><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span><br />
<span lang="EN-US">Basically, all the communication lies upon sending and treating strings. The client and the server run thread listening to message incoming from NXT Bricks or other computer and send message according to the previous message received and the commands given by the user.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">This structure that we came up with is exactly the same that the one we designed at first when we created the architecture of the communication layers. The results of such an architecture went better than expected because we thought the Bluetooth would shorten our range of action: it didn’t and we were able to play on the whole playground. Nevertheless, our next step for this project would be to use the Wi-Fi for the communication between the computers and the brick. The smartphones would be the key here and would ensure the Bluetooth communication with the brick with no range problems. This way, we would obtain a more suitable communication.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Besides, we’d like to extend the game for multiplayer purpose and change the “Server-Client” protocol so as to be able to run the server on a different machine and add as many clients (players) as we want on different machines.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Doing all of this would also give a better and easier interface for the user in order to launch the game and settle everything without being forced to follow a intricate procedure as we explain in the “<i>How to start the game</i>” part.</span><br />
<span lang="EN-US"><br />
</span></div><div align="center" class="MsoNormal" style="text-align: center;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBsdk1zMo33ddrxU2UvGDDn_kydNxTElLod24h3RC1AINS6KnP4eyjXrFEWW3rVvbQSKvuAVq-kkUK-pBnXH5gDIfGERCrNrDrB3BH7Wv6_3lvIzIAchKFBphzApu_8g2sCFZc_8vwLMM/s1600/improvedComm.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhBsdk1zMo33ddrxU2UvGDDn_kydNxTElLod24h3RC1AINS6KnP4eyjXrFEWW3rVvbQSKvuAVq-kkUK-pBnXH5gDIfGERCrNrDrB3BH7Wv6_3lvIzIAchKFBphzApu_8g2sCFZc_8vwLMM/s1600/improvedComm.PNG" /></a></div><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">We would end with this structure applying the new strategy. We would have to develop our own Android application in order to do that but this would upgrade considerably the range of the robots and upgrade the setting up for each game. The Android application would ensure a good communication and implement the streaming part in our own way (instead of using a pre-existing software that we used for the project) and get smoother image this way.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">This way, the new structure would allow as many players as the battlefield can support and at least open the game to a lot of new scenarios (leading to game with team, capture the flag mode for example).</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: left; margin-right: 1em; text-align: left;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXBVodiUCF_mWcxwkg2KATvDlE63Aig_V5V7Zhho_0TJXvl3JBvzarjsxzKdsaUxTcw-8fZloO8l-gbwOQJbE1O9V85URTwFvQwz7G5Af_IwQKv3mR0Y1g_b6LNySOMBnYpGbAEIY6Sws/s1600/360pad.png" imageanchor="1" style="clear: left; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" height="176" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhXBVodiUCF_mWcxwkg2KATvDlE63Aig_V5V7Zhho_0TJXvl3JBvzarjsxzKdsaUxTcw-8fZloO8l-gbwOQJbE1O9V85URTwFvQwz7G5Af_IwQKv3mR0Y1g_b6LNySOMBnYpGbAEIY6Sws/s200/360pad.png" width="200" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><div class="MsoCaption"><a href="" name="_Ref283176766"><span lang="EN-US">Picture </span></a><!--[if supportFields]><span
style='mso-bookmark:_Ref283176766'></span><span style='mso-element:field-begin'></span><span
style='mso-bookmark:_Ref283176766'><span lang=EN-US><span
style='mso-spacerun:yes'> </span>SEQ Figure \* ARABIC <span style='mso-element:
field-separator'></span></span></span><![endif]--><span style="mso-bookmark: _Ref283176766;"><span lang="EN-US"><span style="mso-no-proof: yes;">26</span></span></span><!--[if supportFields]><span
style='mso-bookmark:_Ref283176766'></span><span style='mso-element:field-end'></span><![endif]--><span style="mso-bookmark: _Ref283176766;"><span lang="EN-US"> : Microsoft XBox 360 wireless controller</span></span><span style="mso-bookmark: _Ref283176766;"></span><span lang="EN-US" style="font-size: 10.0pt; line-height: 115%; mso-no-proof: yes;"><o:p></o:p></span></div></td></tr>
</tbody></table><span lang="EN-US">In term of communication, something that shouldn’t be forgotten is the way of interacting between the user and the machine (and the NXT brick, obviously). The first device used for controlling the NXTs was the keyboard. Basically, the application handles keyboard events and according to the key pressed, the computer sends commands to the brick.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">This was working properly and the robots were responding quickly but this was not the end, indeed. We wanted to control the robot in a more instinctive way. That’s why we decided to use the Microsoft Xbox 360 wireless controller<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn1" name="_ftnref1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[1]</span></span></span></a> in order to control the robots (see </span><span lang="EN-US">Picture 26 : Microsoft XBox 360 wireless controller</span><span lang="EN-US">).</span></div><div class="MsoNormal"><span lang="EN-US"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" /> </span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The question being would be to ask why using a controller instead of the keyboard. For this, there are several answers but the main one is because we want the game to be immersive. And knowing that our robots only have less than 20 commands available, it was easy to map every command on the controller (thus, it was more comfortable to use according to our own tests and the opinion of other testers). So we mapped the 8 directions on the left stick (and this way, the behavior of the robot was very intuitive), used the colored buttons for defusing purposes, the triggers for changing the speed of the robot and the Start button for planting the bomb.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><table cellpadding="0" cellspacing="0" class="tr-caption-container" style="float: right; margin-left: 1em; text-align: right;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlnZABVik_aV8U1h_SsuaQ422s4f4iogcr3Q-UKygPEQU811V5qRNNvFMqizhZScuUdJ_MkpYx0CCxPWS8PLjAOchbm7H7A44hPZAmxeqBBM4BDtZKP0-Oa0WxEFU2QanQrXpUkARxqc8/s1600/360receiver.png" imageanchor="1" style="clear: right; margin-bottom: 1em; margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlnZABVik_aV8U1h_SsuaQ422s4f4iogcr3Q-UKygPEQU811V5qRNNvFMqizhZScuUdJ_MkpYx0CCxPWS8PLjAOchbm7H7A44hPZAmxeqBBM4BDtZKP0-Oa0WxEFU2QanQrXpUkARxqc8/s1600/360receiver.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"><a href="" name="_Ref283160812"><span lang="EN-US">Picture </span></a><span style="mso-bookmark: _Ref283160812;"><span lang="EN-US"><span style="mso-no-proof: yes;">27</span></span></span><span style="mso-bookmark: _Ref283160812;"><span lang="EN-US"> Wireless gaming receiver</span></span></span></td></tr>
</tbody></table><div style="text-align: -webkit-auto;">In order to make the use of this wireless controller possible, we needed two different things:</div><span lang="EN-US"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;"><br />
</span></span></div><div class="MsoListParagraphCxSpFirst" style="margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">The wireless gaming receiver<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn2" name="_ftnref2" style="mso-footnote-id: ftn2;" title=""><span class="MsoFootnoteReference"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[2]</span></span></span></a> (which is an adapter for PC in order to connect Xbox 360 wireless controller) (</span><span lang="EN-US">Picture 27 : Wireless gaming receiver</span><span lang="EN-US">)</span></div><div class="MsoListParagraphCxSpMiddle" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoListParagraphCxSpMiddle" style="margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">XPadder<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn3" name="_ftnref3" style="mso-footnote-id: ftn3;" title=""><span class="MsoFootnoteReference"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[3]</span></span></span></a> (a software useful for mapping keyboard keys on controller buttons).</span></div><div class="MsoListParagraphCxSpLast" style="text-align: justify; text-justify: inter-ideograph;"><br />
<br />
<br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">So as to explain the mechanisms of XPadder, here’s a picture showing which key was mapped to which button (you’ll have a better idea of how the commands are organized).</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrT-CiJsHsW6bt6BUtPcGv76MhgqI1VqF5XGRileYWivnZoxViqGtpMxR9sStk6fhTNaza8nSbX9N5BcUzY5g79nNRlgdJEXcBeAwSTemviWH7V10JmA_2Z5v00_iS29ufS17jTq5SyUg/s1600/xpadderMap.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjrT-CiJsHsW6bt6BUtPcGv76MhgqI1VqF5XGRileYWivnZoxViqGtpMxR9sStk6fhTNaza8nSbX9N5BcUzY5g79nNRlgdJEXcBeAwSTemviWH7V10JmA_2Z5v00_iS29ufS17jTq5SyUg/s1600/xpadderMap.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><div align="center" class="MsoCaption" style="font-size: medium; text-align: center;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span lang="EN-US">Picture </span><span lang="EN-US">28</span><span lang="EN-US"> XPadder key/button mapping overview</span><span lang="EN-US" style="color: white; font-size: 11pt; font-weight: normal; letter-spacing: 0.75pt; line-height: 17px; text-transform: uppercase;"><o:p></o:p></span></div></div><div style="font-size: medium;"></div></td></tr>
</tbody></table><br />
</div><div style="mso-element: footnote-list;"><hr align="left" size="1" width="33%" /><div id="ftn1" style="mso-element: footnote;"><div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref1" name="_ftn1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[1]</span></span></span></span></a><span lang="EN-US"> Xbox 360 Controller : <a href="http://en.wikipedia.org/wiki/Xbox_360_Controller"><span class="MsoSubtleReference"><span style="text-decoration: none;">http://en.wikipedia.org/wiki/Xbox_360_Controller</span></span></a></span></div></div><div id="ftn2" style="mso-element: footnote;"><div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref2" name="_ftn2" style="mso-footnote-id: ftn2;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[2]</span></span></span></span></a><span lang="EN-US"> Wireless Gaming Receiver: <a href="http://en.wikipedia.org/wiki/Xbox_360_accessories#Wireless_Gaming_Receiver"><span class="MsoSubtleReference"><span style="text-decoration: none;">http://en.wikipedia.org/wiki/Xbox_360_accessories#Wireless_Gaming_Receiver</span></span></a></span></div></div><div id="ftn3" style="mso-element: footnote;"><div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref3" name="_ftn3" style="mso-footnote-id: ftn3;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[3]</span></span></span></span></a><span lang="NL"> XPadder : </span><span lang="EN-US"><a href="http://www.xpadder.com/"><span class="MsoSubtleReference"><span lang="NL" style="text-decoration: none;">http://www.xpadder.com/</span></span></a></span><span lang="NL"><o:p></o:p></span></div></div></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-56984959831236998762011-01-19T04:59:00.000+01:002011-01-19T04:59:23.603+01:00End Course Project 8: CTU and TU programming<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Counter Terrorist and Terrorist Units both have exactly the same program running inside. They have indeed the same mechanical architecture, and have the same external behavior, despite their different goals. What makes them different are the commands input by human players and the fact that the TU carries a bomb trailer that it has to plant (but this last behavior is managed on the computer and bomb unit sides). </span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">We will therefore call both CTU and TU by the name “unit” inside this part.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"> <h2><a href="" name="_Toc283171619"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">1<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Tasks to fulfill</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">A unit has basically two main objectives it has to be able to follow and achieve in real time, i.e. being as fast and reactive as possible:</span></div><div class="MsoListParagraphCxSpFirst" style="mso-list: l1 level1 lfo2; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"></div><ul><li><span lang="EN-US" style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"><span style="mso-list: Ignore;"><span style="font: 7.0pt "Times New Roman";"> </span></span></span><span lang="EN-US">Obey the command sent by the player controlling it</span></li>
<li><span lang="EN-US"></span> Send feedback from the embedded sensors to the player’s computer</li>
</ul><!--[if !supportLists]--><br />
<div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"> <h3><a href="" name="_Toc283171620"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">1.1<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Message Framework</span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">All those processes are largely supported by the Message Framework that makes the Bluetooth communication a smooth task properly handled during the running time. This framework entirely coded for this project - though now usable for any other project involving BT communication with Lejos- is described in another part of this report <span class="MsoSubtleReference">(see the article 5. </span></span><span lang="EN-US"><span style="mso-field-code: " REF _Ref283167819 \\h \\* MERGEFORMAT ";"><span class="MsoSubtleReference">Message framework</span><!--[if gte mso 9]><xml> <w:data>08D0C9EA79F9BACE118C8200AA004BA90B02000000080000000E0000005F005200650066003200380033003100360037003800310039000000</w:data> </xml><![endif]--></span><span class="MsoSubtleReference">).</span></span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><span class="MsoSubtleReference"><br />
</span></span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">To provide the reader with an idea of how easy it is to communicate with a robot and a computer, below are some examples of how we use this protocol layer. The idea is always to get an instance of the same message framework that is instantiated as a singleton before listening to messages coming from the computer or sending some data back. The singleton makes sure that the framework is not instantiated more than once for memory and running time efficiency which is precious when we deal with embedded systems.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"> <h3><a href="" name="_Toc283171621"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">1.2<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">React to player’s orders</span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">At the beginning of the main program, we instantiate the message framework and add a listener. So each time a message is send by a computer to the brick, the listener will catch it and then process it.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The orders given by a player to its linked unit are only about the driving part of the robot. We therefore just listen for steering instructions, and if the unit has to increase or decrease its speed or stop. For this purpose, we get and analyze strings received on the brick, and then apply a command using the Lejos Pilot class. A command can be interrupted at any time by a newly received one so the unit is as responsive as possible and the player can control it more intuitively. </span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The decision of using the Pilot class made sense since it enables a smooth steering using the servomotors, the size of the wheels and the central turning position of the robot in order to get a parallel driving car doing accurate turns.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQupEHtV5oGCMndZCQsgKISlOxZIoAJx1t5FHcd9VfEYKzlK2ATiQvFlwhfp4TTL2TdwE13qdcixx0qcq2Moz7YzjUi74lUt2ppD2qdHDNNWoti5WhFELbor7D62c_6YS3ePfo2Bi0LvE/s1600/messageFM_listener.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjQupEHtV5oGCMndZCQsgKISlOxZIoAJx1t5FHcd9VfEYKzlK2ATiQvFlwhfp4TTL2TdwE13qdcixx0qcq2Moz7YzjUi74lUt2ppD2qdHDNNWoti5WhFELbor7D62c_6YS3ePfo2Bi0LvE/s1600/messageFM_listener.jpg" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"><span lang="EN-US">Picture </span><span lang="EN-US"><span>23</span></span><span lang="EN-US"> : Simplicity of using the message framework - get its instance, create a listener and then read the messages</span></span></td></tr>
</tbody></table><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><span style="mso-ansi-language: FR; mso-bidi-language: AR-SA; mso-fareast-language: FR; mso-no-proof: yes;"><br />
<!--[endif]--></span></div><div align="center" class="MsoCaption" style="text-align: center;"><br />
</div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"> <h3><a href="" name="_Toc283171622"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">1.3<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Send data to the player’s computer</span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Units have to constantly send data get by each of its sensors to the computer controlling it, in order to display them on the player’s screen. </span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="page-break-after: avoid; text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Once again, the message framework is called, and we do so for each single string of data we wish to send in real time. Depending on the case, we may prefer to send a new data only if it is different from the previous one, so as to not overload the communication channel between the unit and the computer.</span></div><div class="MsoNormal" style="page-break-after: avoid; text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="page-break-after: avoid; text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Messages are formatted in a predetermined way so the computer always knows from which sensor they come from.</span></div><div class="MsoNormal" style="page-break-after: avoid; text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsGN5otKDiqtkKSSGoSfcDh4GUmSSbfWrvPlNBKMINSj0B4yd5YwIXsJErggByCUDeDVmE4TrBRJp5T5UThnAo39yz1a8Xq21uPkGPUnrQiiPaz8rkll6m6A6rg8Wep_DUI0g2B3JBSgI/s1600/messageFM_sender.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgsGN5otKDiqtkKSSGoSfcDh4GUmSSbfWrvPlNBKMINSj0B4yd5YwIXsJErggByCUDeDVmE4TrBRJp5T5UThnAo39yz1a8Xq21uPkGPUnrQiiPaz8rkll6m6A6rg8Wep_DUI0g2B3JBSgI/s1600/messageFM_sender.jpg" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><div align="center" class="MsoCaption" style="font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"><span lang="EN-US">Picture </span><span lang="EN-US"><span>24</span></span><span lang="EN-US"> : Sending data from the IRSeeker over bluetooth through the message framework</span></div></td></tr>
</tbody></table><div align="center" class="MsoCaption" style="text-align: center;"><br />
</div><div class="MsoNormal"><br />
</div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"> <h2><a href="" name="_Toc283171623"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">2<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Threading</span></a></h2></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"> <h3><a href="" name="_Toc283171624"></a><a href="" name="_Ref283165422"><span style="mso-bookmark: _Toc283171624;"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">2.1<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">One task – one module</span></span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Threads are the key solution in managing all those tasks in real time. We have basically four main threads (sometimes split in other sub-threads): one for each sensor -IRSeeker, Compass and Ultrasound- and one for responding to the player’s orders. </span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Each sensor thread has the objective of sending as many data read by the corresponding sensor to the computer. For the compass sensor, we send the last value in degree (0 to 360°) that indicates where north is. For the IRSeeker, we send the new direction (a 0 to 9 integer) where an IR signal has been detected if any, on top of sending the five values (0 to 255) got by the five internal sensors.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">On top of that, the robot emits beeping sounds that get louder and more frequent when the IR sensor is moving closer to the IR ball. This way, each player gets a <b style="mso-bidi-font-weight: normal;">immediate feedback</b> on what is happening in the game, and even the spectator can have a good idea of the progress of the game since this information is critical (finding the ball being the main goal for the CTU) : the louder the sound is, the more likely the CTU is to win the game.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The case of the Ultrasound sensor is a little more complicated. It uses one thread to autonomously control the motor rotating the turret so the US sensor can detect obstacles with a 360° visible angle. And one more thread to read and send the values, after having converted them in Cartesian coordinates. The unit computes the Cartesian coordinates of an obstacle point detected by doing simple mathematics: this can be deduced thanks to the position of the turret motor and the distance of the obstacle. The point of sending the data into Cartesian coordinates is to display them on a screen using a Cartesian coordinate system, so we can actually see where the obstacles are in relation with the position of the robot (abscissa goes from the left to the right of the unit, while ordinate goes from the back to its front).</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjRmYlNEwSxj2Ql8HmcHGfRyv8fL6oXs4bSfmtm5yTEvCZHO4ePECIKsq7JUIzVtVZG_uotKnBkqgxjf_jMCKN63n8kmdAbaRTE3jEP7_1e-V1SnXZJm3gLkSxmSfBxD2K-1Bg06Qn_sQ/s1600/radarCalculation.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgjRmYlNEwSxj2Ql8HmcHGfRyv8fL6oXs4bSfmtm5yTEvCZHO4ePECIKsq7JUIzVtVZG_uotKnBkqgxjf_jMCKN63n8kmdAbaRTE3jEP7_1e-V1SnXZJm3gLkSxmSfBxD2K-1Bg06Qn_sQ/s1600/radarCalculation.PNG" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"><span lang="EN-US">Picture </span><span lang="EN-US"><span>24</span></span><span lang="EN-US"> : computing the Cartesian Coordinates for the radar, based on the distance to the obstacle and the angle of the motor</span></span></td></tr>
</tbody></table><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><br />
</div><div class="MsoNormal"><br />
</div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"> <h3><a href="" name="_Toc283171625"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">2.2<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Towards a subsumption architecture</span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">All the sensors part is then autonomously managed by the unit, even if it does not always result in a direct behavior one can observe by looking at the robot. Since those behaviors are in no way interfering with each other (except for the Bluetooth communication – but this is handled by the message framework), it was not necessary to prioritize them: no thread gets access to another thread’s sensor or actuator.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">However, our implementation is –in its current state- ready to fully handle complete autonomous behavior-based robot with a subsumption architecture if deemed desirable. This will be relevant when it comes to program an autonomous decoy wandering in the city and looking for the bomb. Since we already take care of managing different threads and that the overall more complex behavior (admittedly not fully autonomous yet) is already split into many simple behaviors and independent modules, it would be possible to implement Rodney Brooks’ paradigm<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn1" name="_ftnref1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[1]</span></span><!--[endif]--></span></span></a>, relevant for such a real-time system asking for robustness with multiple goals and sensors<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn2" name="_ftnref2" style="mso-footnote-id: ftn2;" title=""><span class="MsoFootnoteReference"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[2]</span></span><!--[endif]--></span></span></a>.</span></div><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" /> </span> <div class="MsoNormal"><br />
</div><div style="mso-element: footnote-list;"><!--[if !supportFootnotes]--><br clear="all" /> <hr align="left" size="1" width="33%" /> <!--[endif]--> <div id="ftn1" style="mso-element: footnote;"> <div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref1" name="_ftn1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[1]</span></span><!--[endif]--></span></span></span></a><span lang="EN-US"> Subsumption architecture : <a href="http://en.wikipedia.org/wiki/Subsumption_architecture"><span class="MsoSubtleReference"><span style="text-decoration: none; text-underline: none;">http://en.wikipedia.org/wiki/Subsumption_architecture</span></span></a><span class="MsoSubtleReference"><o:p></o:p></span></span></div></div><div id="ftn2" style="mso-element: footnote;"> <div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref2" name="_ftn2" style="mso-footnote-id: ftn2;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[2]</span></span><!--[endif]--></span></span></span></a><span lang="EN-US"> Rodney Brooks MIT AI Memo 864, September 1985 : <a href="http://people.csail.mit.edu/brooks/papers/AIM-864.pdf"><span class="MsoSubtleReference"><span style="text-decoration: none; text-underline: none;">http://people.csail.mit.edu/brooks/papers/AIM-864.pdf</span></span></a></span></div></div></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-43301471622613145152011-01-19T04:54:00.001+01:002011-01-19T04:56:04.086+01:00End Course Project 7: Building the bomb unit<div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283171615"></a><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Ref283165202"><span lang="EN-US">1<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Infrared Ball</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">One important part in our gameplay ideas was to be able to improve the detection of the bomb even when the CTU is not exactly with its camera facing it. This was highly likely to be useful since it is easy to overlook it while crossing a crossroad and missing the bomb that could just be positioned in the dead angle of the robot – and we don’t want the game to be frustrating for the CTU. This would also be a nice feature for further improvements, e.g. if we want to enable the TU to disable the video stream from the CTU – then the CTU would have to rely on other sensors to find its ways to the bomb. Having the opportunity to detect the precise location of the bomb makes it possible to program later an autonomous robot able to find the bomb by itself.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Besides, we needed a way to find when the CTU was next to the bomb so it could then defuse it. For all those reasons, we come with the idea of using an IR ball that emits infrared light in all directions –simulating the heat and electromagnetic field that a bomb would radiate. This ball can be detected by the IRSeeker, placed on top of the bomb unit and then pushed away by the CTU. When the CTU actually manages to push the IR Ball and a touch sensor detects this, that means the CTU is indeed close to the bomb and is ready to defuse it. Then a new gameplay sequence is activated by the game manager (which is in fact the bomb itself).</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The best working solution seemed to use both the IRSeeker and the IRBall<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn1" name="_ftnref1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[1]</span></span></span></a> from HiTechnic, in order to ensure maximum compatibility between the devices. They are both able to run at a modulated mode of 1200Hz, which makes the ball almost the only object that the sensor can see.</span><br />
<span lang="EN-US"><br />
</span></div><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL0AgTl8N7a831a3F0NBtf3J1r32O7vJgAcB8ak76GerqNGbNUEaRzpIGz1qUIcH_J-UoCcncotuLDDIbeBHEIvlcll2Mjf_X4xmIN7T-tpul44cL0lUD8THmKPbUCBiHjObrnnKVnDdo/s1600/IMAG0236.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="191" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiL0AgTl8N7a831a3F0NBtf3J1r32O7vJgAcB8ak76GerqNGbNUEaRzpIGz1qUIcH_J-UoCcncotuLDDIbeBHEIvlcll2Mjf_X4xmIN7T-tpul44cL0lUD8THmKPbUCBiHjObrnnKVnDdo/s320/IMAG0236.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"><span lang="EN-US">Picture </span><span lang="EN-US">17</span><span lang="EN-US"> : 75mm diameter IR ball from HiTechnic</span></span></td></tr>
</tbody></table></div><div align="center" class="MsoCaption" style="text-align: center;"><br />
</div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283171616"><span lang="EN-US">2<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Bomb trailer</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The bomb unit was designed to be carried by the TU, following it thanks to free wheels –meaning the bomb cannot move by itself. We needed a NXT to display a timer on the bomb and to basically run the whole game by sending information about the current state of the game over Bluetooth. The NXT would also be able to emit sounds of the bomb exploding for instance, and turn on lights depending of different events to get a better feedback of what is happening during the game –and hence adding interest for spectators watching the game.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Besides, the bomb has to be able to attach and detach itself from the unit carrying it. This decision was made because of the limitation of three motors a NXT can control: this was not an option to have the TU grabbing itself the bomb since all its motor ports were already taken. This added furthermore value to the bomb unit and its autonomous role in the game. The bomb unit has to also be steady enough once dropped by the TU so the ball would not fall by a loss of balance.</span><br />
<span lang="EN-US"><br />
</span></div><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnvbZbzIMAcfYhTfVIZGNSUTFdpxWV0zhFltiZfeTmThspXoDUvAVdOhO5aybOutWtYZXsyOuLcCyAo9mAr0sLtvEQeHJwcxZcPYKQ81eoU-VYpebXBMzvdK2crLTt25Utw7tZnErrPRo/s1600/IMAG0171.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="191" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgnvbZbzIMAcfYhTfVIZGNSUTFdpxWV0zhFltiZfeTmThspXoDUvAVdOhO5aybOutWtYZXsyOuLcCyAo9mAr0sLtvEQeHJwcxZcPYKQ81eoU-VYpebXBMzvdK2crLTt25Utw7tZnErrPRo/s320/IMAG0171.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"><span lang="EN-US">Picture </span><span lang="EN-US">18</span><span lang="EN-US"> : Sketch for the bomb trailer representing two possibilities for the ball position</span></span></td></tr>
</tbody></table><br />
</div><div align="center" class="MsoCaption" style="text-align: center;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The IR Ball had to be placed in such way that it was visible from almost everywhere. Moreover, it had to be possible to push it away from its base without too much struggle while not falling too easily during the transport of the bomb unit. The IR Ball had to be mounted on top of a touch sensor so its fall could be detected easily. Finally, the whole unit should take the least possible space and avoid being too heavy to be still carried by the TU.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">All these constraints put together made us design the bomb trailer showed in the pictures below.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHoJ12mfeZtNQ5qrzud3Whyphenhyphenv1VJwLjTBw2vw8I-A88ityGpvdzgM2fJjNg2XBDNcDnf6aOrcBYMDOGAqitpjlKkYibXcHk3l3VMsFMMVUsGrVeOolujtpj9u4SV1HoCVTX9SEBppoal-0/s1600/IMAG0174.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="238" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiHoJ12mfeZtNQ5qrzud3Whyphenhyphenv1VJwLjTBw2vw8I-A88ityGpvdzgM2fJjNg2XBDNcDnf6aOrcBYMDOGAqitpjlKkYibXcHk3l3VMsFMMVUsGrVeOolujtpj9u4SV1HoCVTX9SEBppoal-0/s400/IMAG0174.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><div align="center" class="MsoCaption" style="font-size: medium; text-align: center;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span lang="EN-US">Picture </span><span lang="EN-US">19</span><span lang="EN-US"> : Working on the claw mechanism for the bomb trailer</span></div></div></td></tr>
</tbody></table><br />
</div><div align="center" class="MsoCaption" style="text-align: center;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsGGmCzxwGKTkABWB58L6CaPtiHYXmMC-AsMStraJIULgJlqM7TaGN_AHckXarxOlqRSeSDZ5-nX76NJrOpR9ZyjjbGwu9caJZ7uMNjDUHlr2u_i6ZTqJJCxsuSIAqh8VPYfpOB7BZc1s/s1600/IMAG0182.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="238" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsGGmCzxwGKTkABWB58L6CaPtiHYXmMC-AsMStraJIULgJlqM7TaGN_AHckXarxOlqRSeSDZ5-nX76NJrOpR9ZyjjbGwu9caJZ7uMNjDUHlr2u_i6ZTqJJCxsuSIAqh8VPYfpOB7BZc1s/s400/IMAG0182.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"><span lang="EN-US">Picture </span><span lang="EN-US">20</span><span lang="EN-US"> : Two bomb units, ready to be tested. One can see the touch sensor facing upward on the left unit, and green and red lights next to the NXT bricks. A 100% free wheel had been added to maintain overall stability.</span></span></td></tr>
</tbody></table><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dzC7Tc71yLMh_Xt9GU1riCXbrx477QpZqNq34tpRgYweUwEkQkXO8dtAQUHVne_WmTO_h0bYazTLLfK4iwskQ' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><br />
</div><div align="center" class="MsoNormal" style="text-align: center;"><span class="MsoIntenseReference"><span lang="EN-US">On the above video, we are testing the claw and the ball presence detection<span class="Apple-style-span" style="color: red;"><o:p></o:p></span></span></span><br />
<span class="MsoIntenseReference"><span lang="EN-US" style="color: red;"><br />
</span></span></div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283171617"><span lang="EN-US">3<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Putting all units together</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Final mechanical testing and tuning were made before starting the real programming step. We had to make sure that the bomb unit could grab and follow a TU without the IR Ball falling or being briefly off the touch sensor. </span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">It was only once the bomb unit was build that it was possible to correctly mount the pole spear in front of the CTU, so it could push the ball.</span><br />
<span lang="EN-US"><br />
</span></div><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlkv7fkIms7-BGh92-4qvlG5K-3MGak6yrB3M5NxsUXKvc3JUcQe9sUU6riS0VRnRV9oi3Unnw-TjdEYFQeezvz0jIHARk_7UWgl6309ITdLWrotf8xeA-rzd7B6z-lU-OnOwzIeuTqT8/s1600/Robots+012.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="363" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjlkv7fkIms7-BGh92-4qvlG5K-3MGak6yrB3M5NxsUXKvc3JUcQe9sUU6riS0VRnRV9oi3Unnw-TjdEYFQeezvz0jIHARk_7UWgl6309ITdLWrotf8xeA-rzd7B6z-lU-OnOwzIeuTqT8/s640/Robots+012.jpg" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"><span lang="EN-US">Picture </span><span lang="EN-US">22</span><span lang="EN-US"> : Overall picture with a CTU and the bomb unit planted by a TU; IR Ball is ready to be pushed away.</span></span></td></tr>
</tbody></table></div><div align="center" class="MsoCaption" style="text-align: center;"><br />
</div><div style="mso-element: footnote-list;"><hr align="left" size="1" width="33%" /><div id="ftn1" style="mso-element: footnote;"><div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref1" name="_ftn1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[1]</span></span></span></span></a><span lang="EN-US"> HiTechnic Infrared Electronic Ball : </span></div><div class="MsoFootnoteText"><span lang="EN-US"><a href="http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&key=IRB1005"><span class="MsoSubtleReference"><span style="text-decoration: none;">http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&key=IRB1005</span></span></a><span class="MsoSubtleReference"><o:p></o:p></span></span></div></div></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-567955811132508452011-01-19T04:37:00.000+01:002011-01-19T04:37:23.270+01:00End Course Project 6: Building the robot units - Part II<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Once the first prototype was build, it was necessary to duplicate it in order to get our two rival robots ready to compete and be tested by those of us who needed them for some tests. To get a good idea of what they should finally look like and have all the functionalities ready, we mounted in front of them a wheel on a pole supposed to be the mean with which a Counter Terrorist Unit (CTU) would push the IR Ball away from the bomb unit.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi171pDpwXYTemgdPdH1GVX3uyrt9UM5t_6qmXy7Rkvmn3psJYhqnUukS5iAJeJ7-rCyzY6L-svxrHOg2q9fo2fQwQteSwSClglwSWMo7JDJ2MYNHCuZ-P9_G1vFJLDskTe26QpYpy_qgc/s1600/IMAG0176.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="191" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi171pDpwXYTemgdPdH1GVX3uyrt9UM5t_6qmXy7Rkvmn3psJYhqnUukS5iAJeJ7-rCyzY6L-svxrHOg2q9fo2fQwQteSwSClglwSWMo7JDJ2MYNHCuZ-P9_G1vFJLDskTe26QpYpy_qgc/s320/IMAG0176.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"><span lang="EN-US">Picture </span><span lang="EN-US"><span>12</span></span><span lang="EN-US"> : Two working prototypes, waiting for the first tests</span></span></td></tr>
</tbody></table><div align="center" class="MsoCaption" style="text-align: center;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">One thing among many others we have learned through this course is the <b style="mso-bidi-font-weight: normal;">importance and impact of the physical world</b> one the programming and the final results when we deal with robots. It was therefore mandatory to take our time considering every aspect of our final robot and try to first fix a problem on the actual robot before looking into the code.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"> <h2><a href="" name="_Toc283171606"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">1<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Adjusting the phone and pole</span></a></h2></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"> <h3><a href="" name="_Toc283171607"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">1.1<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Finding the best orientation for the camera</span></a></h3></div><div class="MsoNormal"><span lang="EN-US">Since the first person view with the camera embedded in the phone is a critical part of the gameplay, it was deemed necessary that we spent some time tuning its position on the robot.</span></div><div class="MsoNormal"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">While trying our early version of the program and moving a robot using the video stream on a computer screen, it appeared that having the camera facing a little upward was not a so good idea. Even if it enabled the player to see more of the surrounding environment and buildings, and let him have a clear shot on the bomb, it revealed to be hard driving the robot around. </span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">It is indeed necessary to see as much ground as possible at the same time, to make sure you are running into a low obstacle, and to take better decision while making a turn. This is eventually more intuitive to drive with a camera facing straight in front of you, since it reminds you of driving a real car.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"> <h3><a href="" name="_Toc283171608"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">1.2<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Attaching the pole</span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">We refer to the pole as the LEGO wheel mounted on the end of the forward facing pole. The purpose of this element made for the CTU is to push the IR Ball from the bomb unit in order to get the defuse sequence. To get the good position of this pole, we first had to make sure it was on the same level as the IR Ball. On top of that, it had to be built such as it is not in the camera field of view. This last constraint was also considered while building the bomb unit.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The second thing that has to be taken into account was the centering of the pole in connection to the position of the camera. The camera was already horizontally centered in order to get a better feeling of the driving – so has to be the pole. Indeed, since we cannot see it with the camera, and since the camera is not oriented upward, when the robot is close in front of the bomb, the user can almost not see the IR Ball (see figure below). We therefore had to make sure that the player can always assume he is pushing the ball with the pole when his robot is in front of the bomb and his camera is centered on the bomb itself.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMZiNBju4gbP7vFEY9RZc7kb66-jth2VfXGHMX3LSWoUm-rbniSmsEFLUy7ez1aIo9ESMSHPw8QSN5OLUrPMF5TU4neqszBCAk451K3QT9CLEGtmrLFGaW7T1Jrs52nULcdQsizdz7ie4/s1600/IMAG0237.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="237" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMZiNBju4gbP7vFEY9RZc7kb66-jth2VfXGHMX3LSWoUm-rbniSmsEFLUy7ez1aIo9ESMSHPw8QSN5OLUrPMF5TU4neqszBCAk451K3QT9CLEGtmrLFGaW7T1Jrs52nULcdQsizdz7ie4/s400/IMAG0237.jpg" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"><span lang="EN-US">Picture </span><span lang="EN-US"><span>13</span></span><span lang="EN-US"> : The actual point of view of the CTU while approaching the bomb and being a few centimeters away from pushing the IR Ball</span></span></td></tr>
</tbody></table><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><span style="mso-ansi-language: FR; mso-bidi-language: AR-SA; mso-fareast-language: FR; mso-no-proof: yes;"><br />
<!--[endif]--></span></div><div align="center" class="MsoCaption" style="text-align: center;"><br />
</div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"> <h2><a href="" name="_Toc283171609"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">2<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Mounting and adjusting the sensors</span></a></h2></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"> <h3><a href="" name="_Toc283171610"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">2.1<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Infrared seeker</span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The goal of the Infrared Seeker is to provide the player with the position of the bomb if the IR Ball is in range of the sensor, whereas the camera may still not have located the bomb. This is a really useful data for the CTU player insofar its first person view is quite limited because it is facing forward with a short angle of view, while the IRSeeker can see the ball with an angle of 240° and roughly locate it in one of nine directions, as shown on the figure below<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn1" name="_ftnref1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[1]</span></span><!--[endif]--></span></span></a>.</span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid9qrfI0Vj3V3HZWQfUBZvdwMbm4CeT2BGdSutTAuD6K8vAZQnNC2QE3cDSI4vAu3BlTZV4hjbl57yPrHeEjP2GOQBMwlk52J91jfncl7I_5OBG-aIUsFVKRvxCfLrTX6Twzueq3rNQ9A/s1600/IRSeekerTemplate.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEid9qrfI0Vj3V3HZWQfUBZvdwMbm4CeT2BGdSutTAuD6K8vAZQnNC2QE3cDSI4vAu3BlTZV4hjbl57yPrHeEjP2GOQBMwlk52J91jfncl7I_5OBG-aIUsFVKRvxCfLrTX6Twzueq3rNQ9A/s1600/IRSeekerTemplate.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;"><span lang="EN-US">Picture </span><span lang="EN-US"><span>14</span></span><span lang="EN-US"> : IRSeeker directions (1 is on the left, 9 on the right, and 0 means no signal)</span></span></td></tr>
</tbody></table><div align="center" class="MsoCaption" style="text-align: center;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The IRSeeker sensor is really efficient while used with the IR Ball in modulated mode (AC), even when it is 10 meters far away from it. HiTechinc states:</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; margin-left: 64.8pt; margin-right: 57.6pt; mso-border-left-alt: solid #4F81BD .5pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .5pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 10.0pt 0cm 0cm 10.0pt;"> <div class="MsoIntenseQuote" style="margin-bottom: 0.0001pt; margin-left: 0cm; margin-right: 0cm; margin-top: 10pt; text-align: justify;"><span class="apple-style-span"><span lang="EN-US" style="line-height: 115%; mso-bidi-font-size: 8.5pt;"><i>The sensor will detect modulated IR signals such as those from the HiTechnic IRBall or some IR remote controls. In Modulated mode the sensor will filter out most other IR signals to decrease interference from lights and sunshine for example. The sensor is tuned to square wave signals at 1200Hz.</i></span></span></div></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The obvious position for the sensor on the robot is clearly that it has to be on the same level of the IR Ball and has to have most of its surroundings cleared from any other element of the robot, to be able to detect the ball from most of the nine available directions. It has been placed on top of the phone, a bit shift on the left of the robot center.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"> <h3><a href="" name="_Toc283171611"></a><a href="" name="_Ref283165346"><span style="mso-bookmark: _Ref283165352;"><span style="mso-bookmark: _Toc283171611;"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">2.2<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Ultrasound sensor</span></span></span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The Ultrasound sensor (US Sensor) has been mounted on a rotating turret to detect obstacles, as previously described in the report. Our first testing with the radar widget that displays the surrounding obstacles on the player screen in real time showed us that it detected the pole in front of it. We therefore had to raise it so it was not the case anymore, while making sure that the wires were not interfering with the rotation of the US Sensor and that it did not make it work more loosely.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div style="border-bottom: none; border-left: solid #4F81BD 1.0pt; border-right: none; border-top: solid #4F81BD 1.0pt; mso-border-left-alt: solid #4F81BD .75pt; mso-border-left-themecolor: accent1; mso-border-left-themecolor: accent1; mso-border-top-alt: solid #4F81BD .75pt; mso-border-top-themecolor: accent1; mso-border-top-themecolor: accent1; mso-element: para-border-div; padding: 2.0pt 0cm 0cm 2.0pt;"> <h3><a href="" name="_Toc283171612"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">2.3<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">Compass sensor</span></a></h3></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The idea of integrating a compass sensor on each robot came when we were designing the radar widget. It seemed indeed appropriate to indicate to the player its current direction so he could have a good idea of where the obstacles really are on the radar, on top of knowing approximately where he is on the battlefield. For this purpose, we show on the static map displayed on the screen where north is, while a moving arrow shows north from the robot point of view.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">A compass sensor may be one of the most difficult sensors to place on a robot, because of the magnetic interferences produced by the motors and the NXT brick. As it was first mounted on top of the NXT and one the same level as the motor rotating the US Sensor, we saw in our experiments that there was a “black spot” on the compass display, i.e. an angle of about 90° in which north was not detected at all. It was then necessary to place it higher and as far as possible from any electronic device. Once this was done, the sensor worked perfectly as expected.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"> <h2><a href="" name="_Toc283171613"><span lang="EN-US" style="mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin; mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin;"><span style="mso-list: Ignore;">3<span style="font: 7.0pt "Times New Roman";"> </span></span></span><!--[endif]--><span lang="EN-US">The importance of being sturdy</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The running environment of our robots calls for robust robots able to sustain potential damages due to them running into each other or in the buildings. They also have to endure long runs and many rounds of game before needed to be fixed – which is not always easy when we deal with LEGO (but far from being impossible !). Phone carriage boxes have therefore been reinforced and are no longer loosely attached.<span style="mso-spacerun: yes;"> </span>The pole is mounted so it keeps its horizontality and does not break or bend too much or too easily despite its length while running into the ball.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Tracks are made so they keep parallel and do not work loose as long as possible.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYo_L8S7li_aACteLChFBwm3p61bgBt2fxKRNNmJqgdN5KuunKcVVvDWHZXHD5t2EaTclDFvCC9DIK9Gq8DQYkNMmRuvvgonoL5sH9J-SRa-SNXDqNTntxO_iB7SVi8gi9tLrqz4D6d9o/s1600/IMAG0226.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="400" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhYo_L8S7li_aACteLChFBwm3p61bgBt2fxKRNNmJqgdN5KuunKcVVvDWHZXHD5t2EaTclDFvCC9DIK9Gq8DQYkNMmRuvvgonoL5sH9J-SRa-SNXDqNTntxO_iB7SVi8gi9tLrqz4D6d9o/s400/IMAG0226.jpg" width="341" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><div align="center" class="MsoCaption" style="font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"><span lang="EN-US">Picture </span><span lang="EN-US"><span>15</span></span><span lang="EN-US"> : Final version with all the sensors. From left to right: IRSeeker, Compass sensor and US Sensor.</span></div><div><span lang="EN-US"><br />
</span></div></td></tr>
</tbody></table><div align="center" class="MsoNormal" style="page-break-after: avoid; text-align: center;"><span style="mso-ansi-language: FR; mso-bidi-language: AR-SA; mso-fareast-language: FR; mso-no-proof: yes;"><br />
<!--[endif]--></span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglFvJ3e_u_S0JDUf6Jwrz8XsfEzGi5fV3VfBvVBPKt8Rdk47HMdw7TwzL54Bg9JsGo0hvsg-Fed5b7PCHdcPD7eN5dUJL5MOKY2wpYwE_Rf-Vjl9UUe16gw1CJl_R91br9D11X6xv8yIE/s1600/Robots+005.jpg" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEglFvJ3e_u_S0JDUf6Jwrz8XsfEzGi5fV3VfBvVBPKt8Rdk47HMdw7TwzL54Bg9JsGo0hvsg-Fed5b7PCHdcPD7eN5dUJL5MOKY2wpYwE_Rf-Vjl9UUe16gw1CJl_R91br9D11X6xv8yIE/s320/Robots+005.jpg" width="320" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><div align="center" class="MsoCaption" style="font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"><span lang="EN-US">Picture </span><span lang="EN-US"><span>16</span></span><span lang="EN-US">: Final version with the HTC phone.</span></div><span class="Apple-style-span" style="font-size: small;"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 14px;"></span></span></td></tr>
</tbody></table><div align="center" class="MsoCaption" style="text-align: center;"><br />
</div><div style="mso-element: footnote-list;"><!--[if !supportFootnotes]--><br clear="all" /> <hr align="left" size="1" width="33%" /> <!--[endif]--> <div id="ftn1" style="mso-element: footnote;"> <div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref1" name="_ftn1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span style="mso-special-character: footnote;"><!--[if !supportFootnotes]--><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: "Calibri","sans-serif"; font-size: 10.0pt; line-height: 115%; mso-ansi-language: EN-US; mso-ascii-theme-font: minor-latin; mso-bidi-font-family: "Times New Roman"; mso-bidi-language: EN-US; mso-bidi-theme-font: minor-bidi; mso-fareast-font-family: "Times New Roman"; mso-fareast-language: EN-US; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin;">[1]</span></span><!--[endif]--></span></span></span></a><span lang="EN-US"> Information provided by the HiTechnic webpage which sells this sensor : <a href="http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&key=NSK1042"><span class="MsoSubtleReference"><span style="text-decoration: none; text-underline: none;">http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&key=NSK1042</span></span></a></span></div></div><div id="ftn2" style="mso-element: footnote;"> </div></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-31529399469533087472011-01-19T04:27:00.001+01:002011-01-19T04:28:02.230+01:00End Course Project 5: Message Framework<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">It was clear from the beginning of this project, that one of our big challenges would be connecting all the units, using Bluetooth and handling all these connections in an easy way. </span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">We decided that we needed to implement a BT MessageFramework “BTFW” that would handle this in a convenient way for the units that required sending and received messages to other units.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The constrains for the design of this BTFW is that:</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo1; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">It must provide a Java implementation for the server side</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo1; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">It must provide a Lejos implementation for the NXT brick side</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo1; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">It must support an ASCII level protocol, with a minimum of constrains to what type of messages can be sent. Giving freedom to the application designer to send the messages required for supporting the features in the game.</span></div><div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo1; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">It must very simple to use. And embed all the complexities related to sending and recieving</span></div><div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo1; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: Symbol;">·<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">It must be thread safe.</span></div><div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0cm; margin-left: 54.0pt; margin-right: 0cm; margin-top: 0cm; mso-add-space: auto; mso-list: l0 level1 lfo1; text-align: justify; text-indent: -18.0pt; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">All these goals were achieved. Basically it was implemented using the NXTConnector and wrapping this to make it safe and easy to use. There are a few differences in the implementation of the Lejos and Java side. But it is all contained in the wrapping so they are identical to use on both sides.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US">In order to start the framework, just write:<o:p></o:p></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin: 0cm;"><span lang="EN-US" style="font-family: 'Courier New';">MessageFramework m_mfNxt = new MessageFramework();<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin: 0cm;"><span lang="EN-US" style="font-family: 'Courier New';">m_mfNxt.ConnectToNXT(new NXTInfo(NXTCommFactory.BLUETOOTH, "NAME", "ADDRESS"));<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin: 0cm;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US">To send a message, just write:<o:p></o:p></span></b></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin: 0cm;"><span lang="EN-US" style="font-family: 'Courier New';">LIMessage msg = new LIMessage(LIMessageType.Command, "Hello World");<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin: 0cm;"><span lang="EN-US" style="font-family: 'Courier New';">m_mfNxt.SendMessage(msg);<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin: 0cm;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US">To listen to a message</span></b><span lang="EN-US"> the object that want to get notified, it must implement the interface </span><span lang="EN-US" style="font-family: 'Courier New';">MessageListenerInterface</span><span lang="EN-US">, forcing the programmer to implement a function like below.</span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin: 0cm;"><span lang="EN-US" style="font-family: 'Courier New';">@Override<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin: 0cm;"><span lang="EN-US" style="font-family: 'Courier New';">public void recievedNewMessage(LIMessage msg) {<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin: 0cm;"><span lang="EN-US" style="font-family: 'Courier New';"> System.out.println(new String(msg.getEncodedMsg())); <o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin: 0cm;"><span lang="EN-US" style="font-family: 'Courier New';">}<o:p></o:p></span></div><div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin: 0cm;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">When this is done, the object can register as a listener at the framework.</span><span lang="EN-US" style="font-family: 'Courier New';"><o:p></o:p></span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: 'Courier New';">m_mfNxt.addMessageListener(this);<o:p></o:p></span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US" style="font-family: 'Courier New';"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">This approach required us to invest quit a lot of time in the framework, but it paid back a lot, when we started playing and debugging our game. Everybody was using this one component for communication and all expertise and bugs was contained in this one component and not spread out through our application, which made it fairly simple to adjust and perfect.</span><span lang="EN-US" style="font-family: 'Courier New';"><o:p></o:p></span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Improving the BTMF has currently only on improvement we would like to make. That is going from an only ASCII protocol to a full BYTE level protocol. Currently messages are only allowed to send chars of values 0-9 and a-Z, since we are using STX, ETX and <st1:state w:st="on"><st1:place w:st="on">DEL</st1:place></st1:state> for packet framing purposes. In order to allow for a full byte range supporting framework, we would need to embed a framing layer supporting Byte Stuffing also know as COBS<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn1" name="_ftnref1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[1]</span></span></span></a>.</span></div><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;"><br clear="all" style="mso-special-character: line-break; page-break-before: always;" /> </span> <br />
<div class="MsoNormal"><br />
</div><div style="mso-element: footnote-list;"><br />
<hr align="left" size="1" width="33%" /><div id="ftn1" style="mso-element: footnote;"><div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref1" name="_ftn1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span lang="EN-US"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[1]</span></span></span></span></a><span lang="EN-US"> <a href="http://conferences.sigcomm.org/sigcomm/1997/papers/p062.pdf">http://conferences.sigcomm.org/sigcomm/1997/papers/p062.pdf</a></span><o:p></o:p></div></div></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-8924277387803388542011-01-19T04:24:00.002+01:002011-01-19T04:37:59.314+01:00End course project 4: Mid-Project information<div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283171601"><span lang="EN-US">1<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Definition of used terms</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US"><br />
</span></b></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US">CTU:</span></b><span lang="EN-US"> Counter Terrorist Unit. The robot controlled by one of the two humans players, whose purpose is to find the bomb planted by the terrorist and then defuse it before the end of the timer.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US">TU:</span></b><span lang="EN-US"> Terrorist Unit. The robot controlled by one of the two humans players, whose purpose is to carry and then plant the bomb before the end of the timer.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US">Bomb</span></b><span lang="EN-US">: The NXT unit that carries the IR Ball and represents the bomb transported by the TU. It cannot move by itself, but it autonomously dictates the rules for the whole game.</span><br />
<span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US">IR Ball:</span></b><span lang="EN-US"> The HiTechnic Infrared Ball that emits infrared light and simulates the bomb hold by the Bomb unit, that has to be pushed away by the CTU.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283171602"><span lang="EN-US">2<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">Settling the final rules and gameplay for our game</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US"><br />
</span></b></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US">Terrorist’s goal:<o:p></o:p></span></b></div><div class="MsoNormal" style="margin-left: 35.4pt; text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The main objective of a terrorist is to plant the bomb within the given time. After planting the bomb, he has to protect it from CT until it explodes.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US"><br />
</span></b></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US">Counter Terrorist’s goal:<o:p></o:p></span></b></div><div class="MsoNormal" style="margin-left: 35.4pt; text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">He must push the ball off the bomb to prevent from planting it. If the bomb is already planted, he has to defuse it. </span></div><div class="MsoNormal" style="margin-left: 35.4pt; text-align: justify; text-justify: inter-ideograph;"><br />
</div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">The game starts with a 5 minutes timer (editable). During those 5 minutes TU must plant the bomb. If TU doesn’t plant the bomb within the game time, CTU wins. When the bomb is “planted”, CTU may find and defuse the bomb. IR sensor on CTU can help finding the IR ball. </span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">When the ball is pushed off the bomb it becomes “defusable”, it will also generate random string of 10 letters [ygbr] and send it to CTU. The sequence will be displayed on the screen in a form of cables. CTU will have to remember the color sequence and cut the cables in the right order by pressing the corresponding colored buttons on the controller. As soon as the first color is pressed, the colors will disappear. Each failure will subtract 8-15 seconds from the game time and new sequence will be generated. If the time runs out while the bomb is planted, TU wins. If the right color sequence is given before game time runs out CTU.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivDyJUHjh8NJ77sm6rlZEG7K915QD_dI7yPRVKp5lmy_M1BRzv5gkLGBVLpNSNDcohq-FwKYTBjghexxxt7h6JUc_PVHh9p52zdDcSLN_PU3i_KTjlExJcSFRPt6fErbGoQSws20T9YOc/s1600/gameController.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="251" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEivDyJUHjh8NJ77sm6rlZEG7K915QD_dI7yPRVKp5lmy_M1BRzv5gkLGBVLpNSNDcohq-FwKYTBjghexxxt7h6JUc_PVHh9p52zdDcSLN_PU3i_KTjlExJcSFRPt6fErbGoQSws20T9YOc/s400/gameController.PNG" width="400" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="font-size: small;">Picture 11 : How to control one mobile robot with the pad</span></td></tr>
</tbody></table><div class="MsoNormal"><br />
</div><div style="background: #DBE5F1; border: solid #DBE5F1 3.0pt; mso-background-themecolor: accent1; mso-background-themetint: 51; mso-border-themecolor: accent1; mso-border-themetint: 51; mso-element: para-border-div; padding: 0cm 0cm 0cm 0cm;"><h2><a href="http://www.blogger.com/post-create.g?blogID=1228414716208593321" name="_Toc283171603"><span lang="EN-US">3<span style="font: normal normal normal 7pt/normal 'Times New Roman';"> </span></span><span lang="EN-US">How we have planned and done our work</span></a></h2></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">We always managed to work altogether at the same time and as often as possible in the same location. So the group members participating have -almost- always been Anders Dyhrberg, Guillaume Depoyant, Michal Owsinsky and Michaël Ludmann; that is LEGO International group. Before Christmas holidays we had about a meeting twice a week lasting many hours (usually from mid-afternoon to midnight).</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">During holidays, due to the distance separating our members, we had to organize Skype meetings, where we discussed about each other current advancement in his part of the project, planning new tasks and deadlines, and sometime working together while Skype was on.</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US"><br />
</span></div><div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span lang="EN-US">Starting on the 4<sup>th</sup> of January, we have had a long meeting almost every day until the final deadline that was Thursday, the 13<sup>th</sup> of January 2010. We first worked together in the LEGOLab itself before moving to the place<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn1" name="_ftnref1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[1]</span></span></span></a> where the field used for the game is. Field testing began on Sunday, the 9<sup>th</sup> of January. There was no assignment to give to anyone from one session to another, since we met everyday together during all our free and available time.</span></div><div style="mso-element: footnote-list;"><br />
<div style="text-align: justify;"><br />
</div><div style="text-align: justify;">We have stopped counting hours spent during each session on the project, but an average of eight hours per day could be a good estimate. Those entire reasons boil down to this statement: the next reports are organized differently in a more consistent way regarding the work done. To be absolutely clear, we preferred to split our reports into specific parts of our work. This way, the reader does not have to go back and forth between several pages in order to understand how the message framework is working for instance.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><br />
<hr align="left" size="1" width="33%" /><div id="ftn1" style="mso-element: footnote;"><div class="MsoFootnoteText"><a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftnref1" name="_ftn1" style="mso-footnote-id: ftn1;" title=""><sup><span lang="EN-US"><sup><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[1]</span></sup></span></sup></a><sup><span lang="EN-US"> </span></sup><span lang="EN-US">Rezultat, the company that let us use its playfield : <a href="http://www.rezultat.dk/UNDERHOLDNING/BATTLESTATION/spiltyper.htm"><span class="MsoSubtleReference"><span style="text-decoration: none;">http://www.rezultat.dk/UNDERHOLDNING/BATTLESTATION/spiltyper.htm</span></span></a><span class="MsoSubtleReference"><o:p></o:p></span></span></div></div></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-84225607787411434832010-12-22T21:43:00.010+01:002011-01-19T04:26:00.865+01:00End Course Project 3: Scheduling our work<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; line-height: 18px;">Date: Tuesday, 14. December 2010</span><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; line-height: 18px;"><br />
</span><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; line-height: 18px;"><br />
</span><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; line-height: 18px;">Duration of activity: 2 hours</span></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Group members participating : Michaël Ludmann, Guillaume Depoyant, Anders Dyhrberg</span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; color: #333333; font-family: 'trebuchet ms', verdana, arial, sans-serif; font-size: 13px; line-height: 18px;"><br />
</span><br />
<span class="Apple-style-span"></span><br />
<div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"></span></span></span></span></span></span></span></span></span></div></div></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: large; line-height: 18px;">I. Goals for todays session</span></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><ul><li><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">Define the most important and urgent tasks</span></span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">Define the interdependencies between some of these tasks</span></span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Infer from that a more precise schedule for the next weeks.</span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Discuss about the progress so far</span></span></li>
</ul><br />
<div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;">II. Progress on the software part</span></span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;"><br />
</span></span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;">II. a GUI</span></span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq-Zm2SkTiaTI8_wouzzhfmHO1Qy-uOQvj2J945Bk_HaA9vZRkXphfZO8vh2AH4pYkuInVxEpBYzy3PkqPqn7C80mWkTkiwqcGt-vVtmEOOyTg-OqpJ0OUBiYHnKm6JafvXaUQs9k7C1w-/s1600/frame_lego.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="247" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiq-Zm2SkTiaTI8_wouzzhfmHO1Qy-uOQvj2J945Bk_HaA9vZRkXphfZO8vh2AH4pYkuInVxEpBYzy3PkqPqn7C80mWkTkiwqcGt-vVtmEOOyTg-OqpJ0OUBiYHnKm6JafvXaUQs9k7C1w-/s400/frame_lego.jpg" width="400" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">As we discused it in the last lab report, we made a first shot for the GUI and came out with this structure. A 1280x800 window (the colors are here in order to show how the window is split) in which we'll have:</span></span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"></span></div><ul><li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">The video stream in the teal frame</span></span></span></span></li>
<li><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">The map in the grey frame</span></span></li>
<li><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">The radar in the green frame</span></span></li>
<li><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">The time informations in the red frame</span></span></li>
</ul><div><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">And we still have to discuss about the yellow and blue one but seriously think about the command list and the creation of the perks in order to improve the game experience (but this step will be done after every other step is completely done, of course).</span></span></div><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;"><br />
</span></span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;">II. b Video streaming</span></span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;"><br />
</span></span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"></span></span><br />
<div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US">A main part of our game design was that the players should have a Point Of View “POV” camera in front of the unit. Due to the importance of this component this was the first GUI component we designed. Basically we just wanted to prove the concept, and we figured the easiest way to achieve this feature was to use an HTC desire phone, as we had 3 available of these in the group. To avoid having to do any Android programming also, we scanned through Android Market evaluating 6 different programs that offered Video Streaming from the camera over the network.</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US"><br />
</span></span></div><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"> </span><br />
<div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US">The most suitable one was IP Webcam<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn1" name="_ftnref1" style="mso-footnote-id: ftn1;" title=""><span class="MsoFootnoteReference"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[1]</span></span></span></a>.</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US"><br />
</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US">Problem was including the one we choose, that they all only gave the option to stream it to a browser, and we needed to embed it into our GameGUI. So we basically decided to figure out how to reverse engineer the JavaScript in the web page, and the copy this behavior to embed the stream into out JPanel component.</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US"><br />
</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US">Fortunately our choice had a really simple script implementation.</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US"><br />
</span></span></div><table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfbCl_KbEb5pMXb9kj1Sbn_sKJy3q2Ch-PKo3SVfq9O0g4beujmFs0sICRkwWkoKgAxsTwmOWqM6grJRv1sb571dU3qeYRBQ-fVjBIAjE4ztRf9CNch-OT3U6hQoW9hsxAdxJqPyQKv6s/s1600/ipWebcamCode.PNG" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhfbCl_KbEb5pMXb9kj1Sbn_sKJy3q2Ch-PKo3SVfq9O0g4beujmFs0sICRkwWkoKgAxsTwmOWqM6grJRv1sb571dU3qeYRBQ-fVjBIAjE4ztRf9CNch-OT3U6hQoW9hsxAdxJqPyQKv6s/s1600/ipWebcamCode.PNG" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;"><span class="Apple-style-span" style="color: #222222; font-size: small;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US">Picture 8: Java script we had to reverse engineer</span></span></div></span></td></tr>
</tbody></table><div class="separator" style="clear: both; color: #222222; text-align: center;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"></span></div><div align="center" class="MsoNormal" style="color: #222222; page-break-after: avoid; text-align: center;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><br />
</span></div><div align="center" class="MsoCaption" style="color: #222222; text-align: center;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><br />
</span></div><div align="center" class="MsoCaption" style="color: #222222; text-align: center;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US"><br />
</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US">Clearly the main part of this code is just a clever way of double buffering. And the essence can be boiled down to this link exposing the latest image available from the camera.</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US"><br />
</span></span></div><div align="center" class="MsoNormal" style="color: #222222; text-align: center;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US" style="font-family: 'Courier New';"><IP><PORT>/shot.jpg</span><span lang="EN-US"> (example: <a href="http://192.168.0.139:8000/shot.jpg">http://192.168.0.139:8000/shot.jpg</a>)</span></span></div><div align="center" class="MsoNormal" style="color: #222222; text-align: center;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US"><br />
</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US">Knowing this it was fairly simple to make a component with a thread continuously showing a double buffered presentation of the latest image received. Double as a common technique to avoid image flickering while redrawing the graphics on screen<a href="file:///C:/Users/parapampa/Documents/My%20Dropbox/Embedded%20Agents/Report/20110120_Depoyant_Dyrhberg_Ludmann_Owsinsky_EmbeddedSystems_finalReport.docx#_ftn2" name="_ftnref2" style="mso-footnote-id: ftn2;" title=""><span class="MsoFootnoteReference"><span class="MsoFootnoteReference"><span lang="EN-US" style="font-family: Calibri, sans-serif; font-size: 10pt; line-height: 115%;">[2]</span></span></span></a>. </span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US"><br />
</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US">Even though this was just a simple solution the result was quite impressive. See POV example from the game field below: </span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US"><br />
</span></span></div><div class="separator" style="clear: both; text-align: center;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dxn56fMVU8Y2RW7xZ3stdE7pEH3fMteAJVJvVCJeA0k0C-fa0gFmSU9bg6Cv5kJB7u8aNe-pYGINRaaWqwfWA' class='b-hbp-video b-uploaded' frameborder='0'></iframe></span></div><div class="MsoNormal" style="text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="color: blue;"><br />
</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><b style="mso-bidi-font-weight: normal;"><span lang="EN-US"><span style="color: red;"><br />
</span></span></b></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US">During our testing of the overall game, this component started to cause some disturbances, because every time at associated video feed was not available it was waiting 30 seconds to time out the HTTP request and delaying the startup of the game. </span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US"><br />
</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US">To fix this we added an alternative image every time the video feed was not available or times out. This solved the problem. The alternative image could be anything we just kept it simple:</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US"><br />
</span></span></div><div class="separator" style="clear: both; color: #222222; text-align: center;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8Vfk6NlUmJAVXmOCU6wkr1A-Ea9q5Qmr6bXTUkvnxNH1rUCBVwRpKOSEzOJnuVl5BNkbuY50TzDputL8Clz2rIeF5E-Swjv4l5q4FtQenhDGoyQLjeSfF-XBBmDKIFooE8jrpC94wB-g/s1600/no_connection2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="192" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg8Vfk6NlUmJAVXmOCU6wkr1A-Ea9q5Qmr6bXTUkvnxNH1rUCBVwRpKOSEzOJnuVl5BNkbuY50TzDputL8Clz2rIeF5E-Swjv4l5q4FtQenhDGoyQLjeSfF-XBBmDKIFooE8jrpC94wB-g/s320/no_connection2.png" width="320" /></a></span></div><div align="center" class="MsoNormal" style="color: #222222; text-align: center;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><br />
</span></div><div align="center" class="MsoNormal" style="color: #222222; text-align: center;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><br />
</span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US">There are many possibilities to make this component even better. Both streaming wise if we make our own dedicated Android app, but also by adding a suspension to the camera mount to make it less shaky. But considering that we were only aiming for a proof of concept, we are quite happy with our result. </span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US"><br />
</span></span></div><div class="MsoNormal" style="color: #222222; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US">It is well worth noticing that in order to reuse this component in another context, it would only require adding the component to another GUI, which extends a JPanel and should be treated as such, and just set the IP for the Android Phone with the stream enabled.</span><span lang="EN-US"><o:p></o:p></span></span></div><div style="color: #222222;"><span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><br clear="all" /></span></div></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;">III. Progress on the mechanical prototype</span></span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: large;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">At this point, we believe we have a good working mechanical prototype for a robot unit played by a human (terrorist or counter terrorist - it does not matter since both will be identical).</span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Since last time, we managed to have the robot properly carry a HTC phone in front of itself, with the camera placed in the middle (hence the shift of the phone you can see in the picture bellow) and facing a little upward.</span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Furthermore, the robot has now two more features that are :</span></div><div class="separator" style="clear: both; text-align: justify;"></div><div><ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">A radar turret (ultrasound sensor) moved by one motor. This will enable us to have a display of the surrounding environnement on the GUI of each player, by showing the obstacles around with points on a radar screen.</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">A infrared sensor [3] : this way, each robot will be able to locate the IR bomb from a good distance.</span></li>
</ul></div><br />
<div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7-4TQ865DWxJOsyAXQJtFseg4vjLvzW_3nq4GBO43GtJyLRhFI7CI05HE_T6V1v9VThatAWVJ48dVdAdZOT8TuUlU9at0t9JV4BUV58LkXwb7zBYA8fAChwA-OB9bP2LbF7sSmyW_NL8/s1600/IMAG0142.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="191" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7-4TQ865DWxJOsyAXQJtFseg4vjLvzW_3nq4GBO43GtJyLRhFI7CI05HE_T6V1v9VThatAWVJ48dVdAdZOT8TuUlU9at0t9JV4BUV58LkXwb7zBYA8fAChwA-OB9bP2LbF7sSmyW_NL8/s320/IMAG0142.jpg" width="320" /></a></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">To show the efficency of the prototype, solve some working issues and have a first idea of what we should get as a result, we made a video with the robot moving around while a streaming video is being displayed on a computer screen. </span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">The robot is remote controlled by bluetooth using an other HTC Desire mobile phone that runs an official application made by the LEGO Company, namely MINDdroid [4]. We needed for this purpose to flash the NXT brick with the official LEGO NXT Firmware. To move the robot, we simply need to move the phone that use the internal accelerometer as a remote control.</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">The video feed is streamed by the mounted HTC Desire phone that runs the application IPWebcam [5]. The wifi connected computer displays the feed thanks to a java applet in a web browser.</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dwOEKU6ZCT-xyorWjHLHKRYqcA4KZKBLjX3nNTEBqQqwzxJ5hjaCy-FYwmYLqzoMrw0JLwNqdhwNKetpYlBpw' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dzdouEHaKWBa1g0AP9hVy4_wfbdInDvunc8fB2HkhCp2-B-D9agaXHc20Pl5my1GzsNwmVRgg0muHcozQuAWg' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;"><span class="Apple-style-span" style="font-size: small;"><br />
</span></span></span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-size: large;">IV. Assignements for next session</span></span></span></span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">Skype meeting scheduled on Monday, the 27th of December 2010.</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">Tasks : </span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6IfirR7S24xQ-o8W_HoZG9Eo7hLHsGOn6aTuEwUFIhuqa8Xx2wKkaP96wcddWMcoWmsXXZFyLG9YNt0bzX0UAy2LgKj0YPYgseNBQh4jAsR2Ifo8J-CE-SmyDqnG59y0qxUzycNur0tU/s1600/IMAG0249.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="191" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi6IfirR7S24xQ-o8W_HoZG9Eo7hLHsGOn6aTuEwUFIhuqa8Xx2wKkaP96wcddWMcoWmsXXZFyLG9YNt0bzX0UAy2LgKj0YPYgseNBQh4jAsR2Ifo8J-CE-SmyDqnG59y0qxUzycNur0tU/s320/IMAG0249.jpg" width="320" /></a></div><span class="Apple-style-span" style="color: #222222; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-size: large;"><br />
</span></span></span></span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-size: large;"><br />
</span></span></span></span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="font-size: medium;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-size: large;">VI. References</span></span></span></span></span></span></div><div style="font-size: medium;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-size: large;"><br />
</span></span></span></span></span></span></div><div style="font-size: medium;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-size: large;"><span class="Apple-style-span" style="color: black; font-family: 'Times New Roman'; font-size: small; line-height: normal;"></span></span></span></span></span></span></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div><div id="ftn1"><div class="MsoNormal" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="MsoFootnoteReference"><span lang="EN-US">[1] </span></span><span lang="EN-US"><a href="http://www.addictivetips.com/mobile/ip-webcam-turn-your-android-phone-into-live-spy-webcam/"><span class="MsoSubtleReference"><span style="text-decoration: none;">http://www.addictivetips.com/mobile/ip-webcam-turn-your-android-phone-into-live-spy-webcam/</span></span></a></span></span></span></span></span></span></span></span></div></div><div id="ftn2"><div class="MsoFootnoteText" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span lang="EN-US">[2] <span class="MsoSubtleReference"><span style="text-decoration: none;"><a href="http://download.oracle.com/javase/tutorial/extra/fullscreen/doublebuf.html">http://download.oracle.com/javase/tutorial/extra/fullscreen/doublebuf.html</a></span></span></span></span></span></span></span></span></span></span></div></div></div></div></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;">[3] HiTechnic IR Seeker V2 : </span></span><a href="http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&key=NSK1042">http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&key=NSK1042</a></span></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left;">[4] MINDdroid Android application by LEGO : <a href="http://mindstorms.lego.com/en-us/News/ReadMore/Default.aspx?id=227417">http://mindstorms.lego.com/en-us/News/ReadMore/Default.aspx?id=227417</a></div><div style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: left;">[5] IPWebcam Android application by PAS : <a href="http://www.appbrain.com/app/ip-webcam/com.pas.webcam">http://www.appbrain.com/app/ip-webcam/com.pas.webcam</a></div></div></div></div></div></div></div></div></div></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-87371069170735328602010-12-22T19:04:00.005+01:002011-01-19T04:39:21.026+01:00End Course Project 2: Breaking down the tasks<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Date: 9. December 2010</span><br />
<br />
<div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Duration of activity: 6 hours</span></div></div></div></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Group members participating : Michaël Ludmann, Guillaume Depoyant, </span><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Anders Dyhrberg, Michal Owsinski</span></div></div></div></div></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="font-size: 21px; line-height: 18px;"><br />
</span></span></div></div></div></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"></span></span></span></span></span></span></span></span></div></div><div style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: small; line-height: normal;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;">I. Todays topic "</span></span></span></span></span></span></span></span></span><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="font-size: 21px; line-height: 18px;">Breaking down the tasks"</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span"><span class="Apple-style-span" style="line-height: 18px;">After a very positive start on the assignment last time distributing tasks to everybody. We realized that we maybe should apply a more systematic approach. We started by creating a system over view identifying all the required interfaces, to figure out their individual requirements, in order to get a total overview of the total complexity and give an estimate of the required tiem an effort we need to put in to this assignment to complete it in due time.</span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="font-size: large;"><span class="Apple-style-span" style="line-height: 18px;">II. Goals for todays session</span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span"><span class="Apple-style-span" style="line-height: 18px;">There are 2 main goals for today.</span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><ul><li><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">a) Get a complete overview of the system, identify and specify all interface</span></span></li>
<li><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">b) Identify and distribute the tasks required solved for next session. </span></span></li>
</ul><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: large;">II.a System Overview</span></span></span></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">This is currently our expected overall system architeture</span></span></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXw4FwmqCB_X-3cISrVBLnwWjwTvT35Vyyq85djzbztoqMvDgW4L8-LgSIW_-SreYwZftvC2FOG7OBVurcwtNPwSX_N7lTXE_eyhRF8bewONOC8IIUTncFos8G11ZvhKjqD30ir5Mt4Lw/s1600/System_Overview_rev1.JPG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="369" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiXw4FwmqCB_X-3cISrVBLnwWjwTvT35Vyyq85djzbztoqMvDgW4L8-LgSIW_-SreYwZftvC2FOG7OBVurcwtNPwSX_N7lTXE_eyhRF8bewONOC8IIUTncFos8G11ZvhKjqD30ir5Mt4Lw/s640/System_Overview_rev1.JPG" width="640" /></a></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">The following communication interfaces have been identified:</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">I1.a "XBOX controller connection, protocol unknown between Player 1 and PC 1</span></span></li>
<ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;">This interface is a wireless communication interface between the xbox controler and the PC. This is provided byt the vendoe and is not requiring any work form our part. But we are restricted to to use the dongles following the controllers since this is an non standard interface.</span></li>
</ul></ul><ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">I1.b "XBOX controller connection, protocol unknown between Player 2 and PC 2"</span></span></li>
<ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">Se description for I1.a</span></span></li>
</ul></ul><ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">I2.a "Wireless Ethernet between Terrorist Unit Android mobilephone and PC 1"</span></span></li>
<ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">This interface is a wireless Ethernet connection between the Android Mobile Phone and the pc. PC and the phone has to be on the same network on order to make this work as simple as possible. There must be a wireless access point for the Android phone to connect to. The Interface will for the moment only be used for the phone to stream images to the PC to enable the player to control the unit.</span></span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">OPTIONAL: One optional idea, we have but don't expect to have time for is to extend this interface to include the unit drive control information. We will </span></span></li>
</ul></ul><ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">I2.b "Wireless Ethernet between Counter Terrorist Unit Android mobilephone and PC 2"</span></span></li>
<ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">Se description for I2.a</span></span></li>
</ul></ul><ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">I3.a </span></span><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;">"Bluetooth connection between Terrorist Unit NXT brick and PC 1"</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">I3.b "Bluetooth connection between Counter Terrorist Unit NXT brick and PC 2"</span></span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">I4 </span></span><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif; line-height: 18px;">"Bluetooth connection between Bomb Unit NXT brick and PC 1"</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">I5 "Ethernet connection between PC 1 and PC 2"</span></span></li>
</ul><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div></div></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="color: black; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="font-family: 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><br />
</b></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div></div><div style="font-family: 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Key Issues Identified in our last session:</b></span></div></div></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">To deal with streaming the camera images to the computers while displaying informations about the sensors readings on players screens and allowing them to control the robots in real time. (Will require dedicated SW for the Android Phones)</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We need to implement a GamePad driver for the PC to control the units. (This is fairly easily achieved using key mapping on the PC. Mapping GamePad press to Keyboard Press)</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The mechanical release of the BOMB from the terrorist unit could turn out to be problematic. Same could the for the deactivation mechanized used by the CTU.</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We would have to experiment with the game play in order to keep it balanced, and fun for all players.</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We have to make a program for the PC side to show the Video Stream from the robots.</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We need to find/design a god play field for the game. We currently are expecting to use a city model available to us, used for tank strategy game[2].</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">(Optional control feature) An obvious extension to the game would be to use the Wireless Ethernet on the camera phones to control the robot, by forward the instructions from to NXT using bluetooth, in order to extend the range from theoreticaly 10m to 100m.</span></li>
</ul><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: large; font-weight: normal; line-height: 18px;">II.b Graphical User Interface</span></b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: large; font-weight: normal; line-height: 18px;"><br />
</span></b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The graphical user interface would be, according to our first drafts, split in several parts as the prototype we draw on the board shows in the picture below.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6GGnuVA7Zyi57QFZol9dD8XeCBKuWDVYz_9ZFh31OyAYIgGdb_D-_Y2mZbfrvFUxFN9RTx_3IUUkM7WPW0mf73PqmQNYUmS2EvkZ3V1STcguMQNhlESTBGOaCO8y-Q44EOJzGZgd-qLI/s1600/IMAG0244.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="191" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6GGnuVA7Zyi57QFZol9dD8XeCBKuWDVYz_9ZFh31OyAYIgGdb_D-_Y2mZbfrvFUxFN9RTx_3IUUkM7WPW0mf73PqmQNYUmS2EvkZ3V1STcguMQNhlESTBGOaCO8y-Q44EOJzGZgd-qLI/s320/IMAG0244.jpg" width="320" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">On the left would stand the two biggest frames containing the video stream coming from the phone attached to the robot we're controlling with the machine (terrorist or counter terrorist) and just below, a map of the field in order to have some hindsight and maybe elaborate few strategies. Thus, the left part is the visual part: it gives us all that we could see if we were actually on the filed trying to plant or defuse bombs.</span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The right part is a little bit smaller and is designed to display all the informations about the running game. The major things to display are:</span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"></span></div><ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The time left for the game;</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The status of the bomb ("not yet planted", "planted", "defused")</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The goals of the current player</span></li>
</ul><div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The other spaces are not yet defined because we have a lot of ideas and shouldn't put them all for clarity purpose. But we thought about a radar based on the ultrasonic sensor, a picture mapping the joypad to actions and even trying to implement some perks for each player and design a frame in order to visualize/use them.</span></div><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-family: 'Times New Roman';"></span></span><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: large; font-weight: normal; line-height: 18px;">II.c Bomb unit</span></b></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"></span></span></span><br />
<div class="MsoNormal" style="text-align: justify; text-justify: inter-ideograph;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span lang="EN-US">So far, we have established what we think should be all the use cases for the bomb unit and its role and place in the communication protocol.<o:p></o:p></span></span></span></span></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: red; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div class="separator" style="clear: both; text-align: center;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-KKLH2xyuXDhf-ufJlOcX_eOYFvSZ-6TKB6gp2Hr3lOFR5PNh20Bo47hQ0BKlw1iDViG4LI8Py5gBpKg60ZW2dq9UJShKCvQMWsvvS3V3zVaNA7uq6bchG1KqzkuBglWEdLpMuIRYce8/s1600/IMAG0242.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh-KKLH2xyuXDhf-ufJlOcX_eOYFvSZ-6TKB6gp2Hr3lOFR5PNh20Bo47hQ0BKlw1iDViG4LI8Py5gBpKg60ZW2dq9UJShKCvQMWsvvS3V3zVaNA7uq6bchG1KqzkuBglWEdLpMuIRYce8/s320/IMAG0242.jpg" width="191" /></a></span></div><br />
<div class="separator" style="clear: both; text-align: center;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAXk89ND2emiD1D9Ph8022SKa0YpHKqPBPe4yi3Lfr9MembPwJP-mcKSmGarygRs_z57Im9R40kw0bMcQfYmj05VOlD13o1Zz6Eiib-bTwIRB-Kc7j0Y7j_Inu6syEVMHPukuA89ibRjo/s1600/IMAG0243.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="191" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhAXk89ND2emiD1D9Ph8022SKa0YpHKqPBPe4yi3Lfr9MembPwJP-mcKSmGarygRs_z57Im9R40kw0bMcQfYmj05VOlD13o1Zz6Eiib-bTwIRB-Kc7j0Y7j_Inu6syEVMHPukuA89ibRjo/s320/IMAG0243.jpg" width="320" /></a></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></span></div><div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></span></div></div></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: large; font-weight: normal; line-height: 18px;">II.c Assignement for next session</span></b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: large; font-weight: normal; line-height: 18px;"><br />
</span></b></span></div></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Ludmann and Dyhrberg:</b> Experiment with different pre built Android programs from Android to stream video from an android phone to the PC.</span></div></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Ludmann:</b> Continue working on the player Controlled Vehicle</span></div></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"><b>Depoyant: </b></span></span><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Start working on the PC player interface, base on the framework Dyhrnberg made at an earlier lab session to test the Bluetooth logger</span></div></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"><b>Owsinski: </b>Start working on the bomb</span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"><br />
</span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"><br />
</span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;">III. Prototype and discussions</span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><br />
</span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span" style="color: black; font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal;"><b><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: large; font-weight: normal; line-height: 18px;">III.a. </span></b></span></span></span><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;">Mechanical prototype of one robot</span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;"><br />
</span><br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">For this session, a first prototype has been build. This one is about one of the robots played by a human player. At this time, we only have the very basis of such a robot, that is :</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">a tracked vehicle :</span></span></li>
</ul><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvviXftXvAz87mSq6FIruVAALIdXUYshYv1FvyMZyGOWsTgfdT2EWFgL9-L4-8ZqAPFe134LXYa9FbgxkSM-wnuZBmoeW_Zc13hullFMrPFnULoKL0wPl-27BObcuy-Bc_9WejIskyW58/s1600/IMAG0039.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgvviXftXvAz87mSq6FIruVAALIdXUYshYv1FvyMZyGOWsTgfdT2EWFgL9-L4-8ZqAPFe134LXYa9FbgxkSM-wnuZBmoeW_Zc13hullFMrPFnULoKL0wPl-27BObcuy-Bc_9WejIskyW58/s320/IMAG0039.jpg" width="191" /></a></div><div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">a way to mount a HTC desire phone in front of it. Only the part able to carry the phone has been (roughly) built :</span></span></li>
</ul><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAO-FzeUw40PaPRhHAfo0S4dg51vwKj7E_CZOYpCg_fhNT9sx-kg0i2u580bBY0fvK3yfjeISrbewBhqWZPBAu8WXMzB1eb6-IDne6hT1QMZx2jgkgGjOL45sw5_aTJ4B68ecspPuv3x0/s1600/IMAG0042.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="191" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiAO-FzeUw40PaPRhHAfo0S4dg51vwKj7E_CZOYpCg_fhNT9sx-kg0i2u580bBY0fvK3yfjeISrbewBhqWZPBAu8WXMzB1eb6-IDne6hT1QMZx2jgkgGjOL45sw5_aTJ4B68ecspPuv3x0/s320/IMAG0042.jpg" width="320" /></a></div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We plan on using an Android HTC Desire phone lent by the university through the pervasive positioning course, on top of phones we already have.</span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The robot has been built so it keps things simple and efficient. It is indeed really sturdy and steady du to its low and balanced profile. Besides, tracks enable smooth and accurate movements, even on uneven surfaces. Basically, this robot should be able to handle crashes and impacts with the environnement and other robots, and it should run on every type of ground.</span></div><div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-family: 'Times New Roman'; line-height: normal;"></span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span" style="color: black; font-family: Arial, Helvetica, sans-serif; font-size: small; line-height: normal;"><b><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: large; font-weight: normal; line-height: 18px;">III.b. </span></b></span></span></span><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;">Ideas for the bomb</span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The bomb will be carried on some sort of waggon dragged by the terrorist vehicle. The bomb will consist on a infrared ball put on top of its own NXT brick which will be mounted on two free wheels (so the bomb won't move by itself, an other robotized unit will have to carry it).</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">In order to have the bomb follow the terrorist, we have thought about a claw mounted on and activated by the bomb unit itself, once the terrorist is placed in front of it (either detected with an proximity sensor -touch or ultrasound-, either when the terrorist player send a command to the bomb by bluetooth). So the claw will catch the back of the terrorist robot and the latter will be able to carry the bomb wherever its player will be willing to do so.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The releasing process is exactly the opposite (releasing made by the motorized claw controlled by the bomb unit).</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn8dgxi2JKYHEie-6_i8IZa6hrAnk6BEdtSatx33UXWnZwitncpW9eMjVz_fdILuJ6l8nAw-jjki1Wm2gmbWWrZYx1F3VFU520nQ-eDRumjVui1XguJLkzr80Bh6xOgWnQZyQm4QfuNkM/s1600/IMAG0038.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="320" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgn8dgxi2JKYHEie-6_i8IZa6hrAnk6BEdtSatx33UXWnZwitncpW9eMjVz_fdILuJ6l8nAw-jjki1Wm2gmbWWrZYx1F3VFU520nQ-eDRumjVui1XguJLkzr80Bh6xOgWnQZyQm4QfuNkM/s320/IMAG0038.jpg" width="191" /></a></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Such a system would enable some new features in the game due to its greater flexibility. For instance, we thought of having many bomb units like the previously described one, so the terrorist unit would be able to plant more than one bomb by going back each time to its starting point (some kind of terrorist basecamp).</span></div></div></div><div style="color: black; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><span class="Apple-style-span" style="color: #222222; font-size: 21px; line-height: 18px;"><span class="Apple-style-span" style="color: #222222; line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span> </span></span><br />
<span class="Apple-style-span" style="font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"> IV. References</span></span><br />
<span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></span></span></span></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"></span></span><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;">[1] </span></span></span></span></span></span><a href="http://www.rezultat.dk/UNDERHOLDNING/BATTLESTATION/spiltyper.htm"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;">http://www.rezultat.dk/UNDERHOLDNING/BATTLESTATION/spiltyper.htm</span></span></a></div></div></div></div></div></div></div></div></div></div></div></div>Dyhrberghttp://www.blogger.com/profile/15764682796259349694noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-70173650069178180602010-12-09T16:24:00.004+01:002010-12-22T19:09:31.142+01:00End Course Project 1: Decision<div><div style="margin: 0px;"><div style="text-align: justify;"><div style="margin: 0px;"><div style="margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Date: 2. December 2010</span></div></div></div></div></div></div><div><div style="margin: 0px;"><div style="text-align: justify;"><div style="margin: 0px;"><div style="margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Duration of activity: 4 hours</span></div></div></div></div></div><div style="margin: 0px;"><div style="text-align: justify;"><div style="margin: 0px;"><div style="margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Group members participating : Michaël Ludmann, Guillaume Depoyant, </span><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Anders Dyhrberg</span></div></div></div></div></div></div><div style="margin: 0px;"><div style="text-align: justify;"><div style="margin: 0px;"><div style="margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;"><br />
</span></div></div></div></div></div><div><div style="margin: 0px;"><div style="text-align: justify;"><div style="margin: 0px;"><div style="margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="font-size: 21px; line-height: 18px;"><br />
</span></span></div></div></div></div></div></div><div style="margin: 0px;"><div style="text-align: justify;"><div style="margin: 0px;"><div style="margin: 0px;"><div style="margin: 0px;"><div style="margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"></span></span></span></span></span></span></span></span></div><div style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal; margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div></div><div style="margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: small; line-height: normal;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;">I. </span></span></span></span></span></span></span></span></span><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="font-size: 21px; line-height: 18px;">Decision</span></span></div><div style="margin: 0px;"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="color: black;"><span class="Apple-style-span" style="line-height: 18px;">We </span></span><span class="Apple-style-span" style="line-height: 18px;">decided</span><span class="Apple-style-span" style="color: black;"><span class="Apple-style-span" style="line-height: 18px;"> to do the Anti Terrorist Game idder from last lab session.</span></span></span></span></span></span></span></span></span></span></span></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"><br />
</span></span></span></span></span></span></span></span></span></div></div></div></div><div style="margin: 0px;"><div style="margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span"></span></div></div><div style="margin: 0px;"><div style="margin: 0px;"><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><b>General description of the concept:</b></span></span></span></span></span></div><div style="margin: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span">A simple game with two human players, each controlling one NXT using an XBOX controller. One player is the terrorist who has to place a bomb in the game field, while the other is the counter-terrorist unit trying to locate and defuse the bomb before the time expires and the bomb explodes. </span></span></span></span></span><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Players cannot see the playfield directly but only what their robot see through a camera mounted one the car.</span></div></div><div style="margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"></span></span></span></span></div></div><div style="margin: 0px;"><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin: 0px;"><div style="margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"> <b>Hardware Required:</b></span></span></span></span></span></span></div></div></div><div style="margin: 0px;"><div style="margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We identified which hardware that was required, and Ole Caprani confirmed that it should not be a problem to get the lego hardware required. And we should be able to borrow the required Cell Phone Cameras from the Positioning Course.</span></div><div style="margin: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div style="margin: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Hardware List:</span></div><ul><li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">3 NXT bricks with an option to include many more. (AU)</span></li>
<ul><li><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">1x for the terrorist unit</span></li>
<li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">1x for the counter terrorist unit</span></li>
<li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">1x NXT for the bomb</span></li>
</ul><li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">1x infrared ball for the bomb (Ludmann)</span></li>
<li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">2x computers, one for each player (TBD)</span></li>
<li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">2x games controllers (Xbox or Playstation pads) (Depoyant and Ludmann)</span></li>
<li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">2x Android Phones (Pervasive Class, Ludmann, Dyhrberg, Depoyant)</span></li>
</ul></div></div></div><div style="margin: 0px;"><div style="margin: 0px;"><div style="margin: 0px;"><div style="margin: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"></span></span></span></span></span></span></span></span></div><div style="margin: 0px;"><div style="color: black; line-height: normal; margin: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Play Field:</b></span></div><div style="margin: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">After we made our project decision last week, we made a Field Trip to Rezultat to inspect their play field[1] the group have been allowed to use for our free disposal . This was very inspiring at we have attached a video indication the visual result of using this as the context for the game.</span></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="color: black; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><br />
</b></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><div class="separator" style="clear: both; font-family: 'Times New Roman'; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dwMnbNNZyb9gXZr_bALxjnfo38qypdXSE4KAGpPp89zcPhnLjNQlilgH6SU0DZj8Et6UYT4btfaUQP8RqYp5g' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><br />
</b></span></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><br />
</b></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Work Plan:</b></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We agreed that we initially will move out meeting time to be fixed Thursday from 16 to open end, since this time slot would give us better chances for longer work periods. At our next meeting we will try to break down all the tasks and make a full plan to uncover the workload all the way to the delivery date. At the end of each session we will distribute key tasks to be solved by group members between session. We do acknowledge that there is quite a lot of work to be done in this project.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><br />
</b></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Key Issues Identified in our last session:</b></span></div></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin: 0px;"></div><ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">To deal with streaming the camera images to the computers while displaying informations about the sensors readings on players screens and allowing them to control the robots in real time. (Will require dedicated SW for the Android Phones)</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We need to implement a GamePad driver for the PC to control the units. (This is fairly easily achieved using key mapping on the PC. Mapping GamePad press to Keyboard Press)</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The mechanical release of the BOMB from the terrorist unit could turn out to be problematic. Same could the for the deactivation mechanized used by the CTU.</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We would have to experiment with the game play in order to keep it balanced, and fun for all players.</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We have to make a program for the PC side to show the Video Stream from the robots.</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We need to find/design a god play field for the game. We currently are expecting to use a city model available to us, used for tank strategy game[2].</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">(Optional control feature) An obvious extension to the game would be to use the Wireless Ethernet on the camera phones to control the robot, by forward the instructions from to NXT using bluetooth, in order to extend the range from theoreticaly 10m to 100m. </span></li>
</ul><div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div><div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Key decisions made this session:</b></span></div><div><ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Application Platform. It seems like from our lab session, we get a lot of code served to communicate with the NXT brick, which we need, if we choose to use the Java platform. So using Java Swing was a fairly simple choice.</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Video stream from player unit to pc. The most obvious platform today would be to use an Android based Cellphone and find a pre made streaming application, so we only have to make the PC side of this streaming program. The interface is fairly open. But it should be fairly easy to embed into our Player Application</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Connecting the Xbox controllers, will be dune using simple keyboard mapping strategy. So each button on the controller will map to a keyboard press, and this can fairly simple be interpreted in the player application and forward the instruction to the unit.</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">OTHER ????</span></li>
</ul></div><div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b><br />
</b></span></div><div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Assignments for next session:</b></span></div><div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Ludmann and Dyhrberg:</b> Experiment with different pre built Android programs from Android to stream video from an android phone to the PC.</span></div><div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Ludmann:</b> Start working on the player Controlled Vehicle</span></div><div><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"><b>Depoyant: </b></span></span><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Start working on the PC player interface, base on the framework Dyhrnberg made at an earlier lab session to test the Bluetooth logger</span></div><div><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"><b>Owsinski: </b>Start working on the bomb<br />
<br />
REFERENCES<br />
</span><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;">[1] </span></span></span></span></span></span><a href="http://www.rezultat.dk/UNDERHOLDNING/BATTLESTATION/spiltyper.htm"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;">http://www.rezultat.dk/UNDERHOLDNING/BATTLESTATION/spiltyper.htm</span></span></a></div></div></div></div></div></div></div></div></div></div></div>Dyhrberghttp://www.blogger.com/profile/15764682796259349694noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-43713511184018424382010-11-25T12:16:00.082+01:002010-12-02T10:32:09.174+01:00Lab Session 11: End course project preparation<div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Date: 25. November 2010</span></div></div></div></div></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Duration of activity: 4 hours</span></div></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Group members participating : Michaël Ludmann, Guillaume Depoyant, </span><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Anders Dyhrberg, Michal Owsinski.</span></div></div></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;"><br />
</span></div></div></div></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;"><br />
</span></div></div></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;"><b><span class="Apple-style-span"><span class="Apple-style-span">I. A project we want do to?</span></span></b></span></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span"><span class="Apple-style-span">I.a Uni Ball Vehicle</span></span></span></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><b>General Description:</b></span></span></span></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span">A car similar to the LegWay project, but only having one ball as a wheel instead of regular wheels [1].<b> </b></span></span></span></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><b>Hardware Required:</b></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">Only one NXT is </span><span class="Apple-style-span" style="line-height: 18px;">required.</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; font-family: Arial, Helvetica, sans-serif; line-height: normal;"><br />
</span></span></span></span></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; font-family: Arial, Helvetica, sans-serif; line-height: normal;"><b>Sensors and actuators:</b></span></span></span></span></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; font-family: Arial, Helvetica, sans-serif; line-height: normal;">Three motors are required, and accelerometer and tilt sensors i various configurations.</span> </span></span></span></span></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">- A special wheel with at specific size and rubber coating will be required for the right traction and system </span><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">response.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Communication:</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">No PC program or communication is required.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Key Issues:</b></span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">- The will only be one NXT brick and one embedded SW for this project. The main complexities for this project will be regarding the mechanical structure of the robot. Getting the right wheel, and figuring out what the right wheel would be. And figuring out the physics of the robot and designing, what most likely would be a quite complicated PID algorithm for balance.</span><br />
<span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;"><br />
</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span">I.b Alarm Dispatch Central</span></span></span></span></span></span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"></span><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="font-size: small;"><b>General Description:</b></span></span></span></span></span></span></span></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><b></b>We will build a small city, and an alarm dispatch central to help lego people in distress. N citizens are driving randomly around the city, following LEGO roads, while looking for LEGO people in distress. The map of the city is known by the central (i.e. the PC) and when a citizen detects a LEGO person it reports the coordinates to the alarm dispatch central. Then the central sends an ambulance using the shortest path based on the known map. The ambulance is self-driving, without further help.</span></span></span></span></span></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">The concept could be extended with different situations leading to different dispatch units like police cars, fire fighters, etc.</span></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; font-family: 'Times New Roman'; line-height: normal;"></span></span></span></span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">This idea could actually lead to a simulation of a real-world situation.</span></span></span></span></span></span></div><div><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></span></span></span></span></span></div><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"> </span></span></span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><b>Hardware Required:</b></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
<ul style="color: black; font-family: 'Times New Roman'; line-height: normal;"><li><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Minimum 2 NXT bricks with an option to include many more. </span></li>
<li><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">One for an ambulance, that can go and rescue lego men </span></li>
<li><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">One for a citizen that can detect a lego man that have had an accident.</span></li>
</ul></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"></span></span></span></span><br />
<div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; font-family: Arial, Helvetica, sans-serif; line-height: normal;"><b>Sensors and actuators:</b></span></span></span></span></span></span></span></span></span></span></div><div style="color: black; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><ul><li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Ambulance:</span></span></span></span></span></li>
<ul style="font-family: 'Times New Roman';"><li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">2x motors</span></span></span></span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Ultrasonic sensor</span></span></span></span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Touch sensor (to avoid collision)</span></span></span></span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Sound and light</span></span></span></span></span></li>
</ul><li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; font-family: Arial, Helvetica, sans-serif; line-height: normal;">Citizen:</span></span></span></span></span></span></span></span></span></span></li>
<ul><li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; font-family: Arial, Helvetica, sans-serif; line-height: normal;">2x motors</span></span></span></span></span></span></span></span></span></span></li>
<li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; font-family: Arial, Helvetica, sans-serif; line-height: normal;"></span></span></span></span></span></span><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Ultra sensor</span></span></span></span></span></li>
<li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Touch sensor (to avoid collision)</span></span></span></span></span></li>
<li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Sound and light</span></span></span></span></span></li>
<li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Color sensor and or sound to detect citizen in distress.</span></span></span></span></span></li>
</ul></ul></div><br />
<div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Communication:</b></span></span></span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">- A PC program is used. This is the alarm dispatch central which registers the emergency call from the citizen and dispatch the ambulance. Both communication with the PC using Bluetooth.</span></span></span></span></span></div><div style="color: black; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></span></span></span></span></div><br />
<div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Key Issues:</b></span></span></span></span></span></div><br />
<span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"></span></span></span></span><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><ul><li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We need to implement a model of the city in the Dispatch Unit (PC)</span></span></span></span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Citizens need to follow the roads</span></span></span></span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Citizens need to detect the Lego Person in distress (using color sensor, will limit other colors not to be present during while scenario is running)</span></span></span></span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The citizens need to avoid running into the ambulance (task priority)</span></span></span></span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The ambulance need to follow roads base on a pre decided path (will require autonomus adjusting base on an pre decided plan)</span></span></span></span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We need to implement a shortest path algorithem base on the reported coordinates and the layout of the city.</span></span></span></span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Generally there is so many exceptions that could occur in this project, that we would need to decide on the key parts of this system that we want to address in order to reach the goal.</span></span></span></span></span></li>
</ul><br />
<br />
<div style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"></span></span></span></span></span></span></span></span><br />
<div style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><div style="color: black; font-family: 'Times New Roman'; font-size: medium; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: 21px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;">I.c Anti-terrorists game</span></span></span></span></span></span></span></span></span></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><b>General Description:</b></span></span></span></span></span><br />
<span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span">A simple game with two human players, each controlling one NXT. One is the terrorist who has to place a bomb in the game field, while the other is the counter-terrorist unit trying to locate and defuse the bomb before the time expires.</span></span></span></span></span></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span">Players cannot see the playfield but only what their robot see through the camera mounted one the car.</span></span></span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"></span></span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br class="Apple-interchange-newline" /><b>Hardware Required:</b></span></span></span></span></span></span></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
<ul><li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Minimum 3 NXT bricks with an option to include many more. </span></li>
<ul><li><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">1x for the terrorist unit</span></li>
<li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">1x for the counter terrorist unit</span></li>
<li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">1x NXT for the bomb</span></li>
</ul><li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">1x infrared ball for the bomb</span></li>
<li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">2x computers, one for each player</span></li>
<li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">2x games controllers (Xbox or Playstation pads)</span></li>
<li style="color: black; font-family: 'Times New Roman'; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">2x Android Phones</span></li>
</ul></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"></span></span></span></span></span></span></span></span><br />
<div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; font-family: Arial, Helvetica, sans-serif; line-height: normal;"><b>Sensors and actuators:</b></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><div style="color: black; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><ul><li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Terrorist:</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></li>
<ul style="font-family: 'Times New Roman';"><li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">3x motors (2 wheels, one arm to release the bomb)</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">1x camera, ultrasound/touch sensor for collision detection</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></li>
</ul><li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">CTU: </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></li>
<ul><li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">3x motors (2 wheels, one arm)</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></li>
<li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">1x camera</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></li>
<li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">1x infrared sensor (to detect the ball),</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></li>
<li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">1x ultrasound and/or touch sensor (for collision detection)</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></li>
</ul><li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Bomb:</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></li>
<ul><li style="font-family: 'Times New Roman';"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">1x touch sensor (to detect when the infrared ball on top of the NXT bomb has fallen)</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></li>
</ul></ul></div></div><div style="color: black; display: inline !important; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="font-family: 'Times New Roman'; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div></div><div style="color: black; display: inline !important; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div></div></div></div><br />
<div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Communication:</b></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Two communication forms will be required.</span></span></span></span></span></span></span></span></span></div><div style="color: black; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><ul><li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Each unit will be connected to a PC during the entire game (hence 2 pc's required). </span><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The communication is based on bluetooth, and is used for sending instructions from the GamePad to the Robots, controlling the actuators.</span></span></span></span></span></span></span></span></span></li>
<li><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The mobile phones will be connected to pc's streaming their video using a Wireless Ethernet connection. </span></span></span></span></span></span></span></span></span></li>
</ul><br />
<div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: black; line-height: normal;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><b>Key Issues:</b></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></div><div style="color: black; font-family: 'Times New Roman'; line-height: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><br />
<br />
<ul><li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">To deal with streaming the camera images to the computers while displaying informations about the sensors readings on players screens and allowing them to control the robots in real time. (Will require dedicated SW for the Android Phones)</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We need to implement a GamePad driver for the PC to control the units. (This is fairly easily achieved using key mapping on the PC. Mapping GamePad press to Keyboard Press)</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">The mechanical release of the BOMB from the terrorist unit could turn out to be problematic. Same could the for the deactivation mechanized used by the CTU.</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We would have to experiment with the game play in order to keep it balanced, and fun for all players.</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We have to make a program for the PC side to show the Video Stream from the robots.</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">We need to find/design a god play field for the game. We currently are expecting to use a city model available to us, used for tank strategy game[2].</span></li>
<li><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">(Optional control feature) An obvious extension to the game would be to use the Wireless Ethernet on the camera phones to control the robot, by forward the instructions from to NXT using bluetooth, in order to extend the range from theoreticaly 10m to 100m. </span></li>
</ul></div></div></div></div></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><br />
</span></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-large;"><span class="Apple-style-span" style="font-size: 21px; line-height: 18px;"><b>II. Project </b></span></span></span></span><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: x-large;"><span class="Apple-style-span" style="font-size: 21px; line-height: 18px;"><b>Decision and Workplan</b></span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;"><b><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: x-small;"><span class="Apple-style-span" style="color: black; font-family: 'Times New Roman'; font-weight: normal; line-height: normal;"></span></span></span></span></b></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;">Postponed until next session after our evaluation with Ole Caprani.</span></div><br />
</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;"><b><span class="Apple-style-span"><span class="Apple-style-span">V. References</span></span></b></span><br />
<span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;">[1] http://spectrum.ieee.org/automaton/robotics/robotics-software/042910-a-robot-that-balances-on-a-ball</span></span></span></span></span></span><br />
<span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;">[2] </span></span></span></span></span></span><span class="Apple-style-span" style="font-family: Arial, Helvetica, sans-serif;"><span class="Apple-style-span" style="font-size: x-small;">http://www.rezultat.dk/UNDERHOLDNING/BATTLESTATION/spiltyper.htm</span></span></div></div></div></div>Dyhrberghttp://www.blogger.com/profile/15764682796259349694noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-50227563269076612792010-11-18T11:57:00.111+01:002011-01-19T17:26:14.368+01:00Lab session 10 : Investigating leJOS subsumption API<div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Date: 18. November 2010</span></div></div></div></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Duration of activity: <b>?</b> hours</span></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Group members participating : Michaël Ludmann, Guillaume Depoyant, </span><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">Anders Dyhrberg</span></div></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;"><br />
</span></div></div></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;"><br />
</span></div></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 21px; line-height: 18px;"><b><span class="Apple-style-span"><span class="Apple-style-span">I. Objectives and summary</span></span></b></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">Investigate the BumperCar sample behavior, based on the LejOS incorrectly </span></span></span></span><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px;">implemented (or misnamed) subsumption architecture.</span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><b>I.1 </b>Press the touch sensor and keep it pressed. What happends ? Explain<br />
- While the bumper is continually pressed, the robot just keeps repeating the behavior "DetectWall"<br />
<br />
<ol><li>Set one engine to make half a wheel rotation and the other engine to make a full wheel rotation, causing a small turn.</li>
</ol><div>It is noted that the behavior is blocking in the last engine call while executing it. </div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><b>I.2</b> Both DriveForward and DetectWall have a method takeControl that are called in the Arbitrator. Investigate the source code for the <t>Arbitrator</t> and figure out if takeControl of DriveForward is called when the triggering condition of DetectWall is true.</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">- No the DriveDorward is never called, since DetectWall has a higher priority, and the arbitrator breaks from arbitration when, it reach DetectWall all the time.<br />
<br />
</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><b></b><b>I.3 </b>Implement a third behavior, <t>Exit</t>. This behavior should react to the ESCAPE button and call <t>System.Exit(0)</t> if ESCAPE is pressed. <t>Exit</t> should be the highest priority behavior. Try to press ESCAPE both when DriveForward is active and when <t>DetectWall</t> is active. Is the <t>Exit</t> behavior activated immediately ? What if the parameter to Sound.pause(20) is changed to 2000 ? Explain.</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">- Exit behavior was implemented, and added to the behavior array, as the last one, making it the highest priority behavior. When pressing exit while driving forward it was working as expected, but while DetectWall was active it was not responding. This is due to the fact that the last motor call is a blocking call. The DetectWall action was modified to this implementation below, to make is respond to exit as expected. </div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><blockquote style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-color: rgb(187, 187, 187); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: dashed; border-top-width: 1px; font-family: monospace; font-size: 12px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span></div><table id="src_table_0" style="border-collapse: collapse; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><tbody style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<tr id="sl_svn22_58" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: #000088; font-size: small;"><span class="Apple-style-span" style="font-size: 12px; white-space: pre-wrap;">public void action() { Motor.C.resetTachoCount(); _suppressed = false; Motor.A.rotate(-180, true);// start Motor.A rotating backward Motor.C.backward(); // rotate C farther to make the turn while (!_suppressed && Motor.C.getTachoCount() > -360) { Thread.yield(); //don't exit till suppressed } Motor.C.stop(); }</span></span></div></td></tr>
</tbody></table></blockquote><br />
<b>What if the parameter to Sound.pause(20) is changed to 2000 ? Explain.</b><br />
- The exact behavior was not completely justifiable. It was interrupting the code flow a lot. The arbitrator was forced to pause 2 seconds every time it has to go through the array to test which behavior wanted control. Even when DetectWall was not requesting control it was taking 2seconds to figure it out.<br />
We did study the documentation and the source code for the Sensor.getDistance(), and is was clear that when the sensor is in ping mode, it is making the required pause by it self. Therefor it was decided to remove the delay completely.<br />
<br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><b>I.4 </b>To avoid the pause in the takeControl() method of DetectWall a local thread in DetectWall could be implemented that sample the ultrasonic sensor every 20 msec and stores the result in a variable distance accessible to takeControl. Try that. For some behaviors the triggering condition depends on sensors sampled with a constant sample interval. E.g. a behavior that remembers sensor readings e.g. to sum a running average. Therefore, it might be a good idea to have a local thread to do the continous sampling.</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">- Since the delay was removed this assignment did not appear strictly nessecary for us to do. But we considered this technic useful we did implemented it.<br />
<br />
</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><b>I.5 </b>Try to implement the behavior DetectWall so the actions taken also involve to move backwards for 1 sec before turning.</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><b>I.6 </b>Try to implement the behavior DetectWall so it can be interrupted and started again e.g. if the touch sensor is pressed again while turning.</div><br />
</div></div>Dyhrberghttp://www.blogger.com/profile/15764682796259349694noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-67990277671395322612010-11-11T10:08:00.007+01:002010-11-25T10:47:12.723+01:00Lab Session 9 : differential driven car<span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"></span><br /><div><div style="margin: 0px;"><div style="text-align: justify;"><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;color:#222222;">Date: 11. November 2010</span></div></div></div><div><div style="margin: 0px;"><div style="text-align: justify;"><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;color:#222222;">Duration of activity: 4 hours</span></div></div><div style="margin: 0px;"><div style="text-align: justify;"><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;color:#222222;">Group members participating : Michal Owsinski, Michaël Ludmann, Guillaume Depoyant</span></div></div></div><div style="margin: 0px;"><div style="text-align: justify;"><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"><br /></span></div></div><div><div style="margin: 0px;"><div style="text-align: justify;"><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"><br /></span></div></div></div><div style="margin: 0px;"><div style="text-align: justify;"><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"><b><span class="Apple-style-span"><span class="Apple-style-span">I. Objectives and summary<br /><br />II. Navigation </span></span></b></span><br /><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"><b><span class="Apple-style-span"><span class="Apple-style-span"><br /></span></span></b></span> <!--StartFragment--> <p class="MsoNormal"><span lang="DA"><span class="Apple-style-span" style="font-size: medium;"><span class="Apple-style-span" style="font-family:'trebuchet ms';">In our lab 9 session we used our lego 9797. The first experiment was to test the differential drive by using the pilot class.</span></span></span></p> <!--EndFragment--> <span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-size: medium;"><span class="Apple-style-span" style="font-family:'trebuchet ms';">So as to sample some values and get the relative error of the robot during the navigation, we set a track making a loop in order to measure the difference between the starting point and the finish point. </span></span></span><span class="Apple-style-span" style="font-size: medium;"><span class="Apple-style-span" style="font-family:'trebuchet ms';">The robot was suppose to draw a square by driving forward for 40 cm then turn 90 (pilot.rotate function) 4 times. </span></span><span class="Apple-style-span" style="line-height: 18px; "><span class="Apple-style-span" style="font-size: medium;"><span class="Apple-style-span" style="font-family:'trebuchet ms';"> (as you can see on the video below).</span></span></span></div><div style="text-align: justify;"><span class="Apple-style-span" style=" ;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;color:#222222;"><span class="Apple-style-span" style="line-height: 18px;"><br /></span></span><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dx3PtCn2YzsgzMx3xrGfN_oo-WCZ9qH461W4We6qrnmjl6YmUqwKWrWgIy0089mJWKfsULwxtfu2mw5bMk' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style=" ;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;color:#222222;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: 'times new roman'; line-height: normal; font-size: large; "> </span></span></span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span" style="font-family:'trebuchet ms';"><span class="Apple-style-span" style="font-size: medium;">So far, the accuracy wasn't obviously reliable. This mainly due to the friction, the wheels and the error of the measure concerning the structure of the robot (diameter of the wheels, space between the wheels and the small third wheel) </span></span></span><span class="Apple-style-span" style="font-family:'trebuchet ms';"><span class="Apple-style-span" style="font-size: medium;">they all caused a drift (small errors that add up into large errors is called a drift) [1]</span></span><span class="Apple-style-span" style="line-height: 18px; "><span class="Apple-style-span" style="font-family:'trebuchet ms';"><span class="Apple-style-span" style="font-size: medium;">. That's why from there, we analysed the line that the robot drew during the running: we measured the angle and applied a linear correction in our code in order to make the 90° turn "reliable"(in the code, we had to increase the value by 4 degrees since the actual turn was 86</span></span></span><span class="Apple-style-span" style="font-family: 'trebuchet ms'; font-size: medium; line-height: 18px; ">°</span><span class="Apple-style-span" style="font-family: 'trebuchet ms'; font-size: medium; line-height: 18px; ">). </span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style=" ;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;color:#222222;"><span class="Apple-style-span" style="line-height: 18px;"><br /></span></span></div><div class="separator" style="clear: both; text-align: center;"><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;color:#222222;"> </span><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjoLVR0LhiqysyWomW0dDfgxlUIMJr-C7uLm31vxRVqpQ_I0S4MoTxUL2mn9bIDh4lopjAP-DPQbCgoVzx97inDMdofiQqAKNN_l7bOcDGUmxtcOiqlCbsO60WumkUJXPYsIVVe7nTf_8/s1600/firstResult.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhjoLVR0LhiqysyWomW0dDfgxlUIMJr-C7uLm31vxRVqpQ_I0S4MoTxUL2mn9bIDh4lopjAP-DPQbCgoVzx97inDMdofiQqAKNN_l7bOcDGUmxtcOiqlCbsO60WumkUJXPYsIVVe7nTf_8/s320/firstResult.jpg" width="320" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style="font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="line-height: 18px;">After this modification, we ran another test, and the results were better that what we could expect according to the error (approcimatively 1,5cm) that we had the first time. But obviously our solution doesn't solve the problem with the error completely. When we will change the turn from fx. 90</span></span><span class="Apple-style-span" style="font-family: 'trebuchet ms'; font-size: medium; line-height: 18px; ">° to 150</span><span class="Apple-style-span" style="font-family: 'trebuchet ms'; font-size: medium; line-height: 18px; ">° we need to make another test to include the new error value. </span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style=" ;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;color:#222222;"><span class="Apple-style-span" style="line-height: 18px;"><br /></span></span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style=" ;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;color:#222222;"><span class="Apple-style-span" style="line-height: 18px;"><br /></span></span></div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dxjZxECt81_dpCW4-oJO3Il0iqiPMxkKAPQOBJ61G17VdMZCes0dvsraAalc27YN7tGG0Zz6fSmKwjGy95JiQ' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIZO5S6EKUcHd0pKusrM2UmbcSbGlaNoevAX4g0fC5-HHNQWt9gf-QVlkl_OpqdfQyF-x2Sktuy46Yh9Ow-6ebFMofrNLqK93wmj8XVCmrpHODEAv_aof3B-kULpc6FOy1wORGCr89RNI/s1600/2ndResult.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIZO5S6EKUcHd0pKusrM2UmbcSbGlaNoevAX4g0fC5-HHNQWt9gf-QVlkl_OpqdfQyF-x2Sktuy46Yh9Ow-6ebFMofrNLqK93wmj8XVCmrpHODEAv_aof3B-kULpc6FOy1wORGCr89RNI/s320/2ndResult.jpg" width="320" /></a></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;color:#222222;">This operation gave us a "better" precision, nevertheless, we have to be aware that this improvement is relative: on a larger scale, those errors would be unacceptable. On small distance, the errors can be reduced but still, the accuracy is not as good as a system working with absolute coordinates.</span></div><div class="separator" style="clear: both; text-align: justify;"><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;color:#222222;"><br /></span></div><div style="text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dyPgSh4WssRvyr7QlHC_zFQMVAyWgabLjD5IqT55SPveszfqB_ZGJpAtUZWIEmWC2tol9SWdxm8h2pqPCUE1A' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: center;"><br /></div><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"><b><span class="Apple-style-span"><span class="Apple-style-span"><br /></span></span></b></span><br /><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"><b><span class="Apple-style-span"><span class="Apple-style-span"><br /></span></span></b></span><br /><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"><b><span class="Apple-style-span"><span class="Apple-style-span">III. Navigation while avoiding objects</span></span></b></span><br /><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"><b><span class="Apple-style-span"><span class="Apple-style-span"><br /></span></span></b></span><br /><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"><b><span class="Apple-style-span"><span class="Apple-style-span">IV. Improved navigation</span></span></b></span><br /><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"><b><span class="Apple-style-span"><span class="Apple-style-span"><br /></span></span></b></span><br /><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"><b><span class="Apple-style-span"><span class="Apple-style-span">V. References</span></span></b></span></div><div style="text-align: justify;"><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"><b><span class="Apple-style-span"><span class="Apple-style-span"><br /></span></span></b></span></div><div style="text-align: justify;"><span class="Apple-style-span" style=" line-height: 18px;font-family:Arial, Tahoma, Helvetica, FreeSans, sans-serif;font-size:130%;color:#222222;"><b><span class="Apple-style-span"><span class="Apple-style-span"><span class="Apple-style-span" style="color: rgb(0, 0, 0); font-family: Times; font-weight: normal; line-height: normal; font-size: medium; ">[1], Brian Bagnall, Maximum Lego NXT Building Robots with Java Brains, Chapter 12, Localization, p.297 - p.298.</span></span></span></b></span></div></div>Michalhttp://www.blogger.com/profile/01565336356842989740noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-56433479720320679892010-11-04T13:41:00.005+01:002010-11-11T18:41:25.109+01:00Lab session 8 : Concurrent Threads<div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;">Date: 4. November 2010</div></div></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;">Duration of activity: 2,5 hours</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;">Group members participating : Michal Owsinski, Michaël Ludmann, Guillaume Depoyant, Anders Dyhrberg</div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><br />
</div></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><br />
</div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><b><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: x-large;">I. Objectives and summary</span></span></b></div></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><br />
During this lab session, we managed to :<br />
<br />
<ul><li>Try to understand how to have different behaviors implemented in the same robot</li>
<li>Understand the role of priority for tasks</li>
<li>See how the behavior suppression strategy works</li>
</ul><br />
<br />
</div></div></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><b></b><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><b><b><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: x-large;">II. Robot with different behaviors</span></span></b></b></div><div style="font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><b><b></b></b></div><div style="display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="display: inline !important; font-weight: normal;"><div style="display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><b><b><b><br />
</b></b></b></div></div></div></div></div><br />
<div style="font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><b><b></b></b></div><div style="display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div style="display: inline !important; font-weight: normal;"><div style="display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div style="display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><b><b><b>II.1. LEGO car that exhibits several behaviors</b></b></b></div></div></div></div></div><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><b><b style="font-weight: normal;"></b></b></div><div style="display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="display: inline !important; font-weight: normal;"><div style="display: inline !important; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div></div></div><div style="text-align: justify;">For this first experiment, we merely tried to test the program SoundCar.java and see what happened. Basically, the robot shows three different behaviors :</div><br />
<ol><li style="text-align: justify;">It moves around randomly, driving forward by moving the wheels at different speeds in a random fashion, during some time (apparently random too). While moving forward, the LCD display shows the letter "f" on a line. Between two moves, the robot stops (letter "s" on the display).</li>
<li style="text-align: justify;">It reacts to the presence of an obstacle in front of its ultrasound sensor. If an object is too close, the robot moves backward and then turn right forward. The same letters appears on the screen, on top of a number displaying the distance seen by the ultrasound sensor (20 is the threshold)</li>
<li style="text-align: justify;">It plays some nice sounds every 10 seconds.</li>
</ol><div style="text-align: justify;">The LCD display shows in real time which behavior is currently followed by the robot. Whatever happens, the robot will always play its sound every ten seconds. It goes the same way for the US sensor : if there is an obstacle, the robot will stop its random driving task in order to avoid the obstacle. So task number 3 precedes task 2 which precedes task 1 : there are different priorities between them. </div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">The video below shows the general behavior of the robot while testing this program with those behaviors.</div><br />
<br />
<div class="separator" style="clear: both; text-align: center;"><b><br />
</b></div><div class="separator" style="clear: both; text-align: center;"><b><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dzQzXbbncWxWek_N-gWEhU1SLtEYq78S4GlmcvfBIEJ_HKtimZRvUW_tZ2bCa8t5OOq0Jx7L9jxiEQbO_jxFw' class='b-hbp-video b-uploaded' frameborder='0'></iframe></b></div><div style="font-size: medium; font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><b><b><br />
</b></b></div></div><div style="font-size: medium; font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><br />
<div style="font-size: medium; font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><b><br />
</b></div><div style="font-size: medium; font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><b><b>II.2. Behaviors as concurrent threads</b></b></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><b><b></b></b></div><div style="font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><b><b><b><span class="Apple-style-span" style="color: red; font-weight: normal;">[Michal]</span></b></b></b></div></div><div style="font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;"><b><b><br />
</b></b></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div></div></div><div style="font-size: medium; font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div></div><div style="font-weight: normal;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dyvYSLGUMwE6umCm7ZhM2-bqWO_OYsGSXYbUiNo49Q-RGe-SNr5XKFJnLilqHvtq9DNqed1EqczvsTVNRWiLw' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div class="separator" style="clear: both; text-align: center;"></div><div style="text-align: justify;"><br />
</div><div style="text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dzCRM1ETsmz4Ei0DdSn00b3W_N_hlqTT6zKdIWeh5h2x9nXXoBUrq2Gc-ECbZtlGAcLqDdSmE204ARzoiEviA' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div style="text-align: justify;"><br />
</div><br />
<div class="separator" style="clear: both; text-align: justify;"><br />
</div><div style="text-align: justify;"><b><span class="Apple-style-span" style="font-size: x-large;"><br />
</span></b></div><div style="text-align: justify;"><b><span class="Apple-style-span" style="font-size: x-large;">III. Explaining the threading strategy</span></b></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><b><br />
</b></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><b>III.1. The purpose of making threads daemon threads</b></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;">The purpose of making the thread a deamon thread, is to tell the the execution environment, in our case the VM. This thread can be terminated when the there is no more none-daemon threads, normally called User Threads.</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;">The daemon thread is typically used for utility functionality that supports the core threads of the program.</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;">One of the most regular known daemon thread is the Garbage Collector. This thread is daemon thread and support the functions of the main loop made by the user. But since the GC is a daemon thread, the VM will automatically end the GC thread when last user thread is ended, typical when the main loop expires.</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;">This understanding is supported by the JaveSE doc[1] and Lejos doc[2]</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><br />
</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><b>III. 2. The behavior suppression strategy</b></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;">The suppression system implemented in the Behavior class is a strategy know as the Subsumption Architechture[3]. It is basically a configuration of the threads where all threads can be parent to one another thread, hereby giving the thread priority. Parrent has higher priority than its child thread. When a parent wishes to execute it's implemented functionality, is suppress the functionality of its child (lower priority) thread. by incrementing the child threads suppression counter. Due to the nesting this will propagate to all the lower priority threads. All threads are continuously executing its functionality loop, also while being suppressed. Therefor is important that each thread check its suppression counter, before trying to actually start its action, by using the isSuppresed() function. The parrent is responsible for release this child again when it is done with its own actions. If it fails to do so, the lower priority thread will new perform any actions.</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;">This strategy is similar to the Semaphore system.</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><b>III. 3. The arbiter strategy</b></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;">The arbiter strategy from Fred Martins book, </div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><span class="Apple-style-span" style="color: red;">... [Dyhrberg]</span></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><br />
</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><b>III. 4. Comparing the arbiter and behavior strategy</b></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><b><span class="Apple-style-span" style="color: red; font-weight: normal;">[Dyhrberg]</span></b></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><br />
</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><span class="Apple-style-span" style="font-weight: normal;"><b><span class="Apple-style-span" style="font-size: x-large;">IV. Improvements</span></b></span></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div><span class="Apple-style-span" style="font-weight: normal;"><b> </b></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><b><span class="Apple-style-span" style="font-weight: normal;"><b><br />
</b></span></b><br />
<b><span class="Apple-style-span" style="font-weight: normal;"><b>IV. 1. Adding a behavior : "drive towards light"</b></span></b></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><b><br />
</b><br />
<br />
Basically, with the first version of the car, there were 3 different behaviors with a specific order on the priorities:<br />
<br />
<i> rd = new RandomDrive("Drive",1, null);</i><br />
<i> ps = new PlaySounds ("Play ",2,rd);</i><br />
<i> af = new AvoidFront ("Avoid",3,ps);</i><br />
<br />
<b>Avoid Obstacles > Play Sounds > Random Drive</b><br />
<br />
The next step was to try to add another function to the robot: following the light. To do this, we used the last prototype we crafted during the previous lab session. This way, the robot had two RCXLightSensor. The robot auto settled his own values of MIN_LIGHT and MAX_LIGHT and when the sensor sampled a value beyond 60% (or another value that can be settled) of the ratio (value_sampled - MIN_LIGHT)/(MAX_LIGHT - MIN_LIGHT), the "semaphore" process was engaged.<br />
<br />
In order to give a reliable order of the behaviors, we initiate the process as follows:<br />
<br />
<i> rd = new RandomDrive("Drive",1, null);</i><br />
<i> fl = new FollowLight ("Light",4,rd);</i><br />
<i> ps = new PlaySounds ("Play ",2,fl);</i><br />
<i> af = new AvoidFront ("Avoid",3,ps);</i><br />
<br />
This way, the robot would have such priorities<br />
<br />
<b>Avoid Obstacles > Play Sounds > Follow Light > Random Drive</b><br />
<br />
<b><br />
</b></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><b>IV. 2. Results</b></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><b><br />
</b></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div style="text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dwx6wQdFhXCmyYt5fdWsGcGLvB3uOgZdf4m1wWMs4OKW8n0LAUQ-ZQt0nR5HE9ca3EFiVoqPd-m7dA4cHeUxQ' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div style="text-align: justify;"><b><br />
</b></div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="font-size: x-large;"><b><br />
</b></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><b><span class="Apple-style-span" style="font-weight: normal;"><b><span class="Apple-style-span" style="font-weight: normal;"><b><span class="Apple-style-span" style="font-size: x-large;">V. References</span></b></span></b></span></b></div><ul><li>[1], <a href="http://download.oracle.com/javase/6/docs/api/java/lang/Thread.html">http://download.oracle.com/javase/6/docs/api/java/lang/Thread.html</a></li>
<li>[2], <a href="http://lejos.sourceforge.net/nxt/nxj/api/java/lang/Thread.html">http://lejos.sourceforge.net/nxt/nxj/api/java/lang/Thread.html</a></li>
<li>[3], <a href="http://en.wikipedia.org/wiki/Subsumption_architecture">http://en.wikipedia.org/wiki/Subsumption_architecture</a></li>
</ul><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><br />
</div></div>Dyhrberghttp://www.blogger.com/profile/15764682796259349694noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-33781529004827026212010-10-28T12:05:00.012+02:002010-11-08T13:50:25.397+01:00Lab session 7 : Braitenberg vehicles<div>Date: 28. October 2010</div><div>Duration of activity: 5 hours<br />Group members participating : Michal Owsinski, Michaël Ludmann and Guillaume Depoyant.</div><br /><div><br /></div><div><br /></div><b><span class="Apple-style-span" style="font-size:x-large;">I. Objectives and summary</span></b><br /><div><br /></div><div><b>I.1 Objective</b><br /><br />To build and program Braitenberg vehicles<br /><br /><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMOCEs0-y4aIc8Bb0vBh0Xr3szuJ0h8BlGYG8GVI_qNTWLbaqOIxL4r6io7IgMUCCWZE0HANvjq47Q9cp-2wAupmyJljdV6xn-JDOStEu9etFGClxkXNJx7oEEjgJjreKw2udi4FpQ135L/s1600/vehicles.gif" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" style="font-weight: bold;"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5533041721585984786" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhMOCEs0-y4aIc8Bb0vBh0Xr3szuJ0h8BlGYG8GVI_qNTWLbaqOIxL4r6io7IgMUCCWZE0HANvjq47Q9cp-2wAupmyJljdV6xn-JDOStEu9etFGClxkXNJx7oEEjgJjreKw2udi4FpQ135L/s320/vehicles.gif" style="display: block; height: 225px; margin-bottom: 10px; margin-left: auto; margin-right: auto; margin-top: 0px; text-align: center; width: 320px;" /></a><b></b><br /><div style="text-align: center;"><b><span class="Apple-style-span" style="font-weight: normal;"><b>Figure 1</b></span><span class="Apple-style-span" style="font-weight: normal;"> Braitenberg vehicles 1, 2a and 2b</span></b></div><br /><br /><div style="text-align: center;"><span class="Apple-style-span" style="font-weight: bold;"><br /></span></div><b> II. Summary</b><br /><br /><br />During this lab session, we managed to :<br /><br /><ul><li>Build and program the three Braitenberg vehicles</li><li>Experiment with them and find the relevance of each of them</li><li>Improve their design in order to get better responses</li><li>Find new tasks for the robot with two light sensors thanks to this improvement</li></ul><br /><br /><span class="Apple-style-span" style="font-weight: normal;"><b><span class="Apple-style-span" style="font-size:x-large;">II. Understanding Braitenberg vehicles</span></b></span><br /><span class="Apple-style-span" style="font-weight: normal;"><b><br /></b></span><br /><b><span class="Apple-style-span" style="font-weight: normal;"><b>I. Vehicle 1 with a sound sensor</b></span></b><br /><b><br /></b></div><div><b><span class="Apple-style-span" style="font-weight: normal;"><span class="Apple-style-span" style="font-family:arial;"><span class="Apple-style-span" style="font-size:small;">In vehicle 1 we used our old </span></span></span><span class="Apple-style-span" style="font-weight: normal; "><span class="Apple-style-span" style="font-family:arial;"><span class="Apple-style-span" style="font-size:small;">LEGO 9797 construction, 1 sound sensor and 2 motors (working as one actuator). We programmed the robot as shown in Figure 1, vehicle 1 - sending the normalized value from the sound sensor to the motors. Effect was as expected,The vehicle was driving forward when a noise was made near the sound sensor. It was driving faster when louder the sound was. Next video shows the results.</span></span></span></b></div><div><br /><br /><b><br /></b><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dyZuV21o5gfUiRknWeBXp8Lo7b9mPSaRJTdCHRCkE82OA1CG9HJpAzzH9lNsXdgq2qtihauSR67whivO87uzw' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><b><br /></b><br /><b><br /></b><br /><b>II. Vehicle 2 with two light sensors</b><br /><b><br /></b><span class="Apple-style-span" style="font-size:small;"><span class="Apple-style-span" style="font-family:arial;">We rebuilt our LEGO 9797 and fit it with 2 light sensors placed 2 cm above the surface pointed in the forward direction. Then we programmed our robot as shown on Figure 1 Vehicle 2b (left sensor normalized values were sent to right motor and right sensor normalized values were sent to left motor). The vehicle followed focused light (a flashlight) and with its behavior begun to remind a moth (driving moth :) ). The speed of vehicle was related to the amount of light detected by the light sensors.</span></span><br /><span class="Apple-style-span" style="color:#FF0000;"><br /></span><b><br /></b><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dxu2nwxszTIVczsYolxOQNODdCswjjWAtEO3WBgSfrUQ8yKG6zbYPW5FvyIuRmY7csnYrKvD1EZ11xlLwZ46Q' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><b><br /></b><span class="Apple-style-span" style="font-size:small;"><span class="Apple-style-span" style="font-family:arial;">The difference between vehicle 2a and 2b is that vehicle 2a will drive away from the light source (behavior of a bat).</span></span></div><div><span class="Apple-style-span" style="font-size:small;"><span class="Apple-style-span" style="font-family:arial;">If we modify our vehicles (2a and 2b) to an inhibition connection (the more the less) we will get a vehicle driving constantly until finding the light source (look at the last video). </span></span></div><div><span class="Apple-style-span" style="font-size:small;"><span class="Apple-style-span" style="font-family:arial;"><br /></span></span></div><div><br /><b><span class="Apple-style-span" style="font-weight: normal;"><b><span class="Apple-style-span" style="font-weight: normal;"><b><span class="Apple-style-span" style="font-size:x-large;">III. Improvements</span></b></span></b></span></b><br /><b><br /></b><br /><b>I. Updating MIN/MAX light values</b><br /><b><br /></b><br /><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: justify;">We followed the main idea of Tom Deans with the constants MAX_LIGHT and MIN_LIGHT, that is to say that we allowed the robot to set his own values, updating them over all the sample values obtained during the lifetime of the vehicle. (cf video)</div><br /><b><br /></b><br /><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dyT_r5mn5RbPfkN2-XTkAMRdT97vSrut9NGtdHi1wQDjmw1XMvSl_Z47FM5Cc2G9WdIVJ0nHZx1qwSoMEIreg' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div class="separator" style="clear: both; text-align: center;"><br /></div><div class="separator" style="clear: both; text-align: justify;"></div><div class="separator" style="clear: both; text-align: justify;">This way the vehicle was able to be tested in different environnements.Instead of changing the constants depending on the place we tested the robot, we could have reliable results in dark or bright places.</div><div class="separator" style="clear: both; text-align: justify;"><br /></div><div class="separator" style="clear: both; text-align: justify;">The next step was to take the highest/lowest value for the Max/Min among the last N values sampled instead of taking all the values sampled in the lifetime of the robot. We simply used a queue in order to implement it and it worked better than expected like you'll see in the next part.</div><br /><b><br /></b><br /><b>II. Results and new possibility / functionality</b><br /><b><br /></b><br /><b></b><br /><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">The next two videos show the implementation of self updating of the min/max values.<br /><div style="text-align: justify;"><br /></div><div style="text-align: justify;">The first one is with the update during all the lifetime. As the video will show you, the results are efficient enough and this for all type of places (dark/bright) but we couldn't change the robot from one environnement to another because the min/max was causing some unpredictable behaviours. Indeed, the robot was evolving in a dark room with a constant MAX_LIGHT meant to be used in a bright room.</div></div><div style="font-weight: normal; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><b><span class="Apple-style-span" style="color:red;"><br /></span></b></div><div class="separator" style="clear: both; text-align: center;"><b><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dw-S2uhEIwi4oLBo9XoY08Kn_oYJwS_iAo45D-N7GBmxb-w49oUukQFhHk16l4F67F5dvzmXPsjE03qi8T_8Q' class='b-hbp-video b-uploaded' frameborder='0'></iframe></b></div><div class="separator" style="clear: both; text-align: center;"><b><br /></b></div><div class="separator" style="clear: both; text-align: justify;">This way, the second video shows us how the problem can be solved by implementing the queue of the last N values sampled. We took N = 1000, this means that the robot only took the values from the last 10 seconds. The brightness could be changed in any way, the robot needed at most 10 seconds adapt himself and try to follow the light (this explains why the robot has to stop sometimes).</div><div><b><span class="Apple-style-span" style="color:red;"><br /></span></b></div><div class="separator" style="clear: both; text-align: center;"><b><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dyvP9ZaMjanNDN7CPUfNW9C48YG9L9y84WcaJ3RDCYu3kBBl4364PcCL3bGxdAvpEewrBpFzBjBP6QdxSFHpA' class='b-hbp-video b-uploaded' frameborder='0'></iframe></b></div><div><b><span class="Apple-style-span" style="color:red;"><br /></span></b></div><br /><b>III. Using different threads of control</b><br /><br />In our previous algorithm, both motors are always getting their commands at the same time, since we use only one thread : there is a single thread of control where the two light sensors are sampled and the two power values are put out to the motors.<br /><br />We tried to implement the same task by using one thread for each couple of sensor and motor (i.e. each connection). In this case, it is the thread managers (scheduler) responsibility to make sure that every module of the robot gets the required CPU time to compute its reactions to the environment. Hence the modules work without being directly linked to each other.<br /><br />This is quite useful while dealing with more complex systems where we need independent modules that do not influence each other (see next lab session for more implementation of this idea).<br /><br /><b> <span class="Apple-style-span" style="font-weight: normal;"><b><span class="Apple-style-span" style="font-weight: normal;"><b><span class="Apple-style-span" style="font-size:x-large;">IV. References</span></b></span></b></span><br /></b><br /><ul><li> [1], Tom Dean, <a href="http://www.cs.brown.edu/people/tld/courses/cs148/02/introduction.html" target="_top"> Introduction to Machina Speculatrix and Braitenberg Vehicles</a> </li><li> [2], Tom Dean, <a href="http://www.cs.brown.edu/people/tld/courses/cs148/01/vehicles/vehicles.htm" target="_top"> Notes on construction of Braitenberg's Vehicles, Chapter 1-5 of Braitenbergs book</a> </li></ul><br /><b><br /></b></div>Michalhttp://www.blogger.com/profile/01565336356842989740noreply@blogger.com1tag:blogger.com,1999:blog-1228414716208593321.post-58381305466502832292010-10-08T15:23:00.012+02:002010-10-19T13:06:21.813+02:00Lab session 6 : Robot race on the Alishan track<div class="separator" style="clear: both; text-align: left;"></div><div>Date: 7. October 2010</div><div style="text-align: auto;">Duration of activity: 17 hours !<br />
Group members participating : Anders Dyhrberg, Michaël Ludmann and Guillaume Depoyant.</div><br />
<div><br />
</div><div><br />
</div><b><span class="Apple-style-span" style="font-size: x-large;">I. Objectives and summary</span></b><br />
<div><br />
</div><div><b>I.1 Objectives</b></div><div><br />
</div><div><div style="text-align: justify;">There is only one objective to accomplish during this lab session, that is we have to build and program a robot able to run as fast as possible on the Alishan Track (see picture below).</div></div><div><div style="text-align: justify;"><br />
</div></div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEix2h4qI1piSl5doYFVahlPghY7CWTh5dIPcGixsebrn-Mjgb7YNZ78baykZ8M0Kre4AaJwxXuV9titESjk-DRw7Z3RQ12PVjOwnEJpY3WiGDI7XdoWd6TCBNrzrapkwAyZTWI9GkYqpJg/s1600/train_of_alishan.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="239" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEix2h4qI1piSl5doYFVahlPghY7CWTh5dIPcGixsebrn-Mjgb7YNZ78baykZ8M0Kre4AaJwxXuV9titESjk-DRw7Z3RQ12PVjOwnEJpY3WiGDI7XdoWd6TCBNrzrapkwAyZTWI9GkYqpJg/s320/train_of_alishan.jpg" width="320" /></a></div><div><br />
</div><div><div style="text-align: justify;">The robot starts in the lower level, in a green square (green is missing on this picture), and has to go on the upper level, before going back to where it started.</div></div><div><br />
</div><div><div style="text-align: justify;">This session is part of a competition, and we had to record the time (in milliseconds) taken by the robot to fulfill this task. We were free to use as many LEGO elements as we wanted to use, as long as the whole robot was contained in the start area.</div></div><div><div style="text-align: justify;"><br />
</div></div><div><div><div style="text-align: justify;"><b>I.2 Summary</b></div></div></div><div><div style="text-align: justify;"><br />
</div></div><div><div style="text-align: justify;">We first agree on how to build te robot and decided of our strategy to solve the problem.</div><div style="text-align: justify;">We used three light sensors to track the line (actually, we needed only two) and a tilt sensor to detect slopes and platforms.</div></div><div><div style="text-align: justify;"><br />
</div></div><div><b><span class="Apple-style-span" style="font-size: x-large;">I. Building the robot</span></b><br />
<br />
<div style="text-align: justify;">Basically, we used the same robot than we craft for all the other experiences. We changed the wheels so as to get a better grip on the floor and, tough part, we had to create a system in order to set the sensor knowing that the inclinaison of the path could change the values sampled.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">So from here, the first idea was to create an elbow connection between the robot and the sensor. Indeed, this first approach seems to be the best because with any inclinaison, the sensor would have the same inclinaison with the floor. But instead of making that, we tried to make something quite different. We linked the sensor and the robot with a parallelepiped link. This way the liaison was a little bit more reliable but depending on the inclinaison, the sampled value could change (we approximate that the inclinaison wasn't that important on the path we had to take).</div><div style="text-align: justify;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW6VjPdeDm4uUNW4Ta36vWlCqeacI2cMmzN50_g_B9u22vN27c5w3aBrnLV7tApVt2ZCT6kIHP_7INI9Mhu3-EIov0KUo-RYmKV1_hZ4BOuhprW9-GU3wIkCizIkGNuROnUFyiNuVJAMc/s1600/lego_competition+068.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhW6VjPdeDm4uUNW4Ta36vWlCqeacI2cMmzN50_g_B9u22vN27c5w3aBrnLV7tApVt2ZCT6kIHP_7INI9Mhu3-EIov0KUo-RYmKV1_hZ4BOuhprW9-GU3wIkCizIkGNuROnUFyiNuVJAMc/s320/lego_competition+068.jpg" width="320" /></a></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><span class="Apple-style-span" style="color: red;"><span class="Apple-style-span" style="color: black;"><span class="Apple-style-span" style="font-size: x-large;"><b><br />
</b></span></span></span></div></div><div><b><span class="Apple-style-span" style="font-size: x-large;">II. Strategy</span></b></div><div><br />
</div><div><div style="text-align: justify;">Instead of creating a mere script to hard code the path the robot has to follow, our priority was to program a more satisfying robot that could react to what it really "sees", helping it a little by letting it expects some patterns. That meant that we first focused of having our robot works correctly using its sensors, before trying to speed it up (even if we always had this in mind).</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Because we knew what the challenge was, because the task to complete is not so complicated and the path to follow is straightforward, and because we wanted to be able to each program at the same time something different, we split the code into a sequence of tasks.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Besides, in order to have an approach different from our usual line follower, we wanted to use our own trick while having to turn on a horizontal plateform. The track at those points is indeed known to be tricky, because the path splits into a "Y" shape, which can easily end in having the robot following the wrong path and falling from the track, if using light sensors.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">This means that, at the beginning, the robot knows that it will first go on a slope and have to follow a line. Then it will encounter a plateform, will detect it, and will have to turn right, before catching the line on the slope again and driving upward to the next plateform, and so on. Once arrived on the fourth plateform, that is, the upper one, it has to do a half turn and go back the track. Once the last (bottom) plateform is reached, the robot stops and displays the result.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Basically, the main part of our program [1] looks like that :</div><blockquote style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-color: rgb(187, 187, 187); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: dashed; border-top-width: 1px; font-family: monospace; font-size: 12px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;"><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"><table id="src_table_0" style="border-collapse: collapse; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><tbody style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<tr id="sl_svn31_438" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> prg</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">setC</span><span class="pun" style="color: #666600;">(); //Calibration of light sensors</span></td></tr>
<tr id="sl_svn31_439" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_440" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">while</span><span class="pun" style="color: #666600;">(!</span><span class="typ" style="color: #660066;">Button</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">LEFT</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">isPressed</span><span class="pun" style="color: #666600;">()){}</span></td></tr>
<tr id="sl_svn31_441" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Thread</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">sleep</span><span class="pun" style="color: #666600;">(</span><span class="lit" style="color: #006666;">1000</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_442" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> prg</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">setTiltOffset</span><span class="pun" style="color: #666600;">(); // tilt sensor knows now what a plateform is</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_443" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_444" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Stopwatch</span><span class="pln" style="color: black;"> stopwatch </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Stopwatch</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_445" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_446" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> prg</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">moveForwardTacho</span><span class="pun" style="color: #666600;">(</span><span class="lit" style="color: #006666;">200</span><span class="pun" style="color: #666600;">); // move forward to reach the slope</span></td></tr>
<tr id="sl_svn31_447" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_448" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> LCD</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">clear</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_449" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> prg</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">trackLineSegment</span><span class="pun" style="color: #666600;">(); // track the line until new plateform</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_450" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_451" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr id="sl_svn31_452" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> th</span><span class="pun" style="color: #666600;">.</span><span class="typ" style="color: #660066;">Turn</span><span class="pun" style="color: #666600;">(</span><span class="typ" style="color: #660066;">Direction</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">RIGHT</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lL</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lM</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lR</span><span class="pun" style="color: #666600;">); // turn right until new slope reached</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_453" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr id="sl_svn31_454" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> prg</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">trackLineSegment</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_455" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr id="sl_svn31_456" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> th</span><span class="pun" style="color: #666600;">.</span><span class="typ" style="color: #660066;">Turn</span><span class="pun" style="color: #666600;">(</span><span class="typ" style="color: #660066;">Direction</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">LEFT</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lL</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lM</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lR</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_457" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr id="sl_svn31_458" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> prg</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">trackLineSegment</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_459" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr id="sl_svn31_460" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> prg</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">followLineTacho</span><span class="pun" style="color: #666600;">(</span><span class="lit" style="color: #006666;">400</span><span class="pun" style="color: #666600;">); // follow the line on the upper plateform for a limited number of rotations</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_461" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr id="sl_svn31_462" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> th</span><span class="pun" style="color: #666600;">.</span><span class="typ" style="color: #660066;">Turn180</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">lL</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lM</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lR</span><span class="pun" style="color: #666600;">); // make a half turn</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_464" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> prg</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">trackLineSegment</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_466" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> th</span><span class="pun" style="color: #666600;">.</span><span class="typ" style="color: #660066;">Turn</span><span class="pun" style="color: #666600;">(</span><span class="typ" style="color: #660066;">Direction</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">RIGHT</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lL</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lM</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lR</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_467" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr id="sl_svn31_468" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> prg</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">trackLineSegment</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_470" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> th</span><span class="pun" style="color: #666600;">.</span><span class="typ" style="color: #660066;">Turn</span><span class="pun" style="color: #666600;">(</span><span class="typ" style="color: #660066;">Direction</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">LEFT</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lL</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lM</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> lR</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_472" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> prg</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">trackLineSegment</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_473" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> prg</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">moveForwardTacho</span><span class="pun" style="color: #666600;">(</span><span class="lit" style="color: #006666;">300</span><span class="pun" style="color: #666600;">); // move forward on the lower plateform to make sure the robot is fully contained in the green zone</span></td></tr>
</tbody></table></span></blockquote></div><div><br />
The robot won't start an other task in the sequence before making sure it has to do so. Therefore it will not do a right turn before being on a horizontal plateform, which will be check by the previous line follower part.<br />
<br />
</div><div><b><span class="Apple-style-span" style="font-size: x-large;">III. Implementation</span></b></div><div><b><span class="Apple-style-span" style="font-size: x-large;"><br />
</span></b></div><div><b>III. 1. Following the lines</b></div><div><br />
III. 1. a. Calibrating the sensors<br />
<br />
<div style="text-align: justify;">Using more than one sensor, we cannot assume they have all the exact same constants and return the same value while scanning a surface. This entails that we have to take differents thresholds into account. Moreover, we know that read values are never the same depending on ambient light (even if we tried to physically reduce this "noise") and battery level. On top of that, calibrating three sensors mouted so closed on the same robot is somewhat sometimes challenging. We therefore need to have a robot able to calibrate itself.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Calibrating means saving minimal and maximal values seen by each sensor on our track. So, during one loop, we take care of only one sensor, and we scan repeatedly the line looking for the highest and lowest values. We made it also be able to find by itself what is the black line and what is the white surface, by having it looking or a significant drop in read values. This routine is done many times, so we can get a good average of our thresholds, since there always are some variation in the readings.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">The method uses also a pulse width modulation [2] (PWM) to control the motors. We have heard from this during one lecture, and it was a good way to try it there. It worked great, and the robot behaved pretty well during the scanning calibration.<br />
<span class="Apple-style-span" style="font-family: Georgia, serif; font-size: 16px;"></span><br />
<blockquote style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(187, 187, 187); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: dashed; border-top-width: 1px; font-family: monospace; font-size: 12px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;"><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"><table id="src_table_0" style="border-collapse: collapse; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><tbody style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<tr id="sl_svn22_58" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="kwd" style="color: #000088;">void</span><span class="pln" style="color: black;"> scanLineMotorControl</span><span class="pun" style="color: #666600;">(</span><span class="kwd" style="color: #000088;">int</span><span class="pln" style="color: black;"> iDir</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">throws</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">InterruptedException</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_59" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{ // PWM (Pulse width modulation)</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_60" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">iSLMC </span><span class="pun" style="color: #666600;">==</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">0</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_61" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">iDir </span><span class="pun" style="color: #666600;">==</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">-</span><span class="lit" style="color: #006666;">1</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_62" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="com" style="color: #880000;">// motor left</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_63" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> LEFT</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">setPower</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">POWER_SCAN</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_64" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> LEFT</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">backward</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_65" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> RIGHT</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">setPower</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">POWER_SCAN</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_66" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> RIGHT</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">forward</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_67" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn22_68" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="com" style="color: #880000;">// motor right</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_69" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> LEFT</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">setPower</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">POWER_SCAN</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_70" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> LEFT</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">forward</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_71" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> RIGHT</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">setPower</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">POWER_SCAN</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_72" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> RIGHT</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">backward</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_73" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn22_74" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> iSLMC </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">2</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn22_75" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn22_76" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="com" style="color: #880000;">// brake</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn22_77" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> offAll</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_78" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> iSLMC</span><span class="pun" style="color: #666600;">--;</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_79" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn22_80" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Thread</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">sleep</span><span class="pun" style="color: #666600;">(</span><span class="lit" style="color: #006666;">10</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn22_81" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span></td></tr>
</tbody></table></span></blockquote><br />
III. 2. b. Tracking a line</div><br />
<div style="text-align: justify;">Line tracking was done using only two of the three sensors we had (the rightmost and the leftmost). We have coded a basic algorithm, which gets what we called the position of the robot by taking the difference between the right and left values read by the sensors. After adding a constant to this difference, we get a value which is equal to zero when we are on the line, negative when we are left to the line, and positive when we are on its right side. Using this information, we control the motors to go left or right. </div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">The middle sensor was then used to go straight forward if the position value is close to zero. This algorithm was enough to follow the straight line at a fair speed. We however encountered some difficulties to catch the line again after having made a turn, because the robot was inclined to overshoot the line (it sees it, but does not have the time to correct itself enough). Some good programming in the turn part solved this problem.</div><div style="text-align: justify;"><br />
</div></div><div><div style="text-align: justify;"><br />
</div></div><div><b>III. 2. Detecting platforms</b><br />
<b><br />
</b></div><div><div style="text-align: justify;">III. 1 . a. Tilt sensor</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">We decided to use a acceleration/tilt sensor [3] to detect plateforms and therefore know when to turn. A tilt sensor is able to measure tilt in three axis (gravity is indeed perceived as acceleration). To detect a change in the robot's tilt, we have to repeatedly look for the x value, x being the axis along which the robot is moving while going forward. Since we wanted to know as soon as possible when we reach a plateform, we needed to put the sensor in front of the robot, on a part which moves when the sloping is different. That is why we put it on the light sensors block.</div><table align="center"><tbody>
<tr> <td><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyN5VfO0RRt7nAgEZRqtF76iNLaFOn6Ue3qS4CRPf-q-4spjUFhJ-LbRxg01utB7mEaNm6WETmtP6uRWEc4QtJPvwPwmjZ_c6JMfwNUNrS4dxUR-2zJG8j0qRpN_KZTzohH-htPQl2oCI/s1600/tilt_pos1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiyN5VfO0RRt7nAgEZRqtF76iNLaFOn6Ue3qS4CRPf-q-4spjUFhJ-LbRxg01utB7mEaNm6WETmtP6uRWEc4QtJPvwPwmjZ_c6JMfwNUNrS4dxUR-2zJG8j0qRpN_KZTzohH-htPQl2oCI/s320/tilt_pos1.jpg" width="320" /></a></td> <td><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhu89-5p9IzJej75MRXo-RJz6IgqiNqRAQMRkuKJ81i-nIB0mNlPzzjapuZCKmhghIt8juihEUnTUwrqIBnyh67oeFPxNEK7vAy-U0AetBsWjzZw-yXvvwnRmb0W7blpEPV0pBq8mAmJV4/s1600/tilt_pos2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhu89-5p9IzJej75MRXo-RJz6IgqiNqRAQMRkuKJ81i-nIB0mNlPzzjapuZCKmhghIt8juihEUnTUwrqIBnyh67oeFPxNEK7vAy-U0AetBsWjzZw-yXvvwnRmb0W7blpEPV0pBq8mAmJV4/s320/tilt_pos2.jpg" width="320" /></a></td> </tr>
</tbody></table><div style="text-align: center;">You can see that the position of the tilt sensor is different enough to tell us whether the robot is one a slope or not.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">III. 2. b. Slopes and plateforms<br />
<br />
The problem we had to cope with while using this sensor is that we sometimes got random values that are clearly wrong because far from the usual values (e.g. our normal values on the x-axis range from about 15 to 35, whereas we could sometimes get something like 1020). This is often due to sharp movements while following a line, which can be seen like bumps, therefore as accelerations and tilts. So we couln't afford to just wait for the value to be larger than a defined threshold in order to detect a slope.<br />
<br />
Here is what we ended with. When we start the robot on the lowest plateform (green zone), we wait for one second (making sure nobody is touching the robot), we first look for the tilt value, and set it as the default value (offset) for a plateform (all four plateforms are horizontal and therefore have quite the same slope). Then, we look for the next plateform, but not before having been on a slope before (we keep a status structure up to date for that).<br />
<br />
While we are sampling the values returned by the tilt sensor, we throw away faulty values (that are below and beyond a threshold depending on our offset), and we add the others to a queue. Once the queue reach a size of 15 elements, we begin to make an average of the values inside. Each time we add a new element, we delete the older one in the queue to just keep recent values in memory (we want to react to the recent past). So, to detect a flat surface, we now compare the offset value and the newly computed average value. If the difference is below a defined threshold, we can be sure we are on the sought plateform (and it is not a random value due to some bump, because the last 15 values are quite the same on average - moreover, remember that really faulty values are even not in the queue). If the difference is below a defined threshold, that means we are on a slope and we can start looking for a flat surface.<br />
<br />
<span class="Apple-style-span" style="font-family: Georgia, serif; font-size: 16px;"></span><br />
<blockquote style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-color: rgb(187, 187, 187); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: dashed; border-top-width: 1px; font-family: monospace; font-size: 12px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;"><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"><table id="src_table_0" style="border-collapse: collapse; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><tbody style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<tr id="sl_svn31_184" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> tiltv </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> tilt</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">getXTilt</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_185" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">tiltv </span><span class="pun" style="color: #666600;"><=</span><span class="pln" style="color: black;"> tiltOffset </span><span class="pun" style="color: #666600;">+</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">20</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">&&</span><span class="pln" style="color: black;"> tiltv </span><span class="pun" style="color: #666600;">>=</span><span class="pln" style="color: black;"> tiltOffset </span><span class="pun" style="color: #666600;">-</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">20</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_186" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_187" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> queue</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">push</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">tiltv</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_188" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> discarded </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">false</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_189" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_190" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> discarded </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">true</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_191" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_192" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">queue</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">size</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">>=</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">15</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_193" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_194" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> aveTilt </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> getAverage</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">queue</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_195" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">m_state </span><span class="pun" style="color: #666600;">==</span><span class="pln" style="color: black;"> state</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">lookingForInclination</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_196" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_197" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="typ" style="color: #660066;">Math</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">abs</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">aveTilt </span><span class="pun" style="color: #666600;">-</span><span class="pln" style="color: black;"> tiltOffset</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">>=</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">6</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_198" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_199" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> m_state </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> state</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">lookingForFlat</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_200" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> il</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">log</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">"*lookingForFlat*"</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_201" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_202" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_203" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="typ" style="color: #660066;">Math</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">abs</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">aveTilt</span><span class="pun" style="color: #666600;">-</span><span class="pln" style="color: black;">tiltOffset</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;"><=</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">2</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_204" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_205" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Car</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">stop</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_206" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> il</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">log</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">"=Flat Found="</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_207" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">break</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_208" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_209" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn31_210" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> queue</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">pop</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn31_211" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span></td></tr>
</tbody></table></span></blockquote></div></div><div><div style="text-align: justify;"><br />
We needed to tune our values, especially the size of the queue, in order to have a rabot reacting quickly and accurately enough at the same time/<br />
<br />
</div></div><div><b>III. 3. Turning right / left</b></div><div><span class="Apple-style-span" style="color: red;">Anders</span></div><div><br />
</div><div><b>III. 4. Turning back</b></div><div><span class="Apple-style-span" style="color: red;">Anders</span></div><div><br />
</div><div><b>III. 5. Role of Bluetooth logger / debugging</b></div><div><span class="Apple-style-span" style="color: red;">Anders (feel free to organize all your parts differently and add other topics :) ).</span></div><div><br />
</div><div><br />
</div><div><h3 style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; position: relative; text-align: justify;"><span class="Apple-style-span" style="color: black; font-family: 'Times New Roman';"><span class="Apple-style-span" style="font-size: medium; font-weight: normal; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="font-size: x-large; line-height: 18px;"><b><span class="Apple-style-span" style="color: black; font-family: 'Times New Roman'; font-size: medium; font-weight: normal; line-height: normal;"><b><span class="Apple-style-span" style="font-size: x-large;">IV. Results and proofs</span></b></span></b></span></span></span></span></h3><div><span class="Apple-style-span" style="color: black; font-family: 'Times New Roman';"><span class="Apple-style-span" style="font-size: medium; font-weight: normal; line-height: normal;"><span class="Apple-style-span" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif;"><span class="Apple-style-span" style="font-size: x-large; line-height: 18px;"><b><span class="Apple-style-span" style="color: black; font-family: 'Times New Roman'; font-size: medium; font-weight: normal; line-height: normal;"><b><span class="Apple-style-span" style="font-size: x-large;"><br />
</span></b></span></b></span></span></span></span></div><div class="separator" style="clear: both; text-align: left;">After hours of calibration, tuning, trials and errors, rewriting of code and testing, here are finally our results for the robot race : </div><div class="separator" style="clear: both; text-align: center;"><br />
</div><table align="center"><tbody>
<tr> <td><br />
<div class="separator" style="clear: both; text-align: center;">First one : 38.719 sec</div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dwya9W-2kc3ehLxBRgCbTRcluCDQPPb5H9pQjUWkywhwDqBubpx3odsbAkd5QfrlKXoBFf1ksa4dYgxpr0GZQ' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div></td> <td><br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIZlbioU76LRI5TyraWd78CDTbqFyjysfOj-qFsF8qYUp9-E2S-97dyzx2DCp-5jKM1ZpfB72L_KQy0TxxWrlZM5kf7N9H0AnMkK3sYPaHXNcJ6A4BcbhZDoWj3OkyB0nse4WzhtpnbAo/s1600/lego_competition+005.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiIZlbioU76LRI5TyraWd78CDTbqFyjysfOj-qFsF8qYUp9-E2S-97dyzx2DCp-5jKM1ZpfB72L_KQy0TxxWrlZM5kf7N9H0AnMkK3sYPaHXNcJ6A4BcbhZDoWj3OkyB0nse4WzhtpnbAo/s320/lego_competition+005.jpg" width="320" /></a></div></td> </tr>
</tbody></table><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;">Another video : 39.123 seconds</div><div style="text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dz3zzE7emoyzo2kmPVzXVdp63kmJo3XmPu3-kSxYkwvOj1BaUu_GNismuQnQ81PeFhKF-Oq7S1Dfhv17bR0fQ' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div class="separator" style="clear: both; text-align: center;"><br />
</div><div class="separator" style="clear: both; text-align: center;">We also managed to get a time of 38.442 seconds, but we weren't taking a video :</div><div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4XXQr7R0zM6gYBVftAdJjpygJna5aMNym_-2H4ECLoi2_h2coblsvfuC2HaVcl15LJZpYdWp1jupv30yHhd9MsSsQA21ow2swEUaHqdpRYo6kS9kgJp80wpXp-sZYmFWl9N2JV-z5XWk/s1600/lego_competition+050.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="240" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEg4XXQr7R0zM6gYBVftAdJjpygJna5aMNym_-2H4ECLoi2_h2coblsvfuC2HaVcl15LJZpYdWp1jupv30yHhd9MsSsQA21ow2swEUaHqdpRYo6kS9kgJp80wpXp-sZYmFWl9N2JV-z5XWk/s320/lego_competition+050.jpg" width="320" /></a></div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;"><br />
</div><div class="separator" style="clear: both; text-align: left;"><span class="Apple-style-span" style="font-size: x-large;"><b>V. References</b></span></div><div class="separator" style="clear: both; text-align: left;">[1] Remember that you can check out all our source code on <a href="http://code.google.com/p/legointernational/source/browse/#svn/trunk/ legointernational/LegoLab/src">our Google code webpage</a>. For this competition, just browse through lesson 6 directory.</div><div class="separator" style="clear: both; text-align: left;">[2] <a href="http://www.netrino.com/Embedded-Systems/How-To/PWM-Pulse-Width-Modulation">Introduction to Pulse Width Modulation </a>(PWM) on netrino.com</div><div class="separator" style="clear: both; text-align: left;">[3] <a href="http://www.hitechnic.com/cgi-bin/commerce.cgi?preadd=action&key=NAC1040">Tilt sensor documentation</a> on HiTechnic</div></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-30743032309223667082010-09-30T10:31:00.021+02:002010-10-15T12:21:32.374+02:00Lab Session 5 : Preparation for the Robot Race<div style="text-align: justify;">Date: 30. September 2010</div><div style="text-align: justify;">Duration of activity:</div><div style="text-align: justify;">Group members participating : all group members, that is Michal Owsinski, Anders Dyhrberg, Guillaume Depoyant, Michaël Ludmann.</div><div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><b><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: x-large;">I. Objectives and summary</span></span></b></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><b>I. 1. Objectives</b></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">In this lab session we are suppose to make the LEGO 9797 car follow a black line and stop at the end of the line when the car drives into a goal zone - a green rectangular piece of paper at the end of the black line. The idea is that we will try to use the light sensor to detect three different colors.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><b>I. 2. Summary</b></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Line follower with calibration</div><div style="text-align: justify;">Color sensor with calibration</div><div style="text-align: justify;">Line follower that stops in a goal zone</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><b><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: x-large;">II. Line follower with calibration</span></span></b></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><b>II. 1. Finding good input values for PID</b></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">To make the robot follow the line we used the proportional regulation described in the [1] document. This page is worth reading thoroughly, since it explains steps by steps how to methodically calibrate each PID value. On top of that, it provides a really good understanding of how and why those values can make the system actually behave better.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">First we calibrated the Kp value simply by trying different values. Kp=Kc. Our final value was Kc=1000. Then we measured the oscillation period Pc ("The oscillation period (Pc) is how long it takes the robot to swing from one side of the line to the other then back to the side where it started. " [1]), which was Pc= 0,25 seconds. Then we measured the time of one control loop of our line follower program - dT=10 ms.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">To get those results properly and with a good accuracy, we ran the robot for a chosen amount of oscillations or loops (preferably a big number : like 20 oscillations or 10000 loops) and we recorded the time taken by the robot to fulfill the goal.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">We used the table below to calculate the Kp, Ki, and Kd values, depending on what kind of control we wanted to implement (that is : P, PI, or the full PID).</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">table source: [1] A PID controller for lego mindstorms Robots</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><table align="center" border="2" style="text-align: center;"><tbody>
<tr> <td colspan="5" style="text-align: center;"><span style="font-weight: bold;">Ziegler–Nichols<br />
method giving</span><span style="font-style: italic; font-weight: bold;"> <br />
K'</span><span style="font-weight: bold;"> values</span><br />
<br />
<span style="font-weight: bold;">(loop times<br />
considered to be<br />
constant and equal to dT)</span><br />
<br />
</td> </tr>
<tr> <td style="text-align: center;"><b>Control Type</b></td> <td style="font-weight: bold; text-align: center;"><span class="texhtml">Kp</span></td> <td style="font-weight: bold; text-align: center;"><span class="texhtml">Ki'</span></td> <td style="font-weight: bold; text-align: center;"><span class="texhtml">Kd'</span></td> </tr>
<tr> <td style="text-align: center;"><i>P</i></td> <td style="text-align: right;"><span class="texhtml">0.50<i>K</i><sub><i>c</i></sub></span></td> <td style="text-align: center;">0</td> <td style="text-align: center;">0</td> </tr>
<tr> <td style="text-align: center;"><i>PI</i></td> <td style="text-align: right;"><span class="texhtml">0.45<i>K</i><sub><i>c</i></sub></span></td> <td style="text-align: right;"><span class="texhtml">1.2<i>K</i><sub><i>p</i></sub>dT/<br />
<i>P</i><sub><i>c</i></sub></span></td> <td style="text-align: center;">0</td> </tr>
<tr> <td style="text-align: center;"><i>PID</i></td> <td style="text-align: right;"><span class="texhtml">0.60<i>K</i><sub><i>c</i></sub></span></td> <td style="text-align: right;"><span class="texhtml">2<i>K</i><sub><i>p</i></sub>dT<br />
/ <i>P</i><sub><i>c</i></sub></span></td> <td style="text-align: right;"><span class="texhtml"><i>K</i><sub><i>p</i></sub><i>P</i><sub><i>c</i></sub> <br />
/ (8dT)</span></td> </tr>
</tbody> </table><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">We therefore ended with those values :</div><ul><li style="text-align: justify;">For a Proportional system only :</li>
<ul><li style="text-align: justify;">Kp = 500</li>
</ul><li style="text-align: justify;">Por a Proportional Derivative sytem :</li>
<ul><li style="text-align: justify;">Kp = 450</li>
<li style="text-align: justify;">Ki = 21,6</li>
</ul><li style="text-align: justify;">For a full PID system :</li>
<ul><li style="text-align: justify;">Kp = 600</li>
<li style="text-align: justify;">Ki = 48</li>
<li style="text-align: justify;">Kd = 3</li>
</ul></ul><div style="text-align: justify;"><br />
</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;"><b>II. 2. Code and results</b></div></div><div><div style="text-align: justify;"><b><br />
</b></div></div><div><div style="text-align: justify;">Obviously, such figures don't mean anything if we do not talk about the code implemeting them. Because the way it is done make it indeed necessary for us to multiply Kp, Ki and Kd by 100 (so the real values seen above should be 100 times smaller).</div></div><div><div style="text-align: justify;"><br />
</div></div><div><div style="text-align: justify;">So, eventually, we have the code below, all embedded in a while loop :</div></div><div><div style="text-align: justify;"><br />
</div></div><div><blockquote style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-color: rgb(187, 187, 187); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: dashed; border-top-width: 1px; font-family: monospace; font-size: 12px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;"><div style="text-align: justify;"><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<table id="src_table_0" style="border-collapse: collapse; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><tbody style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<tr id="sl_svn19_67" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> lightValue </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> sensor</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">light</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_68" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> error </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> lightValue </span><span class="pun" style="color: #666600;">-</span><span class="pln" style="color: black;"> offset</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_69" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;"> lastError </span><span class="pun" style="color: #666600;">*</span><span class="pln" style="color: black;"> error </span><span class="pun" style="color: #666600;"><</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">0</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_70" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> integral </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">0</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_71" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn19_72" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_73" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> integral </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">integral </span><span class="pun" style="color: #666600;">+</span><span class="pln" style="color: black;"> error</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span><span class="com" style="color: #880000;">// calculate the integral </span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_74" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_75" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> derivative </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> error </span><span class="pun" style="color: #666600;">-</span><span class="pln" style="color: black;"> lastError</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span><span class="com" style="color: #880000;">// calculate the derivative</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_76" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Turn</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Kp</span><span class="pun" style="color: #666600;">*</span><span class="pln" style="color: black;">error </span><span class="pun" style="color: #666600;">+</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Ki</span><span class="pun" style="color: #666600;">*</span><span class="pln" style="color: black;">integral </span><span class="pun" style="color: #666600;">+</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Kd</span><span class="pun" style="color: #666600;">*</span><span class="pln" style="color: black;">derivative</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span><span class="com" style="color: #880000;">// P, I and D terms</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_77" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Turn</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Turn</span><span class="pun" style="color: #666600;">/</span><span class="lit" style="color: #006666;">100</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span><span class="com" style="color: #880000;">// REMEMBER to undo the affect of the factor of 100 in Kp, Ki and Kd!</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_78" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> powerA </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Tp</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">+</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Turn</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span><span class="com" style="color: #880000;">// the power level for the A motor</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_79" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> powerC </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Tp</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">-</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Turn</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span><span class="com" style="color: #880000;">// the power level for the C motor</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_80" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_81" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">powerA </span><span class="pun" style="color: #666600;">></span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">100</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_82" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_83" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> powerA </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">100</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_84" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_85" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">powerA </span><span class="pun" style="color: #666600;"><</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">0</span><span class="pun" style="color: #666600;">){</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_86" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> powerA </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">0</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_87" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_88" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_89" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">powerC </span><span class="pun" style="color: #666600;">></span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">100</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_90" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_91" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> powerC </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">100</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_92" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_93" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">powerC </span><span class="pun" style="color: #666600;"><</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">0</span><span class="pun" style="color: #666600;">){</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_94" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> powerC </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">0</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_95" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_96" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_97" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_98" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">MotorPort</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">A</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">controlMotor</span><span class="pun" style="color: #666600;">((</span><span class="kwd" style="color: #000088;">int</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> powerA</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">1</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_99" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">MotorPort</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">C</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">controlMotor</span><span class="pun" style="color: #666600;">((</span><span class="kwd" style="color: #000088;">int</span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"> powerC</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">1</span><span class="pun" style="color: #666600;">);</span></td></tr>
<tr id="sl_svn19_104" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn19_105" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> lastError </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> error</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"> </span></td></tr>
</tbody></table></div></blockquote></div><div class="separator" style="clear: both; text-align: justify;">As for the results, it was not so obvious that the theory would apply exactly in the real world as we wanted it to do. And in fact, despite the previous measurements, we still needed to do some tuning in the PID values. The article we read in [1] made us espect that and was quite good at providing the answers in what and how we still had to change.</div><div class="separator" style="clear: both; text-align: justify;"><br />
</div><div class="separator" style="clear: both; text-align: justify;">The proportinal only system (i.e. putting Ki and Kd equal to zero) was quite straightforward and immediatly worked. The challenge increased while using the integral term, but we still succeeded in having our robot doing its task without failing - as you can see in the video below.</div><div class="separator" style="clear: both; text-align: justify;"><br />
</div><div class="separator" style="clear: both; text-align: center;"><br />
</div><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dw-_CegP26d1Hg98kYGSfF40Hv3qHDPEl0ry-02cEBXBmqlPRfslTyf1XMnk6Ee2cqMRnDSGmcGgoATzooh' class='b-hbp-video b-uploaded' frameborder='0'></iframe><br />
<div style="text-align: justify;"><br />
</div><div style="text-align: justify;">However, for some reason, the integral term messed up the system, and we didn't have enough time to figure it out. But we will do that for sure, since it has proven to be a really efficient and accurate way of properly controlling our motors - we will certainly need that again in a future project.<br />
<br />
</div><div style="text-align: justify;"><span class="Apple-style-span" style="font-size: x-large;"><b>III. Black White sensor with calibration</b></span><br />
<br />
<div style="display: inline !important;"><span class="Apple-style-span" style="color: black;"><span class="Apple-style-span" style="font-weight: normal;">Basically, this technique takes two values in order to initiate itself and follow the line. Those two values are kept in memory (called "white value" and "black value") and then a average value is computed (obviously, the average between the black and the white)</span></span></div></div><div style="text-align: justify;"><span class="Apple-style-span" style="color: red;"><b></b></span><br />
<span class="Apple-style-span" style="color: red;"><b></b></span><br />
<span class="Apple-style-span" style="color: red;"><b><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: black;"><span class="Apple-style-span" style="font-weight: normal;"><br />
</span></span></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><span class="Apple-style-span" style="color: black;"><span class="Apple-style-span" style="font-weight: normal;">This way, in order to detect if the sensor is sampling white or black, we just need to compare the value with the middle value: either we're above (white), either we're below (black). This technique is quite efficient but knowing that we had to use it later for three colors (black, white and the color of the arrival), we had to think about another tip.</span></span></div><div><br />
</div></b></span></div><div style="text-align: justify;"><span class="Apple-style-span"><b><span class="Apple-style-span" style="font-size: x-large;">IV. Line follower that stops in a goal zone</span></b></span></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">The problem with the robot stopping in a goal zone was not solved on todays lab session due to lack of time. However We had an idea which could solve the problem. Our proposition was to implement in to the sample loop a condition that would check last 3 or 4 samples (to avoid the problem with the black-white edge) which would compare those samples with the predefined color value on which the robot should stop.</div><div style="text-align: justify;"><b><br />
</b></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div style="text-align: justify;">So this way, we took the BlackWhiteSensor file and add another condition. The "average" value was still the main technique used in order to find the first two colors, but so as to figure out wether the sensor was sampling the color of the arrival, we made a loop: if the sampled value was close to the arrival color with an error epsilon and for N times straight, we assumed that the robot had to stop (epsilon and N can be edited)<br />
<br />
<div style="text-align: auto;"><span class="Apple-style-span" style="font-family: monospace; font-size: small;"><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; font-size: 12px; white-space: pre-wrap;"> </span></span></div></div></div><div><blockquote style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; border-bottom-color: rgb(187, 187, 187); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(187, 187, 187); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(187, 187, 187); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(187, 187, 187); border-top-style: dashed; border-top-width: 1px; font-family: monospace; font-size: 12px; padding-bottom: 10px; padding-left: 10px; padding-right: 10px; padding-top: 10px;"><div style="text-align: justify;"><span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 2px; -webkit-border-vertical-spacing: 2px; border-collapse: collapse; white-space: pre;"></span><br />
<table id="src_table_0" style="border-collapse: collapse; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><tbody style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<tr id="sl_svn19_67" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><br />
<span class="Apple-style-span" style="white-space: pre;"></span><br />
<span class="Apple-style-span" style="white-space: pre;"></span><br />
<span class="Apple-style-span" style="white-space: pre;"></span><br />
<span class="Apple-style-span" style="white-space: pre;"></span><br />
<span class="Apple-style-span" style="white-space: pre;"><table id="src_table_0" style="border-collapse: collapse; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><tbody style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;">
<tr id="sl_svn20_25" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">final</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">int</span><span class="pln" style="color: black;"> power </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">80</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_26" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">int</span><span class="pln" style="color: black;"> i </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">0</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_27" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><br />
</td></tr>
<tr id="sl_svn20_28" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ColorBWSensor</span><span class="pln" style="color: black;"> sensor </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">new</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">ColorBWSensor</span><span class="pun" style="color: #666600;">(</span><span class="typ" style="color: #660066;">SensorPort</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">S3</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_29" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">String</span><span class="pln" style="color: black;"> black </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">"black"</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_30" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">String</span><span class="pln" style="color: black;"> white </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">"white"</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_31" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">String</span><span class="pln" style="color: black;"> color </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="str" style="color: #008800;">"finish color"</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_33" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><br />
</td></tr>
<tr id="sl_svn20_34" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> sensor</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">calibrate</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_35" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn20_36" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> LCD</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">clear</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_37" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> LCD</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">drawString</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">"Light: "</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">0</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">2</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn20_38" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> LCD</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">drawString</span><span class="pun" style="color: #666600;">(</span><span class="str" style="color: #008800;">"Color: "</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">0</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">3</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn20_39" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr id="sl_svn20_40" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn20_41" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">while</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">(!</span><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Button</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">ESCAPE</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">isPressed</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">||</span><span class="pln" style="color: black;"> i </span><span class="pun" style="color: #666600;"><</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">5</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_42" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_43" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr id="sl_svn20_44" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> LCD</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">drawInt</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">sensor</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">light</span><span class="pun" style="color: #666600;">(),</span><span class="lit" style="color: #006666;">4</span><span class="pun" style="color: #666600;">,</span><span class="lit" style="color: #006666;">10</span><span class="pun" style="color: #666600;">,</span><span class="lit" style="color: #006666;">2</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_45" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> LCD</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">refresh</span><span class="pun" style="color: #666600;">();</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_46" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn20_47" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;"> sensor</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">finishColor</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">){</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_48" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> LCD</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">drawString</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">color</span><span class="pun" style="color: #666600;">,</span><span class="lit" style="color: #006666;">1</span><span class="pun" style="color: #666600;">,</span><span class="lit" style="color: #006666;">4</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_49" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> i</span><span class="pun" style="color: #666600;">++;</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_50" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_51" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">else</span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_52" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> i </span><span class="pun" style="color: #666600;">=</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">0</span><span class="pun" style="color: #666600;">;</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_53" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn20_54" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">if</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;"> sensor</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">black</span><span class="pun" style="color: #666600;">()</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">)</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_55" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_56" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Car</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">forward</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">power</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> </span><span class="lit" style="color: #006666;">0</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_57" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> LCD</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">drawString</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">black</span><span class="pun" style="color: #666600;">,</span><span class="lit" style="color: #006666;">1</span><span class="pun" style="color: #666600;">,</span><span class="lit" style="color: #006666;">4</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_58" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_59" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="kwd" style="color: #000088;">else</span><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">{</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_60" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Car</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">forward</span><span class="pun" style="color: #666600;">(</span><span class="lit" style="color: #006666;">0</span><span class="pun" style="color: #666600;">,</span><span class="pln" style="color: black;"> power</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_61" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> LCD</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">drawString</span><span class="pun" style="color: #666600;">(</span><span class="pln" style="color: black;">white</span><span class="pun" style="color: #666600;">,</span><span class="lit" style="color: #006666;">1</span><span class="pun" style="color: #666600;">,</span><span class="lit" style="color: #006666;">4</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_62" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn20_63" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span></td></tr>
<tr id="sl_svn20_64" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr id="sl_svn20_65" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span></td></tr>
<tr id="sl_svn20_66" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="typ" style="color: #660066;">Thread</span><span class="pun" style="color: #666600;">.</span><span class="pln" style="color: black;">sleep</span><span class="pun" style="color: #666600;">(</span><span class="lit" style="color: #006666;">10</span><span class="pun" style="color: #666600;">);</span><span class="pln" style="color: black;"><br />
</span></td></tr>
<tr id="sl_svn20_67" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"></td></tr>
<tr id="sl_svn20_68" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><td class="source" style="font-size: 12px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 4px; padding-right: 0px; padding-top: 0px; vertical-align: top; white-space: pre-wrap;"><span class="pln" style="color: black;"> </span><span class="pun" style="color: #666600;">}</span></td></tr>
</tbody></table></span></td></tr>
</tbody></table></div></blockquote></div><div style="text-align: justify;"><span class="Apple-style-span" style="font-size: x-large;"><b><br />
</b></span><br />
<span class="Apple-style-span" style="font-size: x-large;"><b>V. References</b></span></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><a href="http://www.inpharmix.com/jps/PID_Controller_For_Lego_Mindstorms_Robots.html">[1] A PID Controller For Lego Mindstorms Robots</a> - really worth the reading !</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div></div>Michalhttp://www.blogger.com/profile/01565336356842989740noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-28550924398529449672010-09-23T16:07:00.015+02:002010-10-07T10:44:09.105+02:00Lab session 4 : LEGO Segway<h3 style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; position: relative; text-align: justify;"><span class="Apple-style-span" style="font-weight: normal;">Date: 23. September 2010</span><br />
<br />
<br />
<br />
<br />
<br />
<div style="text-align: auto;"><span class="Apple-style-span" style="font-weight: normal;"><br />
Duration of activity: 5 hours (11:00 - 16:00)<br />
Group members participating : all group members, that is Anders Dyhrberg, Guillaume Depoyant, Michaël Ludmann and Michal Owsinski.</span><br />
<br />
I. Objectives and summary</div></h3><div style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;"><br />
</div><div style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;"><h4 style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; position: relative;">I. 1. Objectives</h4><div>Trying to build a robot able to balance itself using only two wheels and a light sensor.</div></div><div style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;"><span class="Apple-style-span" style="font-weight: bold;"><br />
</span></div><div style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;"><span class="Apple-style-span" style="font-weight: bold;">I. 2. Summary</span></div><div style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;">During this lab session, we managed to :</div><div style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 18px; text-align: justify;"><div><ul style="line-height: 1.4; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 2.5em; padding-right: 2.5em; padding-top: 0px;"><li style="margin-bottom: 0.25em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: 0px;">Study and implement some examples for balancing legway robots</li>
<li style="margin-bottom: 0.25em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: 0px;">Build two different models to find the best one</li>
<li style="margin-bottom: 0.25em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: 0px;">Use given source code [1] and change some parameters to fit our own robot</li>
</ul><div>After this lab session, some of us continued to work at home, and we therefore manage to :</div><div><ul style="line-height: 1.4; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.5em; padding-bottom: 0px; padding-left: 2.5em; padding-right: 2.5em; padding-top: 0px;"><li style="margin-bottom: 0.25em; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-indent: 0px;">Enable bluetooth dialog between the NXT and a computer</li>
<li>Exchange and vizualize on a computer data in "real time" coming from the NXT by BT</li>
<li>Build an other version of the Legway and experiment with it</li>
</ul></div><div><br />
<br />
<h3 style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; position: relative; text-align: justify;"><span style="font-size: 14pt;">II. Bluetooth communication : how to make experiments easier</span></h3><div style="text-align: justify;"></div><div><br />
This was not a part of the assigned task for this lab session. But we realized that debugging was tedious and time consuming on the NXT. And it was interrupting our work flow, to continuously reconnect and downloading the debug logs from from the Brick.<br />
In order to make this more easy for us, we extended our already engineered MultiLogger with a BluetoothLogger both based on the same interface ILogger to make them interchangeable.<br />
Fairly simple to implement and clearly use full. For now we are just using the 'nxjconsole' on the PC in order to read the stream sent from the NXT.<br />
<br />
To test how well it was performing and how much data we can push through, we implemented a revised version of our SoundSampling program from Lab Session 3 where we log the sound levels as fast as we can read them, and convert it to a char array of '*'<br />
This gave the following interesting video.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dyLFcPzqdWWId7knTX_BQfptUj4-EdNO2c0Qo1CLEbYQxaTChgiWIJ0N8gVm-hrVv3Mqcu_W1g9GwyeeuFwHA' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div> <br />
<br />
</div></div></div><div><h3 style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; position: relative; text-align: justify;"><span style="font-size: 14pt;">III. Results</span></h3><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><span class="Apple-style-span" style="font-weight: bold;">III. 1. Ploting the tilting action : light measured according to angle</span><br />
<div><span class="Apple-style-span" style="color: black; font-family: 'Times New Roman';"><span class="Apple-style-span" style="font-size: large; line-height: normal;"><br />
</span></span></div><div style="text-align: auto;">Implementing the program and converting the parameters to floating points was fairly simple<br />
Initially we did not have much success with the SegWay, and we quickly decided that in order to see what was going on, we needed to measure the linearity of the SegWay light sensor in order to see how we should proceed.<br />
The result was quite surprising, and not really useful for a SegWay.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggg5QAeuMWRQOQX4zwVW5H2S7GKm_nVO83BDURsb4OrSjHVihvl2Oc7j5T7YVBQQo4shcT5xeePLqfRFK4MrC6x6WExMbLW6p61izDIj1-TNgdRUIagjMniDWwa_Kl8lJ4NZWc61vr7po/s1600/pre.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="165" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEggg5QAeuMWRQOQX4zwVW5H2S7GKm_nVO83BDURsb4OrSjHVihvl2Oc7j5T7YVBQQo4shcT5xeePLqfRFK4MrC6x6WExMbLW6p61izDIj1-TNgdRUIagjMniDWwa_Kl8lJ4NZWc61vr7po/s320/pre.PNG" width="320" /></a></div> <br />
<br />
We decided to try move the sensor a bit further away from the ground, and did the measurement again.<br />
<br />
<div class="separator" style="clear: both; text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBETgs99a_2etL0UJBFRwaqPSn6nKGGdo3tUAWFBuH9FgjNhuo9a_84pPu786smRf2lIfJ2GH6FcfBFaQFS-1cvTylPFP1wYWBQcSn5DX-2OsC5zeAcn8QvPPxUQ1WliNulFC3jx5biHE/s1600/post.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="171" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBETgs99a_2etL0UJBFRwaqPSn6nKGGdo3tUAWFBuH9FgjNhuo9a_84pPu786smRf2lIfJ2GH6FcfBFaQFS-1cvTylPFP1wYWBQcSn5DX-2OsC5zeAcn8QvPPxUQ1WliNulFC3jx5biHE/s320/post.PNG" width="320" /></a></div> <br />
<br />
This time the result was much better, in the range from 90 (+-10) degrees the chart was actually almost linear.<br />
Therefor we decided to remove the code line compensating for the sensor not returning a linear result.<br />
This improved our system a lot.<br />
<br />
<span class="Apple-style-span" style="font-weight: bold;">III. 2. Consequence : change the position of light sensor</span></div></div></div><div style="text-align: justify;"></div><div><span class="Apple-style-span" style="color: black; font-family: 'Times New Roman';"><span class="Apple-style-span" style="font-size: medium; line-height: normal;"><br />
</span></span></div><div>Once more, before trying to focus on the code and modify the values of the distance that defines the robot's behaviour, we tried to analyse how the position and the orientation of the sensor could improve the sampling.<br />
<br />
So we tried, geometrically speaking, to find the best configuration. And we figured out that the worst case would be put the sensor on top of the wheels and to orientate it towards the wheels axis. So as long as we tried to be as far as possible from this configuration, the sensor would be more efficient (because the more we avoid this configuration, the more we can get efficient and suitable values we can sample with the sensor)</div><br />
<span class="Apple-style-span" style="font-size: 19px; font-weight: bold;"><br />
</span></div><div><span class="Apple-style-span" style="font-size: 19px; font-weight: bold;">IV. Conclusion</span></div><div style="text-align: justify;"><br />
<span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="font-weight: normal;"><br />
</span></span><br />
<span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="font-weight: normal;"></span></span><br />
<span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="font-weight: normal;"></span></span><br />
<span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="font-weight: normal;"><div><span class="Apple-style-span" style="font-size: x-large;"><span class="Apple-style-span" style="font-size: 19px;"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-size: 13px;">Finally, we managed to implement and make this robot work but however there are a few points that we must mention. Namely that the algorithm we used was not properly designed for the robot we constructed. So, that is why the robot wasn't 100% efficient (sometimes it had some problems to keep his stance). This is maybe because of a lot data like the position of the sensor, the radius of the wheel or the inertia of the robot. This way, we tried to change the value of the PID to test how the robot was reacting and changing his behaviour. Besides, we tried to change the robot, like change his inertia centre by adding some weight on top of it and that seemed to give the robot more stability;</span></span></span></span><br />
<span class="Apple-style-span" style="font-size: x-large;"><span class="Apple-style-span" style="font-size: 19px;"><span class="Apple-style-span" style="font-size: small;"><span class="Apple-style-span" style="font-size: 13px;"><br />
</span></span></span></span></div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dxr7ptNk9SsObub4ajZIgzgZrYLCRu-0Y0P6a925nQmMiq6KBMxj4SlR5mFUkBQoyzqon2MMF_XbFf2zfNGuw' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div><span style="font-size: 14pt;"><br />
</span></div><div><span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px;">We have also later tried to build </span></span>exactly the same model that was used by Brian Bagnal who made the program we implemented. This time, the light sensor is much more further from the axis of the wheels, it is more sensitive to tilting. However, the results were not really more conclusive : the robot still needed sometimes to be pushed in a direction in order to stay balanced and not fall.</div><div><span class="Apple-style-span" style="font-size: x-large;"><span class="Apple-style-span" style="font-size: 19px;"><br />
</span></span></div><div class="separator" style="clear: both; text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dyEcRexGKi56M-q-WWMgcAbDgFpCfD5X_JMkEp--HkJcDlQPI751d3Ji9EI6_FX4qsGFvRmAZ13ANP7XXLxMg' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div><div><span style="font-size: 14pt;"><br />
</span></div><div><span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"></span></span><br />
<span style="font-size: 14pt;"><span class="Apple-style-span" style="font-size: 13px; font-weight: bold;"><h3 style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; position: relative; text-align: justify;"><span class="Apple-style-span" style="font-size: large; font-weight: normal;"><span class="Apple-style-span" style="font-size: medium;"><span class="Apple-style-span" style="font-size: 15px;"><b><br />
</b></span></span></span> <span style="font-size: 13px; font-weight: normal;"><span style="font-size: 15px; font-weight: bold;"><span style="font-size: 13px; font-weight: normal;"></span></span></span><br />
<span style="font-size: 13px; font-weight: normal;"><span style="font-size: 15px; font-weight: bold;"><span style="font-size: 13px; font-weight: normal;"><div><div><div style="text-align: justify;"><span style="font-size: 19px; font-weight: bold;">V. References</span></div></div></div><div><span style="font-size: 19px; font-weight: bold;"><br />
</span></div><div><span style="font-weight: bold;"><span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-weight: normal; line-height: normal;"><span class="Apple-style-span" style="font-size: small;">[1] Brian Bagnal, Maximum LEGO NXT, Building Robots with Java Brains</span></span></span></div></span></span></span></h3></span></span></div></span></span></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-50893754560081508742010-09-16T14:10:00.031+02:002010-09-23T21:22:20.915+02:00Lab session 3 : Experimenting with the sound sensor<div style="text-align: justify;"><span class="Apple-style-span" style="font-family: Arial; font-size: small;">Date: 16. September 2010</span></div><span class="Apple-style-span" style="font-family: Arial; font-size: small;"></span><br />
<span class="Apple-style-span" style="font-family: Arial; font-size: small;"><div style="text-align: justify;">Duration of activity: 3,5 hours (11:00 - 14:30)</div><div style="text-align: justify;">Group members participating : all group members, that is Anders Dyhrberg, Guillaume Depoyant, Michaël Ludmann and Michal Owsinski.</div></span><br />
<div style="text-align: left;"><br />
</div><h3 style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; position: relative; text-align: justify;">I. Objectives and summary</h3><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><h4 style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; position: relative;">I. 1. Objectives</h4>Build a robot with sound sensor</div><div style="text-align: justify;">Experiment with the sound sensor</div><div style="text-align: justify;">Extract measures with the Data Logger</div><div style="text-align: justify;">Implement the sound controlled car</div><div style="text-align: justify;">Implement the clap controlled car</div><div style="text-align: justify;"><span class="Apple-style-span" style="font-weight: bold;"><br />
</span></div><div style="text-align: justify;"><span class="Apple-style-span" style="font-weight: bold;">I. 2. Summary</span></div><div style="text-align: justify;">During this lab session, we managed to :</div><div style="text-align: justify;"><div><ul><li>Build the LEGO robot with sound sensor and test it to see how the sensor measures the noise using <a href="http://legolab.daimi.au.dk/DigitalControl.dir/NXT/Lesson2.dir/SonicSensorTest.java">SonicSensorTest.java</a>;</li>
<li>Extract data to analyse sounds with <a href="http://legolab.daimi.au.dk/DigitalControl.dir/NXT/Lesson3.dir/SoundSampling.java">SoundSampling.java</a> and <a href="http://legolab.daimi.au.dk/DigitalControl.dir/NXT/src/DataLogger.java">DataLogger.java</a>;</li>
<li>Implement and test the sound controlled car with <a href="http://legolab.daimi.au.dk/DigitalControl.dir/NXT/Lesson3.dir/SoundCtrCar.java">SoundCtrCar.java</a> and try to improve his behaviour namely with the ESCAPE button;</li>
<li>Implement and test the clap controlled car, by having our robot react to the sound of clapping, and nothing else (no other loud sound allowed)</li>
</ul><div><br />
</div></div></div><div class="post-body entry-content" style="color: #222222; font-family: Arial, Tahoma, Helvetica, FreeSans, sans-serif; font-size: 13px; line-height: 1.4; position: relative; width: 920px;"><h3 style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; position: relative; text-align: justify;"><span style="font-size: 14pt;">II. Results</span></h3><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><span class="Apple-style-span" style="font-weight: bold;">II. 1. dB and dBA</span></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">While reading the details of the class SoundSensor [1] that we need to use for testing the sound sensor, we noticed that there are two methods for setting two modes for the sound sensor. They enable us to set dB mode or dBA mode.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">dB stands <span style="font-family: Arial;">for decibel : basically, it is a logarithmic </span><span style="font-size: 10pt;"><span style="font-family: Arial;">unit used t</span></span><span style="font-family: Arial;">o measure a ratio between two powers - and it is mostly known for measuring sound level. The dB scale for sound cove</span>rs the whole spectrum of sound (it ranges from 0 dB to 194 dB), whereas the dBA scale is provided by a sound filte<span style="font-family: Arial; font-size: 10pt; line-height: normal;"><span style="color: black;">r, "used to approximate the human ear's response to sound, although the measurement is still in dB (SPL). These measurements usually refer to noise and noisome effects on humans and animals, and are in widespread use in the industry with regard to noise control issues, regulations and environmental standards." [2]</span></span></div><div style="text-align: justify;"><span style="font-family: Arial; font-size: 10pt; line-height: normal;"><span style="color: black;"><span class="Apple-style-span"><span class="Apple-style-span" style="line-height: 18px;"><span class="Apple-style-span"><span class="Apple-style-span" style="line-height: normal;"><span class="Apple-style-span"><span class="Apple-style-span" style="line-height: 18px;"><br />
</span></span></span></span></span></span></span></span></div><div style="text-align: justify;"><span style="font-family: Arial; font-size: 10pt; line-height: normal;"><span style="color: black;">In fact, by using the dBA mode, the sound sensor will filter high and low frequencies that are roughly not perceived by the human ear, and it focuses on a frequency range about 1 kHz to 4 kHz, where our ears are much more sensitive [3].</span></span></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><span style="font-family: Arial; font-size: 10pt; line-height: normal;"><span style="color: black;">So, what should we use when it comes to programming our robot ? Well, it really depends on what we try to do. dB mode seems to be generally more usefull, as it describes the real world and we can make more accurate algorithms while detecting some given sounds (see the last part of this lab note, with the clap detection), whereas dBA may be efficient with human voice recognition, when we need to reduce the "noise" of the real world.</span></span></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><span style="font-weight: bold;">II. 2. Test of the sound sensor</span></div><div style="text-align: justify;"><br />
<br />
<div style="text-align: center;"><object height="385" width="480"><param name="movie" value="http://www.youtube.com/v/ED6YjOfl50Y?fs=1&hl=en_US"><param name="allowFullScreen" value="true"><param name="allowscriptaccess" value="always"><embed src="http://www.youtube.com/v/ED6YjOfl50Y?fs=1&hl=en_US" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></div><div style="text-align: justify;">After reprogramming <a href="http://www.legolab.daimi.au.dk/DigitalControl.dir/NXT/Lesson2.dir/SonicSensorTest.java">sonicSensorTest.java</a> program and uploading it into the NXT controller we placed the robot at a fixed position and by using a constant volume sound we tested it. The robot was driving away from the sound for 1 meter with placed on top 2 sound sensors. The test was done in a small closed room almost without any sounds from the outside. </div><div style="text-align: justify;">Blue line is representing the db value from the sound sensor 1, red line is representing the dba value from the sound sensor 2.</div><br />
<br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKY5QvMhuwr9GSN4diMVDHSEqGepTJhxVWVQiQpdfkDKM0zzXB5KeRaVwFngh4dw4JHDPSZlFG4T5u9890SWrZMATrUfaFhaPdSdwBaT8q8o5Iw442OLS_NbCnJNNw7jKghpL9F72D_do/s1600/changing_distance.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5520014007729642130" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgKY5QvMhuwr9GSN4diMVDHSEqGepTJhxVWVQiQpdfkDKM0zzXB5KeRaVwFngh4dw4JHDPSZlFG4T5u9890SWrZMATrUfaFhaPdSdwBaT8q8o5Iw442OLS_NbCnJNNw7jKghpL9F72D_do/s320/changing_distance.png" style="cursor: hand; cursor: pointer; display: block; height: 174px; margin: 0px auto 10px; text-align: center; width: 320px;" /></a><br />
<br />
</div><div style="text-align: justify;"><b><br />
</b><br />
<b>II. 3 Data logger</b></div><div style="text-align: justify;">During our lab work we wanted to experiment with the differences between dB and dB(A). To compare them we added two microphones and instantiated two DataLoggers. But this gave us a very weird behaving log file. Seemed like the two logging instances were interfering with each other. Nothing obvious in the DataLogger code indicated there should be a problem with two co-existing loggers. To overcome this fast we implemented our own logger "Multilogger" which is a little more flexible. It will allow us to log several values at the same time for comparison and tag it with a time stamp.</div><div style="text-align: justify;"><br />
<div><span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"></span><br />
<span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"></span><br />
<span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"></span><br />
<span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"><pre style="background-color: #eeeeee; border-bottom-color: rgb(153, 153, 153); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(153, 153, 153); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(153, 153, 153); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(153, 153, 153); border-top-style: dashed; border-top-width: 1px; color: black; font-family: fixed, monospace; font-size: 12px; line-height: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 900px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">public void log( int sample ){ appendLogStart(m_stringBuilder); m_stringBuilder.append(sample); streamToFile(m_stringBuilder);} public void log( Object objs[] ){ appendLogStart(m_stringBuilder); for(int i=0; i<objs.length; i++) { m_stringBuilder.append(objs[i].toString()); //Append ',' after each value, except the last one if(i<objs.length-1) m_stringBuilder.append(','); } streamToFile(m_stringBuilder);} public void log( String string ){ appendLogStart(m_stringBuilder); m_stringBuilder.append(string); streamToFile(m_stringBuilder);}</div></div></pre></span></div><br />
We will probably use this logger instead for the rest of the course and extend it as it is required. It is currently exposing the three logging options as shown in the code above.<br />
An obvious feature to implement fairly soon would be to log directly to PC using Bluetooth instead of files. Done right this would allow is in many scenarios to see the log during program execution, making debugging faster<br />
<br />
<i>Important Note: We never did discovered why the two DataLogger's could not co exist, we abandoned the issue, and worked around it. </i><br />
<br />
</div><div style="text-align: justify;"><span style="font-weight: bold;">II. 4. Sound controlled car</span></div><div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">The first interactive application of the sound sensor was made using the program SoundCtrCar.java [4]. This program basically makes the robot wait for a first loud sound, then makes it move forward while waiting for another sound to make it turn right, then left, and finally the fourth loud sound makes it stop. Then the loop starts again.</div></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">A loud sound is defined by the program as a sound which has a value larger than a static threshold (here 90), given that the sensor is in dB mode and the values are rescaled in percent scale. So, theoretically, the louder the sound, the greater the value. In fact, it is the case most of the time, and the threshold was high enough to prevent the surrounding noise to interfere with the movement of the car. The most efficient way to make a "loud sound" was to bang on the floor, clapping or moving a nearby chair. Still, whistling gently in the sensor or simply blowing on it is seen as a loud noise, probably because it saturates the measurement in some way. So, it is sometimes hard to control perfectly the robot if you do not have a full control on the surrounding noise environment.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">On the whole, it was satisfactory, but one problem remained. The program was written such as it was possible to stop it only at some precise times, because of many while loops. We therefore needed to implement some event listeners, so as to have the robot stop when the escape button is pressed. One easy solution would have been to add one event for the escape button, and write a system exit line code in the listener. But this is not a satisfactory solution, as it usually is an ugly thing to interrupt the proper running of a program and skipping last instructions. That is why we chose to write something a bit more sophisticated, by adding a listener for the sound sensor and some state variables.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">The program listens now to the values of the sound sensor and to the state of the escape button. Each sample form the sound sensor is checked, and if its value is larger than the threshold, we increment a counter and do the corresponding action. Every four incrementation, we reset the counter to begin a new cycle. Meanwhile, if the escape button is pressed, a state variable is set to false, and the main program stops immediately, because we are just running a while loop which relies on the state of this variable.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">However, this second try was not so conclusive at first glance. We indeed saw that a listener on a sensor port uses only the raw value returned by the sensor. As we were unsure of the way leJOS converts a raw value coming from a sound sensor into a percent value (we didn't know if the raw value was already in decibel, or if there was some kind of hidden processing), we checked the leJOS source code. We found in the SoundSensor.java [5] file that it was just re-scaled to fit in a percent scale, like that :</div><div><span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"></span><br />
<span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"><pre style="background-color: #eeeeee; border-bottom-color: rgb(153, 153, 153); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(153, 153, 153); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(153, 153, 153); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(153, 153, 153); border-top-style: dashed; border-top-width: 1px; color: black; font-family: fixed, monospace; font-size: 12px; line-height: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 900px;"><div style="text-align: justify;">public int readValue()</div><div style="text-align: justify;">{</div><div style="text-align: justify;"> return ((1023 - port.readRawValue()) * 100/ 1023);</div><div style="text-align: justify;">}</div></pre></span></div><div style="text-align: justify;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 16px; line-height: normal;"><span class="Apple-style-span" style="font-size: 13px; line-height: 18px;">...which by the way makes us doubt about the relevance of the so called dB unit in leJOS (when is it real decibel ? when we read a raw value or a "percent" value ?)</span></span></span></div><div style="text-align: justify;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 16px; line-height: normal;"><span class="Apple-style-span" style="font-size: 13px; line-height: 18px;">Anyway, once this little line of code added in our program, it was better, but still not better than the first try. It had to be due to the sampling frequency, which was higher this time (because we always listen to the sensor port). So the same loud sound would often be sampled twice, and the robot would do some erratic moves. Our solution was to use a state variable which systematically ignores a loud sound if the previous sample was already considered as a loud sound. An other solution could have been to wait for a few milliseconds after each sample.</span></span></span></div><div style="text-align: justify;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 16px; line-height: normal;"><span class="Apple-style-span" style="font-size: 13px; line-height: 18px;"><br />
</span></span></span></div><div style="text-align: justify;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 16px; line-height: normal;"><span class="Apple-style-span" style="font-size: 13px; line-height: 18px;">Here is our final code :</span></span></span></div><div><span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"></span><br />
<span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"><pre style="background-color: #eeeeee; border-bottom-color: rgb(153, 153, 153); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(153, 153, 153); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(153, 153, 153); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(153, 153, 153); border-top-style: dashed; border-top-width: 1px; color: black; font-family: fixed, monospace; font-size: 12px; line-height: 14px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 900px;"><div style="text-align: justify;">public class SoundCtrCar</div><div style="text-align: justify;">{</div><div style="text-align: justify;"> private static int soundThreshold = 90;</div><div style="text-align: justify;"></div><div style="text-align: justify;"> private static boolean m_running = true;</div><div style="text-align: justify;"> private static int m_state = 0;</div><div style="text-align: justify;"> private static boolean m_allowNewReaction = true;</div><div style="text-align: justify;"></div><div style="text-align: justify;"> public static void main(String [] args) throws Exception</div><div style="text-align: justify;"> {</div><div style="text-align: justify;"> LCD.drawString("dB level: ",0,0);</div><div style="text-align: justify;"> LCD.refresh();</div><div style="text-align: justify;"></div><div style="text-align: justify;"> Button.ESCAPE.addButtonListener( new ButtonListener () {</div><div style="text-align: justify;"> @Override</div><div style="text-align: justify;"> public void buttonPressed(Button arg0) {</div><div style="text-align: justify;"> m_running = false;</div><div style="text-align: justify;"> }</div><div style="text-align: justify;"></div><div style="text-align: justify;"> @Override</div><div style="text-align: justify;"> public void buttonReleased(Button arg0) {</div><div style="text-align: justify;"> //do nothing</div><div style="text-align: justify;"> }</div><div style="text-align: justify;"> });</div><div style="text-align: justify;"></div><div style="text-align: justify;"> SensorPort.S1.addSensorPortListener( new SensorPortListener() {</div><div style="text-align: justify;"></div><div style="text-align: justify;"> @Override</div><div style="text-align: justify;"> public void stateChanged(SensorPort arg0, int arg1, int arg2) {</div><div style="text-align: justify;"> if(SensorPort.S1 == arg0)</div><div style="text-align: justify;"> {</div><div style="text-align: justify;"> int SoundSensorNormalizedValue = ((1023 - arg2) * 100/ 1023);</div><div style="text-align: justify;"></div><div style="text-align: justify;"> LCD.drawInt(arg2,4,10,0);</div><div style="text-align: justify;"></div><div style="text-align: justify;"> if(SoundSensorNormalizedValue < m_allownewreaction =" true;"> soundThreshold && m_allowNewReaction)</div><div style="text-align: justify;"> {</div><div style="text-align: justify;"> //Notify program that we are above threshold</div><div style="text-align: justify;"> switch (m_state)</div><div style="text-align: justify;"> {</div><div style="text-align: justify;"> case 0:</div><div style="text-align: justify;"> LCD.drawString("Forward ",0,1);</div><div style="text-align: justify;"> Car.forward(100, 100);</div><div style="text-align: justify;"> break;</div><div style="text-align: justify;"> case 1:</div><div style="text-align: justify;"> LCD.drawString("Right ",0,1);</div><div style="text-align: justify;"> Car.forward(100, 0);</div><div style="text-align: justify;"> break;</div><div style="text-align: justify;"> case 2:</div><div style="text-align: justify;"> LCD.drawString("Left ",0,1);</div><div style="text-align: justify;"> Car.forward(0, 100);</div><div style="text-align: justify;"> break;</div><div style="text-align: justify;"> case 3:</div><div style="text-align: justify;"> LCD.drawString("Stop ",0,1);</div><div style="text-align: justify;"> Car.stop();</div><div style="text-align: justify;"> break;</div><div style="text-align: justify;"> }</div><div style="text-align: justify;"></div><div style="text-align: justify;"> m_allowNewReaction = false;</div><div style="text-align: justify;"></div><div style="text-align: justify;"> m_state++;</div><div style="text-align: justify;"> if(m_state > 3)</div><div style="text-align: justify;"> m_state = 0;</div><div style="text-align: justify;"> }</div><div style="text-align: justify;"> }</div><div style="text-align: justify;"> }</div><div style="text-align: justify;"> });</div><div style="text-align: justify;"></div><div style="text-align: justify;">while (m_running)</div><div style="text-align: justify;">{</div><div style="text-align: justify;">}</div><div style="text-align: justify;"></div><div style="text-align: justify;">Car.stop();</div><div style="text-align: justify;">LCD.clear();</div><div style="text-align: justify;">LCD.drawString("Program stopped", 0, 0);</div><div style="text-align: justify;">Thread.sleep(2000);</div><div style="text-align: justify;">}</div><div style="text-align: justify;">}</div></pre></span></div><div style="text-align: justify;">And our third try with all our improvements was a success ! The robot behaved more efficiently than with the original code.</div><div style="text-align: justify;"><br />
</div><div><div style="text-align: center;"><object height="385" width="480"><param name="movie" value="http://www.youtube.com/v/kHqOz3XuL9I?fs=1&hl=fr_FR"><param name="allowFullScreen" value="true"><param name="allowscriptaccess" value="always"><embed src="http://www.youtube.com/v/kHqOz3XuL9I?fs=1&hl=fr_FR" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="480" height="385"></embed></object></div></div><div><span style="font-weight: bold;"><span style="font-weight: normal;"></span></span><br />
<b>II. 5 Clap Controlled Car</b><br />
<span style="font-weight: bold;"><span style="font-weight: normal;"></span></span><br />
<span style="font-weight: bold;"><span style="font-weight: normal;"><div><div><div style="text-align: justify;"><span style="font-size: 24pt; line-height: 26px;"><span style="font-size: 13px; font-weight: bold; line-height: 18px;"></span></span><br />
<span style="font-size: 24pt; line-height: 26px;"><span style="font-size: 13px; font-weight: bold; line-height: 18px;"><h3 style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; position: relative; text-align: justify;"><span style="font-size: 13px; font-weight: normal;"><span style="font-size: 15px; font-weight: bold;"><span style="font-size: 13px; font-weight: normal;"><br />
<div><div><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">We implemented clap detections algorithm according to the method of Sivan Toledo.</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">The implementation was fairly simple it was implemented using a simplified State Structure evaluating all available samples according to the current state. Basically it is just evaluated if the sample will allow the program to stays in the current state or progress into the next. And if neither could be achieved, it will break out and reset to the 1st state again looking for the start of a new possible clap.</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div><span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"></span><br />
<span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"></span><br />
<span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"></span><br />
<span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"></span><br />
<span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"></span><br />
<span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"></span><br />
<span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"><pre style="background-color: #eeeeee; border-bottom-color: rgb(153, 153, 153); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(153, 153, 153); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(153, 153, 153); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(153, 153, 153); border-top-style: dashed; border-top-width: 1px; color: black; font-family: fixed, monospace; font-size: 12px; line-height: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 900px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">case NOCLAP: if(soundSensorNormalizedValue > CLAP_START_INDICATION_LEVEL) { m_ClapState = ClapDetectionState.START_DETECTED; m_LatestClapStateChangeTime = System.currentTimeMillis(); logger.log("NOCLAP -> START, " + soundSensorNormalizedValue + ", " + msSinceLastState + "ms"); } else { //Do nothing } break;case START_DETECTED: if(msSinceLastState < CLAP_RISE_INDICATION_DELAY) { if(soundSensorNormalizedValue > CLAP_PEAK_INDICATION_LEVEL) { m_ClapState = ClapDetectionState.PEAK_DETECTED; m_LatestClapStateChangeTime = System.currentTimeMillis(); logger.log("START -> PEAK, " + soundSensorNormalizedValue + ", " + msSinceLastState + "ms"); } } else { //Time is up, does not match clap profile m_ClapState = ClapDetectionState.NOCLAP; m_LatestClapStateChangeTime = System.currentTimeMillis(); logger.log("START -> NOCLAP, " + soundSensorNormalizedValue + ", " + msSinceLastState + "ms"); } break;case PEAK_DETECTED: if(msSinceLastState < CLAP_FALL_INDICATION_DELAY) { if(soundSensorNormalizedValue < CLAP_END_INDICATION_LEVEL) { //Clap detected m_clapCount++; m_multiClapCount++; LCD.drawInt(m_clapCount,4,12,0); m_ClapState = ClapDetectionState.MULTI_CLAP_POTENTIAL; m_LatestClapStateChangeTime = System.currentTimeMillis();</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">logger.log("PEAK -> MULTICLAP, " + soundSensorNormalizedValue + ", " + msSinceLastState + "ms"); } } else { //Time is up, does not match clap profile m_ClapState = ClapDetectionState.NOCLAP; m_LatestClapStateChangeTime = System.currentTimeMillis(); logger.log("PEAK_DETECTED -> NOCLAP, " + soundSensorNormalizedValue + ", " + msSinceLastState + "ms"); } break;</div></div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div></pre></span><br />
<div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"></div></div><div style="text-align: justify;"></div><br />
</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">The advantage of this structuring, makes it fairly simple to extend the program with more states for more advanced detection algorithms.</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">To verify this we added a multi clap, detection state. This state will evaluate if there have been more consecutive claps. This increase the usage of the algorithm a lot, since this will then allow us to listen for different multiclap counts and interpret them as different commands.<br />
e.g single clap - start, double clap - stop, triple clap - turn.</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"><div><span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"></span><br />
<span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"></span><br />
<span class="Apple-style-span" style="color: black; font-family: Georgia, serif; font-size: 16px; line-height: normal;"><pre style="background-color: #eeeeee; border-bottom-color: rgb(153, 153, 153); border-bottom-style: dashed; border-bottom-width: 1px; border-left-color: rgb(153, 153, 153); border-left-style: dashed; border-left-width: 1px; border-right-color: rgb(153, 153, 153); border-right-style: dashed; border-right-width: 1px; border-top-color: rgb(153, 153, 153); border-top-style: dashed; border-top-width: 1px; color: black; font-family: fixed, monospace; font-size: 12px; line-height: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; width: 900px;"><div style="text-align: justify;"><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">case MULTI_CLAP_POTENTIAL: if(msSinceLastState < MULTIBLE_CLAP_DETECT_DELAY) { if(soundSensorNormalizedValue > CLAP_START_INDICATION_LEVEL) { m_ClapState = ClapDetectionState.START_DETECTED; m_LatestClapStateChangeTime = System.currentTimeMillis(); logger.log("MULTICLAP -> START, " + soundSensorNormalizedValue + ", " + msSinceLastState + "ms"); } } else { //Evaluate multi clap scenario, no more are accepted since delay was to long LCD.drawInt(m_multiClapCount,4,12,1); //Cleanup m_multiClapCount = 0; m_ClapState = ClapDetectionState.NOCLAP; m_LatestClapStateChangeTime = System.currentTimeMillis();</div><div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;">logger.log("MULTICLAP -> NOCLAP, " + soundSensorNormalizedValue + ", " + msSinceLastState + "ms"); } break;</div></div></pre></span></div></div></div>The acceptable time between claps in order to accept them as a multiclap is configured using the MULTIBLE_CLAP_DETECT_DELAY const in top of the program. By experimenting 1 sec seems like a well working value.<br />
<br />
<div style="text-align: justify;"><span style="font-size: 19px; font-weight: bold;">III. References</span></div></div></div><div><span style="font-size: 19px; font-weight: bold;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;"><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 19px;"><b><span class="Apple-style-span"><span class="Apple-style-span" style="font-size: 13px; font-weight: normal;"><br />
</span></span></b></span></span></span></span></span></div><div><span style="font-size: 10pt;">[1] <a href="http://lejos.sourceforge.net/p_technologies/nxt/nxj/api/lejos/nxt/SoundSensor.html">Class SoundSensor</a> in leJOS documentation.</span></div></span></span></span></h3><div><span style="font-weight: normal;">[2] <a href="http://en.wikipedia.org/wiki/Decibel">db(A), dB(B) and dB(C) definitions</a> provided by Wikipedia.</span></div><div><span style="font-weight: normal;">[3] <a href="http://www.phys.unsw.edu.au/jw/dB.html">Filters used for dBA and dBC</a>, University of New South Wales, Australia</span></div><div><span style="font-weight: normal;">[4] <a href="http://legolab.daimi.au.dk/DigitalControl.dir/NXT/Lesson3.dir/SoundCtrCar.java">A sound controlled car</a>, Ole Caprani</span></div><div><span style="font-weight: normal;">[5] <a href="http://lejos.svn.sourceforge.net/viewvc/lejos/trunk/classes/lejos/nxt/SoundSensor.java?revision=4014&view=markup">Code source for the sound sensor</a>, leJOS developer documentation</span><br />
<span style="font-weight: normal;">[6] <a href="http://www.tau.ac.il/~stoledo/lego/ClapCounter/">Clap Detection Algorithm by Sivan Toledo</a></span></div></span></span></div></div></div></span></span></div></div>Guillaumehttp://www.blogger.com/profile/02887816672177492636noreply@blogger.com1tag:blogger.com,1999:blog-1228414716208593321.post-26753428791766006002010-09-09T12:42:00.014+02:002010-09-12T12:46:25.302+02:00Lab session 2 : Experimenting with the ultrasonic sensor<div style="text-align: justify;">Date: 9. September 2010</div><div style="text-align: justify;">Duration of activity: 3,5 hours (11:00 - 14:30)</div><div style="text-align: justify;">Group members participating : all group members, that is Anders Dyhrberg, Guillaume Depoyant, Michaël Ludmann and Michal Owsinski.</div><div style="text-align: justify;"><br />
</div><h3 style="text-align: justify;">I. Objectives and summary</h3><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><h4>I. 1. Objectives</h4>Build a robot with an ultrasonic sensor</div><div style="text-align: justify;">Experiment with the ultrasonic sensor</div><div style="text-align: justify;">Experimenting with the "Tracker Beam" example</div><div style="text-align: justify;">Build and program a wall follower robot</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><h4>I. 2. Summary</h4></div><div style="text-align: justify;">During this lab session, we managed to :</div><ul><li style="text-align: justify;">Create a repository for our code using Google code and Subversion. You can browse it freely <a href="http://code.google.com/p/legointernational/source/browse/#svn/trunk/ legointernational/LegoLab">at this link</a>.</li>
<li style="text-align: justify;">Build the LEGO robot with ultrasonic sensor and test it to see how the sensor measures the distance. We used for this purpose the file <a href="http://code.google.com/p/legointernational/source/browse/trunk/%20legointernational/LegoLab/src/Lesson2/SonicSensorTest.java">SonicSensorTest.java</a>.</li>
<li style="text-align: justify;">Have the robot react simply according to what it senses with the ultrasonic sensor. We have tried the files <a href="http://code.google.com/p/legointernational/source/browse/trunk/+legointernational/LegoLab/src/Lesson2/Car.java">Car.java</a> and <a href="http://code.google.com/p/legointernational/source/browse/trunk/+legointernational/LegoLab/src/Lesson2/Tracker.java">Tracker.java</a>.</li>
<li style="text-align: justify;">Program something a bit more sophisticated, that enables our robot to follow a wall on his right. It was nessessary to change the position of the sensor and do many experiments with it to find the best place, in order to minimize the efforts in the programming part.</li>
</ul><div style="text-align: justify;"><br />
</div><h3 style="text-align: justify;">II. Results</h3><div><div style="text-align: justify;"><span class="Apple-style-span" style="font-weight: bold;">II. 1. Test of the Ultrasonic Sensor</span></div><span class="Apple-style-span" style="font-weight: bold;"></span><br />
<span class="Apple-style-span" style="font-weight: bold;"></span><br />
<span class="Apple-style-span" style="font-weight: bold;"></span><br />
<span class="Apple-style-span" style="font-weight: bold;"></span><br />
<span class="Apple-style-span" style="font-weight: bold;"></span><br />
<span class="Apple-style-span" style="font-weight: bold;"><div style="text-align: justify;"><br />
</div></span></div><div style="text-align: justify;"><span class="Apple-style-span" style="font-weight: bold;"><span class="Apple-style-span" style="font-weight: normal;">At the last lab session one of our task was to test the Lego Ultrasonic Sensor. The ultrasonic sensor detects objets in front of the sensor by sending a short high frequency sound and then listen to echoes. If an echo comes back there is an object in front. The sensor can measure distance up to 254 cm, it returns value of 255 when there is no object within range. Our task was to measure if the sensor is returning correct values with different distances and different objects. To our measurements we used the Lego car 9797 with on-top mounted ultrasonic sensor.</span></span></div><div style="text-align: justify;">We started with the distance of 9 cm and increased it by 5 cm until the distance of 74 cm. What we observed was that the sensor was not accurate with very short distances, fx. with distance of 9 cm the sensor returned 11 cm. From the distance of 24 cm the sensor started to return correct values. Then we took 2 control measurements from the middle distance (109 and 134 cm). Last 4 measurements were 204, 214, 224, 234 cm on which we saw that the sensor is loosing the distance again.</div><div style="text-align: justify;"><br />
</div><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD0uVTJz-enH1b_LshtNTpU-HRhgCpk_JCpyi2I9uaLy8VUVwNBpLGMp66_hlg2p6jhk_HMVYjbgcPbEG1O79SBi02d-Ha2zr-6ViPSsqaKu6dWoaWqwMj9pnQzTU1c6MOS4ENRZWIRaw/s1600/ultrasonic_sensor_distance_value_relation.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5515230745273331506" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiD0uVTJz-enH1b_LshtNTpU-HRhgCpk_JCpyi2I9uaLy8VUVwNBpLGMp66_hlg2p6jhk_HMVYjbgcPbEG1O79SBi02d-Ha2zr-6ViPSsqaKu6dWoaWqwMj9pnQzTU1c6MOS4ENRZWIRaw/s320/ultrasonic_sensor_distance_value_relation.png" style="cursor: pointer; display: block; height: 227px; margin-bottom: 10px; margin-left: auto; margin-right: auto; margin-top: 0px; text-align: justify; width: 320px;" /></a><br />
<div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Second experiment was to see how the sensor will react with different materials. We used fixed distance of 59 cm for all materials.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhd_mwlORHe4i5y7fISC35iV9-szSQu0PmBMgnmmr6jCwRgZqsXP3bUq23QE3UK9eZWBJ8xjZu0vgfB0NGQOZe7O_FaU8hB8VGSZp30ApyxfVtkx_d8jAYbCAGIcHeQZ-Mp5VMl7jD1BqM/s1600/material_variations_at_59_cm.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5515231228603817522" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhd_mwlORHe4i5y7fISC35iV9-szSQu0PmBMgnmmr6jCwRgZqsXP3bUq23QE3UK9eZWBJ8xjZu0vgfB0NGQOZe7O_FaU8hB8VGSZp30ApyxfVtkx_d8jAYbCAGIcHeQZ-Mp5VMl7jD1BqM/s320/material_variations_at_59_cm.png" style="cursor: pointer; display: block; height: 225px; margin-bottom: 10px; margin-left: auto; margin-right: auto; margin-top: 0px; text-align: justify; width: 320px;" /></a><br />
<div style="text-align: justify;"><br />
</div><div><div style="text-align: justify;">What we can see on the chart is cloths don't reflect ultra sonic sounds very well.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">"<span class="Apple-style-span" style="font-family: 'Times New Roman'; font-size: medium;">Try to use the sensor with an object at a distance of up to 254 cm, can the sensor measure such a distance and under what conditions is it possible ? What is the time limit for the measurement - remember the speed of sound is 340.29 m/sec ? Does this limit usage of the sensor ?</span>"</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">The sensor can measure the distance of 254 cm only with large objects (fx. wall) but it will loose accuracy. </div><div style="text-align: justify;">Since the speed of sound is 340 m/sec the sensor shouldn't wait longer for the signal to return for more than 15 ms (sound travels 2,54m within 7,47 ms x 2 = 14,94 ms) but after putting that value in the SonicSensorTest.java program the sensor was returning correct values untill the distance of 161 cm. </div><div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><span class="Apple-style-span" style="font-weight: bold;"></span><br />
<span class="Apple-style-span" style="font-weight: bold;"></span><br />
<span class="Apple-style-span" style="font-weight: bold;"></span><br />
<span class="Apple-style-span" style="font-weight: bold;"></span><br />
<span class="Apple-style-span" style="font-weight: bold;"></span><br />
<span class="Apple-style-span" style="font-weight: bold;"><div style="text-align: justify;">II. 2. Experimenting with the "Tracker Beam" example</div></span><br />
<div style="text-align: justify;"><br />
</div></div><div><div style="text-align: justify;">The functionallity of this program is very basic.</div><div style="text-align: justify;">When the program is started it continously reads the distance to any object in front of it.</div><div style="text-align: justify;">If there is no object within the range of the sensor it drives forward until it has something in range.</div><div style="text-align: justify;">When an object is in range of the sensor. The program calculates the difference in the measured distance to the desiredDistance value. The system respond this calculation by driving in the required direction with a speed that gets smaller or larger depending on the distance to the object in order to continously achieve the desiredDistance value.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">This type of system is what control theory term a feedback control system, more specifically in this case a proportional feedback control system. This dictates that the output is proportional to the error signal, and it is just a multiplication product of the error and the gain. It is normally mathematically expressed as:</div><span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"><div style="text-align: justify;"><br />
</div></span><br />
<div style="text-align: justify;"><br />
</div><span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"><div style="text-align: justify;"><img alt="P_{\mathrm{out}} = K_p\,{e(t)}" class="tex" src="http://upload.wikimedia.org/math/3/f/8/3f80d26e2e621e0f123bb26e80e609e5.png" style="border-bottom-style: none; border-color: initial; border-left-style: none; border-right-style: none; border-top-style: none; border-width: initial; vertical-align: middle;" /></div></span><span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"></span><br />
<span class="Apple-style-span" style="font-family: sans-serif; font-size: 13px; line-height: 19px;"><div style="line-height: 1.5em; margin-bottom: 0.5em; margin-left: 0px; margin-right: 0px; margin-top: 0.4em; text-align: justify;">where</div><ul style="line-height: 1.5em; list-style-image: url(http://bits.wikimedia.org/skins-1.5/vector/images/bullet-icon.png?1); list-style-type: square; margin-bottom: 0.5em; margin-left: 1.5em; margin-right: 0px; margin-top: 0.3em; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"><li style="margin-bottom: 0.1em; text-align: justify;"><span class="texhtml" style="font-family: serif; font-size: 16px; line-height: 1.5em; white-space: nowrap;"><i>P</i><sub style="line-height: 1em;">out</sub></span>: Output of the proportional controller. <b>In our case our direct input to the motors.</b></li>
<li style="margin-bottom: 0.1em; text-align: justify;"><span class="texhtml" style="font-family: serif; font-size: 16px; line-height: 1.5em; white-space: nowrap;"><i>K</i><sub style="line-height: 1em;"><i>p</i></sub></span>: Proportional gain. <b>In our case 50%</b></li>
<li style="margin-bottom: 0.1em; text-align: justify;"><span class="texhtml" style="font-family: serif; font-size: 16px; line-height: 1.5em; white-space: nowrap;"><i>e</i>(<i>t</i>)</span>: Instantaneous process error at time 't'. <span class="texhtml" style="font-family: serif; font-size: 16px; line-height: 1.5em; white-space: nowrap;"><i>e</i>(<i>t</i>) = <i>S</i><i>P</i> − <i>P</i><i>V. </i></span>I<b>n our case the difference between value form sensor and desiredDistance.</b></li>
<li style="margin-bottom: 0.1em; text-align: justify;"><i>SP</i>: Set point.<b> In our case desiredDistance.</b></li>
<li style="margin-bottom: 0.1em; text-align: justify;"><i>PV</i>: Process variable. <b>In our case the value read form the Sonar Sensor</b></li>
</ul></span><br />
<div style="text-align: justify;"><br />
</div><div style="text-align: justify;">The tracker beam example is functional. But using a proportional feedback system will only bring you to a certain performance level, no matter how much you tweek the variables. In order to achieve a better performing system more advanced regulation is required.</div></div><div style="text-align: justify;"><br />
</div><div><div style="text-align: justify;"><b>II. 3. Wall Follower</b></div><div style="text-align: justify;"><br />
</div><h4 style="text-align: justify;">Using a NQC programm</h4><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">For this last part of this lab session, we had to first read and understand the code of Philippe Hurbain [1], who has once programmed a wall follower using the old LEGO Mindstorms RCX, a homebrew distance sensor and the NQC language (Not Quite C [2]).</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">His code is quite messy because of some arbitrary constant names and the peculiar way it uses the homebrew sensor (initialization of it and raw values that don't mean anything for our own sensor). For instance, smaller values mean that the sensor is further from the wall, as opposed to our sensor which returns the distance in centimeters. Still, appart from that, if you know C, it is quite easy to understand the logic beneath the whole program and its algorithm.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">The program go through differents steps depending on the distance of the sensor to the wall. That is, depending on pre-established tresholds, it corrects the moves of the robot by changing the type of rotation each motor has to make. For example, if the robot is too close to wall (i.e. the distance measured is lower than a given threshold), then the program will make the robot turn, by having one motor turning at full speed, while the other floats.</div><div style="text-align: justify;"><br />
</div><h4 style="text-align: justify;">Our own program in leJOS</h4><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Implementing this program in leJOS provided us easily with quite the same algorithm. However, first tests were not so conclusive, that is why we had to make some finishing touches.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">We ended with the code you can check <a href="http://code.google.com/p/legointernational/source/browse/trunk/+legointernational/LegoLab/src/Lesson2/WallFollower.java">at this adress</a>. We regulate the motors, that is the controlled variable, through the distance to the wall, that is the measured variable.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">In our loop, we use one more interval to have a proper reaction when facing the wall a bit to close. In such a case, our robot moves backward until the distance is a bit higher. It therefore prevents it from being stuck in a corner.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Furthermore, we have chosen to have it taking turns by changing the power applied to the motors, so we have a smoother movement.</div><div style="text-align: justify;"><br />
</div><h4 style="text-align: justify;">The importance of the physical world - Testing our algorithm</h4><div style="text-align: justify;"><br />
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVk99x9eCEV9QzDvzSlfVX_HVxGP_5mfdLYHWT17iXW5XWWgL5lBd9en2s0qTncbXrAu3twkU4ernOa5cOm4nzw97H02H7uVflFb0k1M-VFt8qDDZTbZSLNTSTXx2DcGgcY9-RkV7U6F0/s1600/legolab_ultrasonic+008.jpg" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"><img alt="" border="0" id="BLOGGER_PHOTO_ID_5515295627315530146" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjVk99x9eCEV9QzDvzSlfVX_HVxGP_5mfdLYHWT17iXW5XWWgL5lBd9en2s0qTncbXrAu3twkU4ernOa5cOm4nzw97H02H7uVflFb0k1M-VFt8qDDZTbZSLNTSTXx2DcGgcY9-RkV7U6F0/s320/legolab_ultrasonic+008.jpg" style="float: left; height: 320px; margin-bottom: 10px; margin-left: 0px; margin-right: 10px; margin-top: 0px; text-align: justify; width: 240px;" /></a>At first, we just translated the program from C into Java, trying to be as faithful as possible with the code of Philippe Hurbain. In order to have a functional system, the sensor had to be in a different orientation; indeed, it couldn't be oriented towards the front (looking at the wheels) that's why we just turned it to 45° to the right but we kept the original spot, that's to say just above the screen of the NXT brick. After that, we injected the code into the robot, and observed that it had different behaviors from what we could have expected.<br />
<br />
Netherthelss, we managed to improve the behavior of the robot, changing the values that Philippe Hurbain qualified as "Too far", "too close" or "right distance", but still, the results weren't that satisfactory.<br />
<br />
So at this moment, we tried to think into the physical world and try to understand how we could find an optimal configuration for the sensor. Because for the top of the NXT brick, we found out that for a same distance, the robot could be stuck in front of a wall or in a good position for the wall follower program (and for a little movement of one of the motor, the value that the sensor recorded could change in huge proportions). That's why we tried to keep the orientation of the sensor, but change the spot.<br />
<br />
That's why we put the sensor above the right wheel and by sampling the distance values, we came out with a great result. We had still a few oscillations, but the robot was programmed to have some good trajectories to avoid the obstacles and not to be stuck (as we can see on the video around 00:26)<br />
<br />
<br />
<br />
<br />
</div><div style="text-align: justify;"><div style="text-align: center;"><iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.blogger.com/video.g?token=AD6v5dw7pGTMfXhFESu7odJEk1ROt3-UbWac0IJLQhJjiV36Y6WfdOEc-FdNhsM9Adz7Yps4H5MQmRVQJDr8D7RemA' class='b-hbp-video b-uploaded' frameborder='0'></iframe></div></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><span class="Apple-style-span" style="font-size: 19px; font-weight: bold;">III. References</span></div></div></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">[1], Philippe Hurbain, <a href="http://www.philohome.com/wallfollower/wallfollower.nqc">WallFollower</a></div><div style="text-align: justify;">[2], <a href="http://bricxcc.sourceforge.net/nqc/">Not Quite C</a>, a language with a C-like syntax, made for programming RCX LEGO bricks. It has since evolved into NXC (<a href="http://bricxcc.sourceforge.net/nbc/">Not Exactly C</a>) to work with the NXT brick.</div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0tag:blogger.com,1999:blog-1228414716208593321.post-20501652466972593312010-09-02T13:29:00.036+02:002010-09-09T15:39:26.426+02:00Lab session 1 : introduction<div style="text-align: justify;">Date: 2. September 2010</div><div style="text-align: justify;">Duration of activity: 3,5 hours (11:00 - 14:30)</div><div><div style="text-align: justify;">Group members participating : all group members, that is Anders Dyhrberg, Guillaume Depoyant, Michaël Ludmann and Michal Owsinski.</div><div style="text-align: justify;"><br />
</div><h3 style="text-align: justify;">I. Objectives and summary</h3><div><br />
</div><div style="text-align: justify;"><h4>I. 1. Objectives</h4><br />
</div><div style="text-align: justify;">Install the leJOS Java system</div><div style="text-align: justify;">Compil and upload a program to the NXT control unit</div><div style="text-align: justify;">Experiment with the light sensor</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><div><div style="text-align: justify;"><h4>I. 2. Summary</h4><br />
</div><div style="text-align: justify;">During this lab session, we managed to :</div><div style="text-align: justify;"><div style="text-align: justify;"><ul><li>Install leJOS, flash the NXT brick and be able to send a program on it - at least with an USB cable</li>
<li>Construct a LEGO robot with an light sensor</li>
<li>Make the LEGO robot follow a black line</li>
<li>Take samples of values read by the light sensor</li>
<li>Show the impact of sampling frequency</li>
<li>Draw some conclusions about the memory of the NXT</li>
</ul></div></div><div style="text-align: justify;"><ul><li>Start this blog and write our first lab note</li>
<li>Create a mailing-list : you can write an email to our team using lego_international [at] googlegroups [dot] com</li>
</ul><div><br />
</div></div><h3 style="text-align: justify;">II. Results</h3><div><br />
</div><h4 style="text-align: justify;">II. 1. Making it work : the struggle</h4><br />
<div style="text-align: justify;">Making it all work was not an easy task. First we tried to install the LEJOS on a mac platform, but there was a problem with USB driver, so we had to find another platform. We used lab PC for it, download the USB driver and install the LEJOS. We tried to use Eclipse to work with LEJOS software but without success. So in the end we decided to work just on bat files and notepad - at least with success. We spent almost half of the lab time for this task but we still managed to complete the other tasks. Results are below.<br />
</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><h4 style="text-align: justify;">II. 2. Testing the light sensor</h4><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">The primary use of the light sensor is for detecting different levels of light reflectivity at close range.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Besides the sensor itself, there is a small LED which is used to shine a light on close objects, while the light sensor mesures how much light is reflected back. Such a feature can be useful when you want to design a line follower robot, as we have just done it, or to differentiate between two or more colours. If the colours are bright enough, then the values returned by the sensor will be different enough to tell which colour is currently on the surface tested by the sensor.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">We have taken some values depending on the colours - you can see them in the table below. The darker the surface is, the lower the value will be. Provided this information, it then seems obvious that line-following will be more efficient when the line is black and the floor white (and vice versa). The advantage of the light emitted by the LED is that the sensor is less sensitive to ambient light, and the values read should not differ so much when placed in a well-lit room or a darker one - as long as the sensor stay close to the surface. But the drawback is that a really shiny surface will reflect almost all the light in the sensor (if put directly upon it) no matter which the colour is.</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">It is also possible to disable the LED while using the light sensor. In this mode it can be used to measure surrounding or ambient light levels. But it will be bad at making a relevant difference between colours. We can then think of robots which wake up when someone turn on the light in a room, or when the night comes. A robot can be also build in such a way that it will always avoid dark areas or look for the brightest light.</div><div style="text-align: center;"><br />
</div><div style="text-align: center;"><table style="text-align: center;" align="center" border="1" cellpadding="2"><tbody></tbody><caption>Light values (percent) corresponding to colours</caption><tbody></tbody><tbody>
<tr><th><br />
Floodlight</th><th><br />
Red</th><th><br />
Yellow</th><th><br />
Blue</th><th><br />
Green</th><th><br />
White</th><th><br />
Black</th></tr>
<tr><th><br />
On</th><td><br />
57</td><td><br />
64</td><td><br />
46</td><td><br />
55</td><td><br />
64</td><td><br />
40</td></tr>
<tr><th><br />
Off</th><td><br />
39</td><td><br />
44</td><td><br />
32</td><td><br />
40</td><td><br />
44</td><td><br />
26</td></tr>
</tbody></table><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;">Anyway, the <b>light sensor depends a lot on the ambient light</b>, that is why we should always consider calibrating it when we want to use it for a reliable robot. A good thing for the line-follower could be to isolate the sensor and <b>have the robot calibrate</b> <b>itself </b>just before beginning its routine.</div><div style="text-align: justify;"><br />
</div><br />
</div><br />
<h4>II. 3. Line tracking / Sampling frequency</h4><br />
<div style="text-align: justify;"><br />
To understand the importance of the frequency (the sample interval) with the robot and the impact of this figure on the trajectory of the robot, we used four different measures and watched how the robot reacted.<br />
<br />
We sampled the frequency 10ms, 100ms, 500ms and 1000ms.<br />
<br />
So as to test the robot, we actually used two different types of lines:</div><blockquote class="webkit-indent-blockquote" style="border: medium none ; margin: 0pt 0pt 0pt 40px; padding: 0px;"><div style="text-align: justify;"><br />
- the first one was the main line that the robot had to follow (approximately 4-5 cm wide)</div></blockquote><blockquote class="webkit-indent-blockquote" style="border: medium none ; margin: 0pt 0pt 0pt 40px; padding: 0px;"><div style="text-align: justify;"><br />
- the second one was thiner (approximately 1 cm wide)</div></blockquote><br />
<div><br />
</div><br />
<div><br />
<table style="border-collapse: collapse; text-align: center; width: 100%;"><tbody>
<tr> <td style="text-align: center;"><br />
</td> <td style="text-align: center;"><span style="font-weight: bold;">10 ms</span></td> <td style="text-align: center;"><span style="font-weight: bold;">100ms</span></td> <td style="text-align: center;"><span style="font-weight: bold;">500 ms</span></td> <td style="text-align: center;"><span style="font-weight: bold;">1000 ms</span></td> </tr>
<tr> <td style="text-align: right;"><span style="font-weight: bold;">Wide line</span></td> <td style="text-align: center;"><span style="border-collapse: separate; line-height: 17px;font-family:Verdana,Arial,sans-serif;font-size:13px;" >✔</span></td> <td style="text-align: center;"><span style="border-collapse: separate; line-height: 17px;font-family:Verdana,Arial,sans-serif;font-size:13px;" >✔</span></td> <td style="text-align: center;"><span style="border-collapse: separate; line-height: 17px;font-family:Verdana,Arial,sans-serif;font-size:13px;" >✘</span></td> <td style="text-align: center;"><span style="border-collapse: separate; line-height: 17px;font-family:Verdana,Arial,sans-serif;font-size:13px;" >✘</span></td> </tr>
<tr> <td style="text-align: right;"><span style="font-weight: bold;">Thin line</span></td> <td style="text-align: center;"><span style="border-collapse: separate; line-height: 17px;font-family:Verdana,Arial,sans-serif;font-size:13px;" >✔</span></td> <td style="text-align: center;"><span style="border-collapse: separate; line-height: 17px;font-family:Verdana,Arial,sans-serif;font-size:13px;" >✘</span></td> <td style="text-align: center;"><span style="border-collapse: separate; line-height: 17px;font-family:Verdana,Arial,sans-serif;font-size:13px;" >✘</span></td> <td style="text-align: center;"><span style="border-collapse: separate; line-height: 17px;font-family:Verdana,Arial,sans-serif;font-size:13px;" >✘</span></td> </tr>
</tbody> </table><br />
</div><br />
<div style="text-align: left;"><br />
<div style="text-align: justify;"><br />
This table gives a rapid overview of the behavior of the robot, but in order to be exhaustive, we should state that the robot can only follow the thin line with the frequency 10 ms, all the other one did not give any positive result. But with the wide line it was different because the robot could follow the line with 100 ms but it had some difficulties to stay focused (he lost his goal a few times).<br />
<br />
What we should highlight is that it may be more costly to have a high frequency (maybe in term of power saving) but we could have another results with different parameters such as the radius of the wheels, the lenght of the chassis, the speed of the rotation of the motors, the position of the sensor and so on. So the question being would be to wonder if we couldn't find a spatial configuration more efficient for this robot.</div><br />
</div><br />
<div style="text-align: justify;"><br />
</div><h4 style="text-align: justify;">II. 4. Heap and garbage collecting</h4><div style="text-align: justify;"><br />
As a part of the lab session we were asked to investigate the difference between using the left, right string variables and setting them directly in the function.<br />
It was observed that<br />
<br />
<ul><li>When using the variable the memory usage was static.</li>
<li>When using the the strings directly the memory usage was decresing rapidly and when reaching around 400-500Bytes, the memory freed up, and the rapid decreesed started over. This behaviour continued in a loop.</li>
</ul><br />
This is clearly demonstrating the Garbage Colletor is working and behaving as expected. When declaring the variables, all required memory for this task is preallocated and we just keep reusing the same part of the memoryspace.<br />
Every time a "..." is writen, a string object is essentially created and memory is used. Since this is done in our loop with a delay of 10ms we continue to create a new string object approximatly 100 times per second, each being of 10 chars it equals to 1KB/s. This match the decrese rate observed.<br />
When we reach the low memory level the garbage collector kicks in, and deletes all objectes which have no reference in the program. This is valid for all our string objectes, and they are deleted.<br />
In a normal highlevel enviroment this would often not cause any problems. But in the embedded context where ressources are tight and timing is critical, we need to take this in to consideration. Essentially it not at problem that we use the memory and free it up again. But if the GC starts to run while we do somthing timing critical, it can easy cause unpredictable results. The best way to avoid this happening is to manage our use of memory.<br />
</div></div><div style="text-align: justify;"><br />
</div><div style="text-align: justify;"><br />
</div><h3 style="text-align: justify;">IV. References</h3></div></div>Parapampahttp://www.blogger.com/profile/13077383135448773013noreply@blogger.com0