{"id":3478,"date":"2019-10-17T19:48:39","date_gmt":"2019-10-17T18:48:39","guid":{"rendered":"http:\/\/dronesonen.usn.no\/?p=3478"},"modified":"2019-10-17T20:07:19","modified_gmt":"2019-10-17T19:07:19","slug":"group-02-project-report-week-7","status":"publish","type":"post","link":"https:\/\/dronesonen.usn.no\/?p=3478","title":{"rendered":"Group 02 \u2013 Project Report \u2013 Week 7"},"content":{"rendered":"\n<p><strong>Mechanical&nbsp;<\/strong><\/p>\n\n\n\n<p>This week the mechanical group has made a lot of progress regarding the production of the&nbsp;different parts that needs to be 3D printed. We have made&nbsp;different versions of the same parts to see that they fit&nbsp;and&nbsp;made adjustments&nbsp;thereafter.&nbsp;There is not that much to write about this week since we\u2019ve&nbsp;more or less been&nbsp;creating the same parts&nbsp;this whole week.&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-768x1024.jpeg\" alt=\"\" class=\"wp-image-3488\" width=\"542\" height=\"722\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image.jpeg 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-225x300.jpeg 225w\" sizes=\"auto, (max-width: 542px) 100vw, 542px\" \/><figcaption>3D print of End Block Mount<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-1-768x1024.jpeg\" alt=\"\" class=\"wp-image-3489\" width=\"551\" height=\"734\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-1.jpeg 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-1-225x300.jpeg 225w\" sizes=\"auto, (max-width: 551px) 100vw, 551px\" \/><figcaption>3D print of Center Block and Pipe Connection<\/figcaption><\/figure><\/div>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"300\" height=\"325\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-58.png\" alt=\"\" class=\"wp-image-3490\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-58.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-58-277x300.png 277w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><figcaption>Printed parts<\/figcaption><\/figure><\/div>\n\n\n\n<p>We have needed to supply ourselves with additional&nbsp;components that USN doesn\u2019t have. There are&nbsp;not&nbsp;too&nbsp;many different bolts and nuts&nbsp;in the workshop, which leads to less&nbsp;freedom when designing different parts. Therefore, we have purchased the following components:&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"290\" height=\"286\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-61.png\" alt=\"\" class=\"wp-image-3493\" \/><figcaption>Newly purchased nut set<\/figcaption><\/figure><\/div>\n\n\n\n<p>Also, the pipes we had equipped from the workshop somehow got really bent. Therefore, we needed to equip some new ones&nbsp;and went to&nbsp;<em>i-senteret<\/em>&nbsp;and bought two&nbsp;new&nbsp;pipes.&nbsp;&nbsp;&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-62.png\" alt=\"\" class=\"wp-image-3494\" width=\"303\" height=\"306\" \/><figcaption>Newly purchased steel pipes<\/figcaption><\/figure><\/div>\n\n\n\n<p>Also, we have made a new and higher bridge for the&nbsp;camera,&nbsp;so it gets a view of the whole board,&nbsp;and&nbsp;a cut out of&nbsp;the&nbsp;score screen.&nbsp;We made it a bit bigger than the previous version&nbsp;so that we can store the electrical components&nbsp;in a better manner than previously planned.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-2-768x1024.jpeg\" alt=\"\" class=\"wp-image-3495\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-2.jpeg 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-2-225x300.jpeg 225w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><figcaption>Robot Air Hockey Mount<\/figcaption><\/figure>\n\n\n\n<p>We needed to&nbsp;make it a bit wider than the&nbsp;board so that it doesn\u2019t get in the way for the band. This will be more visual when the system&nbsp;assembly has got a bit further than now.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"768\" height=\"1024\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-3-768x1024.jpeg\" alt=\"\" class=\"wp-image-3496\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-3.jpeg 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-3-225x300.jpeg 225w\" sizes=\"auto, (max-width: 768px) 100vw, 768px\" \/><figcaption>Bridge set up over the Air Hockey Board<\/figcaption><\/figure>\n\n\n\n<p><strong>Electrical&nbsp;<\/strong><\/p>\n\n\n\n<p>This week we&#8217;ve managed to get almost all the components that we need for electrical part. Afterwards we programmed the sensor sender and receiver. The&nbsp;receiver&nbsp;is responding to intensity of a light, so when the sender(laser) is directed to&nbsp;the&nbsp;receiver,&nbsp;the&nbsp;intensity is the strongest. For score counting the sender is always sending signal (light) to&nbsp;the&nbsp;receiver and when the laser ray is cut by the disc (hockey puck), that means we scored a goal and the points increase by one.&nbsp;<\/p>\n\n\n\n<p>We&#8217;ve also connected and programmed the Liquid LED screen for showing us the score and time we&#8217;ve got left until the end of the game. First,&nbsp;we had to connect a&nbsp;potentiometer&nbsp;in between so we could set the proper&nbsp;background&nbsp;lightning of the screen. Without it&nbsp;we are not able&nbsp;to see&nbsp;if&nbsp;the screen&nbsp;actually working. At the end we connected sensor and liquid screen so they work together as it should at the end.&nbsp;<\/p>\n\n\n\n<p>The schematic of electrical power supply was also finally made, because we&#8217;ve managed to get a&nbsp;license&nbsp;for a&nbsp;proper&nbsp;program to work in. This schematic is completed for Hockey Machine Prototype that we have now, but it might change a little at the end if we&#8217;re going to add some things to it&nbsp;later on.&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"952\" height=\"703\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-49.png\" alt=\"\" class=\"wp-image-3479\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-49.png 952w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-49-300x222.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-49-768x567.png 768w\" sizes=\"auto, (max-width: 952px) 100vw, 952px\" \/><figcaption>Schematic 1<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"957\" height=\"707\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-51.png\" alt=\"\" class=\"wp-image-3480\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-51.png 957w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-51-300x222.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-51-768x567.png 768w\" sizes=\"auto, (max-width: 957px) 100vw, 957px\" \/><figcaption>Schematic 2<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"956\" height=\"708\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-50.png\" alt=\"\" class=\"wp-image-3481\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-50.png 956w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-50-300x222.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-50-768x569.png 768w\" sizes=\"auto, (max-width: 956px) 100vw, 956px\" \/><figcaption>Schematic 3<\/figcaption><\/figure>\n\n\n\n<p><strong>Computer&nbsp;<\/strong><\/p>\n\n\n\n<p>Similarly&nbsp;to the last couple of weeks, we have continued to divide our resources between the performance problems and the program.&nbsp;Whereas one of us began running tests to determine the necessity of the cooling fan we purchased, the other attempted to research and implement the improvements suggested by Steven last week.&nbsp;<br><br>In an effort to&nbsp;<strong>simplify and optimize our program<\/strong>, we have looked into the suggestions from Steven last week.&nbsp; <br><br>Our first step was to implement&nbsp;a&nbsp;FPS counter to better determine the performance of our program. This was a simple matter of dividing the&nbsp;number&nbsp;of frames up until a certain number of frames (e.g. 30) and divide that by the total amount of time it took to process those 30&nbsp;frames, and&nbsp;repeat this process every 30 frames.&nbsp; <br><br>We also made several different versions of our program, stripped down to only the color space operations, to determine exactly what functionality was most resource-intensive: one version with raw webcam footage, one version converting to HSV color space, and one version where we retain the default BGR color space.&nbsp;These tests were performed on the weaker raspberry pi 3, so we will have to run these tests for the raspberry pi 4 as well.&nbsp;For each of these versions, the FPS was 41, 23, 32 respectively, suggesting the BGR to HSV conversion takes about 10 FPS. Subsequently, we did the same comparison between BGR and HSV, only this time within the entirety of our program. As expected, with BGR we got 17 frames, and with HSV we got about 8 frames, which is consistent with our earlier tests where this conversion took 10 FPS.&nbsp; <br><br>Furthermore, we discovered that our angle calculation functionality was rather demanding, and when not used, we went from 8 FPS to 13 FPS using the HSV color space. The rest of the functionality of the program we have not been able to test without, as these are currently necessary to make the program work in the first place.<br><br>Unfortunately, using HSV may be necessary after all. After much testing, it appears that the inherent sensitivity to light when using the BGR color space is too prone to present problems. We made a program where we can define the color ranges of the mask in real-time (using&nbsp;openCV&nbsp;trackbars) to create the best mask possible, and when our object was exposed to slightly more light when we used the BGR color space, the program could no longer track the object. Meanwhile, doing the same test with HSV, the program was still able to track the object reliably. Perhaps we could use BGR if we were very certain of the lighting conditions, and that these would never change, but HSV seems to be more robust.&nbsp; &nbsp; <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"439\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-54.png\" alt=\"\" class=\"wp-image-3484\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-54.png 800w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-54-300x165.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-54-768x421.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><\/figure>\n\n\n\n<p>Using trackbars made testing far, far easier, as we could see in real-time how to best adjust our mask for any given condition; in the image above this is done for&nbsp;BGR, but&nbsp;could just as easily be implemented for HSV.&nbsp;Using trackbars, we may be able to define a color range for the final product that allows us to use BGR, provided the light will be static and uniform enough.&nbsp;<br><br>That being said, we&nbsp;were able to optimize the program by removing some seemingly unnecessary algorithms (such as gaussian blur, distortion, erosion), which resulted in a slight performance gain. Moving forward, we will need to find out how we can simplify the program even further; Steven suggested we didn\u2019t need to find the contour to find the centroid (although from our research, this appears to be the most conventional method of doing it?), so we will need to do some more research and experimentation in an effort to optimize our program even more.&nbsp; <\/p>\n\n\n\n<p><strong>Addressing the heating issues<\/strong>, this week we received the cooling kit for RP 4 and did some testing and monitoring of the processor temperature and thermal throttling.&nbsp; Even though we were pretty sure that the cooling system was a must for the new Pi from the research and different articles we read on the subject, we decided to take Steven\u2019s advice and do some testing of our own &#8211; not only to verify that the processor was in fact overheating when running our program but also to test and verify that the new cooling system solves the throttling issue.&nbsp;&nbsp;<\/p>\n\n\n\n<p>From Raspberry Pi foundation we know that when the Pi 4 heats up beyond 80\u00b0C, the clock&nbsp;frequency&nbsp;is reduced and&nbsp;the&nbsp;CPU is throttled to reduce the temperature, which in turn&nbsp;decreases the performance. We first noticed this condition when compiling the OpenCV from source and a half-full red thermometer appeared on the display (pictured below)The icon is an overheating warning which also appears on the screen when running our program without cooling.&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-52.png\" alt=\"\" class=\"wp-image-3482\" width=\"31\" height=\"63\" \/><figcaption>Overheating warning<\/figcaption><\/figure><\/div>\n\n\n\n<p>Following Bash Script was written to measure and monitor processor temperature every 30 seconds for 10 minutes.&nbsp;&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"593\" height=\"495\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-53.png\" alt=\"\" class=\"wp-image-3483\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-53.png 593w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-53-300x250.png 300w\" sizes=\"auto, (max-width: 593px) 100vw, 593px\" \/><\/figure>\n\n\n\n<p><strong>tempmon&nbsp;<\/strong>runs it like any other Linux command. We outputted the data stream with the results to the terminal window as well as to a file for easy graph plotting&nbsp;later on.&nbsp;&nbsp;<\/p>\n\n\n\n<p>Here are the results from monitoring the core temperature while in idle state and while running our program, without and with cooling respectively:&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"729\" height=\"691\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-55.png\" alt=\"\" class=\"wp-image-3485\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-55.png 729w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-55-300x284.png 300w\" sizes=\"auto, (max-width: 729px) 100vw, 729px\" \/><figcaption>Idle state<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"765\" height=\"693\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-56.png\" alt=\"\" class=\"wp-image-3486\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-56.png 765w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-56-300x272.png 300w\" sizes=\"auto, (max-width: 765px) 100vw, 765px\" \/><figcaption>Running the program<\/figcaption><\/figure>\n\n\n\n<p>The results visualized in a line chart:&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"674\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-57-1024x674.png\" alt=\"\" class=\"wp-image-3487\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-57.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-57-300x197.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/10\/image-57-768x506.png 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>We are especially interested in the results while running the program.&nbsp;First of all, this confirms our assumption that the processor gets overheated and needs cooling. As you can see after approximately five minutes of running the program right after booting up the OS the temperature rises above 80\u00b0C and CPU is throttled.&nbsp;&nbsp;<\/p>\n\n\n\n<p>The core temperature almost halved after the heat sinks and the cooling fan were installed. It stabilizes at about 45\u00b0C and stays there through the first test. We did run an additional test for another 10 minutes right after to confirm that the temperature remained the same (the results from the second test are not included here to avoid redundancy).&nbsp;&nbsp;<\/p>\n\n\n\n<p>This concludes the thermal testing and confirms that the purchases of the cooling system&nbsp;was&nbsp;indeed a good investment.&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mechanical&nbsp; This week the mechanical group has made a lot of progress regarding the production of the&nbsp;different parts that needs to be 3D printed. We have made&nbsp;different versions of the same parts to see that they fit&nbsp;and&nbsp;made adjustments&nbsp;thereafter.&nbsp;There is not that much to write about this week since we\u2019ve&nbsp;more or less been&nbsp;creating the same parts&nbsp;this [&hellip;]<\/p>\n","protected":false},"author":65,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[51,52],"tags":[],"class_list":["post-3478","post","type-post","status-publish","format-standard","hentry","category-smart-systems-2019","category-the-unbeatable-air-hockey-team"],"_links":{"self":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/3478","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3478"}],"version-history":[{"count":2,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/3478\/revisions"}],"predecessor-version":[{"id":3498,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/3478\/revisions\/3498"}],"wp:attachment":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3478"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3478"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3478"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}