-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathm04.html
227 lines (211 loc) · 13.4 KB
/
m04.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
<!DOCTYPE HTML>
<!--
Linear by TEMPLATED
templated.co @templatedco
Released for free under the Creative Commons Attribution 3.0 license (templated.co/license)
-->
<html>
<head>
<title>Milestone04</title>
<link href="shrimp.ico" rel="icon">
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="description" content="" />
<meta name="keywords" content="" />
<link href="https://fonts.googleapis.com/css?family=Roboto:100" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Ubuntu" rel="stylesheet">
<link rel="stylesheet" href="font-awesome/css/font-awesome.min.css">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="js/skel.min.js"></script>
<script src="js/skel-panels.min.js"></script>
<script src="js/init.js"></script>
<noscript>
<link rel="stylesheet" href="css/skel-noscript.css" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/style-desktop.css" />
</noscript>
<style>
h3 {
font-size:150%;
margin-bottom:1%;
}
</style>
</head>
<body>
<!-- Header -->
<div id="header">
<div id="nav-wrapper">
<!-- Nav -->
<nav id="nav">
<ul>
<li><a href="index.html">Homepage</a></li>
<li><a href="about.html">About</a></li>
<li><a href="team-contract.html">Team Contract</a></li>
<li><a href="meeting-minutes.html">Meeting Minutes</a></li>
<li><a href="ethics.html">Ethics Case Study</a></li>
</ul>
</nav>
</div>
<div class="container">
<!-- Logo -->
<div id="logo" style="font-family: Ubuntu; font-weight: normal">
<h1><a href="index.html">team-shrimp-cracker</a></h1>
<span class="tag">A robotics team dedicated to jamming the most flavor in a little robot.</span>
</div>
</div>
</div>
<!-- Header -->
<!-- Main -->
<div id="main">
<div class="container">
<div class="row">
<!-- Sidebar -->
<div id="sidebar" style="width: 20%;" class="4u">
<section>
<header>
<h2>LABWORK</h2>
</header>
<div class="row">
<section class="6u">
<ul class="default">
<li><a href="lab01.html">Lab01</a></li>
<li><a href="lab02.html">Lab02</a></li>
<li><a href="lab03.html">Lab03</a></li>
<li><a href="lab04.html">Lab04</a></li>
<li><a href="m01.html">Milestone01</a></li>
<li><a href="m02.html">Milestone02</a></li>
<li><a href="m03.html">Milestone03</a></li>
<li><a href="m04.html">Milestone04</a></li>
<li><a href="competition.html">Competition</a></li>
</ul>
</section>
</div>
</section>
</div>
<!-- Content -->
<div id="content" class="8u skel-cell-important" style="width:75%;">
<section>
<header style="margin-bottom:5%; ">
<h2>MILESTONE04</h2>
</header>
<div class="grey">
<h2 style="font-size:200%; margin-bottom: 2%;">Objectives</h2>
<ul>
<li>1. System that successfully displays the walls in a maze as the robot finds them</li>
<li>2. System that successfully displays treasures in a maze as the robot finds them</li>
<li>3. Robot that successfully signals ‘done’ on the screen when the maze has been mapped</li>
<li>4. Robot that successfully plays ‘done’ on the speaker when the maze has been mapped</li>
</ul>
</div>
<div class="white">
<h2 style="font-size:200%; margin-bottom: 2%;">Mapping The Walls
<!-- <a href="/code/m02_1.ino" download>-->
<!-- <i class="fa fa-download" aria-hidden="true" style="color:#e89093;"></i>-->
<!-- </a>-->
</h2>
<div style="width:50%; display: inline; float:right;">
<img src="https://i.imgur.com/FvvO4oY.png" style="width:80%; margin-left: 5%;">
<p> This video shows our robot mapping out the maze.</p>
<iframe src='https://gfycat.com/ifr/ArtisticPastFieldmouse' frameborder='0' scrolling='no' height='513' allowfullscreen style="width:70%; margin-left: 5%"></iframe>
</div>
<div style="width:45%;">
<p>Mapping the walls was fairly easy. We decided to stick with parallel configuration regarding the GUI. In order to remedy the potential timing issues, we have a write bit. The FPGA only writes after if the write bit is active high. This ensures that when the maze information is encoded in parallel digital signals, that the FPGA clock doesn’t encode partial information onto the VGA monitor. Specifially for walls, there are four bits of information that handle walls. The robot detects walls using short-range IR sensors. </p>
<p>To detect walls, we just have a threshhold for which we measured before to determine the appropriate distance that we record a wall. Once the robot itself detects a wall, it updates the maze grid in the arduino code dependent on the heading of the robot. For example, if the front wall sensor sensed a wall, that doesn’t necessarilly mean that there is a wall in the up direction from the current position. If the heading is to the right, then the wall is to the right of the current position. Once this data is encoded and sent over radio, we then decode the information on the receiver arduino into a readable packet and send it to the FPGA.</p>
</div>
<br>
<div style="width:45%;">
<p>For the FPGA GUI, we added walls by increasing the maze size. The logic is the same as the Java simulation. Instead of a 5 by 4 grid, we now encode a 11 by 9 grid.</p>
<p>This is because each actual tile has a potential wall between them. Including the walls on the outside of the maze, there are 6 positions for horizontal walls and 5 positions for the vertical walls. We hardcode in the outside walls. For the inner walls, the arduino sends the packet which lists the wall bits. The FPGA then just writes in the walls following simple logic regarding those bits. If there isn’t a wall, our implemenation fills the wall with the visited color as a stylistic choice.</p>
<br>
<p> The following is a snippet of the verilog logic.</p>
</div>
<pre>
<code>
if (packet[4:0] != 5'b000_00 && packet[4:0] != 5'b000_01 && my_grid[1][2]
!= wall && my_grid[1][2] != visited)
my_grid[1][2] <= unvisited;
else if ((packet[4:0] == 5'b000_00 || packet[4:0] == 5'b000_01) && my_grid[1][2]
!= wall && my_grid[1][2] != visited)
begin
if ((packet[4:0] == 5'b000_00 && packet[5]==1'b1)
|| (packet[4:0]==5'b000_01 && packet[6]==1'b1))
my_grid[1][2] <= wall;
else
my_grid[1][2] <= visited;
end
</code>
</pre>
<p>The picture of the mapped maze in the GUI is shown in the next section.</p>
</div>
<div class="grey">
<h2 style="font-size:200%; margin-bottom: 2%;">Treasure Detection
<!-- <a href="/code/m02_1.ino" download>-->
<!-- <i class="fa fa-download" aria-hidden="true" style="color:#e89093;"></i>-->
<!-- </a>-->
</h2>
<p>For the most part, our treasure detection was similar to the procedure we had used in Lab 2. We left the FFT code the same. However, since the positioning of the IR sensor was slightly different than we had anticipated in Lab 2 (ie. we did not have to detect treasures from as far away), the threshold we used in this milestone were different. We chose to slightly increase the threshold but decrease the time integration in order to speed up the treasure detection. While our treasure detection is able to detect the presence of a treasure most of the time, we occasionally have a false positive. However, since we plan to have a new robot for the final competition, we did not think it worth it to spend a lot of time getting the thresholds just right because the threshold will change based on the position of the sensor on the final robot.</p>
<p>The following code shows the FFT and our time integration to determine if there is a treasure. The time integration consists of reading from the ADC pin A0 five times, computing the FFT, and determining the presence of a treasure based on the results. Our algorithm checks the return value of the fft function - if it’s 0 for no treasure, 1 for 7kHz treasure, 2 for 12kHz, and 3 for 17.</p>
<pre>
<code>
int fft() {
int sum = 0;
ADCSRA = 0xe5;
for (int i = 0; i < 10; i++) {
... // same code as in lab 2
int x = treasureDetect();
sum = sum + x;
}
ADCSRA = adc_state;
if (sum < 5) return 0;
else if (sum < 15) return 1;
else if (sum < 25) return 2;
else return 3;
}
int treasureDetect() {
... // return 0 if no treasure, 1 if 7kHz, 2 if 12kHz, 3 if 17kHz
}
</code>
</pre>
<p>We currently check for treasures when we are stopped at an intersection. The intersections are at small enough intervals such that our IR sensor will not miss a treasure. Furthermore, because the FFT is computationally expensive, we do not want to check for treasures while trying to follow the line to move from one intersection to another.</p>
<p>The treasure detection is then displayed on the GUI by the FPGA, with the color depending on the frequency of the treasure.</p>
<p>Here is a picture of the GUI once the robot has mapped out the maze, with a white square representing a 7 kHz treasure:</p>
<img src="https://i.imgur.com/W9JX4er.jpg" style="width:100%;">
</div>
<div class="white">
<h2 style="font-size:200%; margin-bottom: 2%;">Done Signal</h2>
<h3>How the robot realizes it’s done</h3>
<p>The algorithm we use to map the maze is DFS. At every intersection, our robot checks the stack of frontier nodes (nodes it has detected as possible to visit but not yet visited). If the stack is empty, the robot realizes it has visited all the reachable nodes in the maze. The robot then sends the done signal.</p>
<p>The MSB of the 13bits “packet” is for the done signal. We assigned that bit to GPIO_0_D[32] of the FPGA. When the robot finished mapping the maze, the arduino in the robot would send an encoded message to the arduino with FPGA which would decode the message to have the 13th bit to be 1 indicating it’s done.</p>
<div style="width:50%; display: inline; float:right;">
<h3>Speaker</h3>
<p>When the robot is done mapping the maze, it would play a tone as this video shows.</p>
<iframe src="https://www.youtube.com/embed/i39QhQjaPLc" height="280" frameborder="0" gesture="media" allow="encrypted-media" allowfullscreen style="width:100%;"></iframe>
</div>
<div style="width:45%;">
<h3>Screen</h3>
<p>When receiving a done signal, the screen would become as the following picture shows.</p>
<img src="https://i.imgur.com/W9JX4er.jpg" style="width:100%;">
</div>
</div>
</section>
</div>
</div>
</div>
</div>
<!-- /Main -->
<!-- Tweet -->
<div id="tweet">
<div class="container">
<section>
<blockquote style="font-family:Ubuntu; letter-spacing: 2px;">no bad robots</blockquote>
</section>
</div>
</div>
<!-- Copyright -->
<div id="copyright">
<div class="container">
website design from <a href="http://templated.co">TEMPLATED</a>
<br>
</div>
</div>
</body>
</html>