{"id":3640,"date":"2019-11-07T21:42:34","date_gmt":"2019-11-07T20:42:34","guid":{"rendered":"http:\/\/dronesonen.usn.no\/?p=3640"},"modified":"2019-11-07T21:42:34","modified_gmt":"2019-11-07T20:42:34","slug":"group-02-project-report-week-10","status":"publish","type":"post","link":"https:\/\/dronesonen.usn.no\/?p=3640","title":{"rendered":"Group 02 \u2013 Project Report \u2013 Week 10"},"content":{"rendered":"\n<p><strong>Mechanical\u00a0<\/strong><\/p>\n\n\n\n<p>This week has gone to further assemble the air hockey system, and we now have all the components except the timed band, which will arrive either this Friday or Monday. There has been a lot of complications with shipping, but we are\u00a0fairly\u00a0certain it will arrive\u00a0at\u00a0this time since we have had direct communications with the salesman, and it is shipped from\u00a0Sandnes, Norway.\u00a0\u00a0<br><br>We have also cut out the\u00a0plexi-plate for the air hockey board top plate. This was a very\u00a0time-consuming\u00a0process,\u00a0but it\u00a0finished\u00a0just in time for me\u00a0[Markus]\u00a0leaving for the rest of the week.\u00a0Furthermore, we finished the bottom plate for the fan construction. As of now, we only have one fan, but hopefully the others will arrive very soon. This is not a critical component, but it would be nice to have it now rather than later.\u00a0 <\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"467\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-8-1024x467.png\" alt=\"\" class=\"wp-image-3648\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-8-1024x467.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-8-300x137.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-8-768x350.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-8.png 1539w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Laser cutting plexi plate<\/figcaption><\/figure><\/div>\n\n\n\n<p>Most of the construction has been a cooperative process with the electrical students, so a lot of the pictures will come in their section as well.<br><br>There has not been much 3D modelling this time around, but we will soon start to make some 2D drawings of the system, exploded views, etc. so that everything is more presentable at the end of the project period.\u00a0\u00a0 <\/p>\n\n\n\n<p><strong>Electro\u00a0<\/strong><\/p>\n\n\n\n<p>This week we\u00a0have been\u00a0helping\u00a0with\u00a0mounting\u00a0and implementing the\u00a0mechanical components to the board, so that we could\u00a0fit the plexiglass plate into the board.\u00a0The bridge is now attached to the board, so we\u00a0are able to\u00a0start testing the camera on\u00a0the\u00a0actual\u00a0board.\u00a0<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"569\" height=\"373\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-9.png\" alt=\"\" class=\"wp-image-3649\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-9.png 569w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-9-300x197.png 300w\" sizes=\"auto, (max-width: 569px) 100vw, 569px\" \/><figcaption>Assembling the plexi board supports<\/figcaption><\/figure><\/div>\n\n\n\n<p>We wrote a&nbsp;program&nbsp;for calibration of the stick. It is very important to do&nbsp;this before every game,&nbsp;so the computer knows where it&#8217;s holding the stick and so it&#8217;s able to play against someone. Calibration works like this: When the stick is moving towards the side a button is pressed and coordinates are set to zero. After that we&nbsp;must&nbsp;measure&nbsp;very&nbsp;precisely the&nbsp;exact&nbsp;steps of the stepper motor, how many steps it&nbsp;must&nbsp;do to come to the other side across and forward. That way we will get the coordinate system for our stick and we will be able to send its coordinates to the&nbsp;Arduino so that we can move the stick to that exact location.&nbsp;<\/p>\n\n\n\n<p>Theory doesn&#8217;t always cooperate with practical work. As it is seen on the picture below, we had some issues with calculation with mounting the printed parts on the wooden blocks, but&nbsp;we&nbsp;are&nbsp;all&nbsp;learning&nbsp;from&nbsp;mistakes,&nbsp;aren&#8217;t&nbsp;we?&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"465\" height=\"458\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-4.png\" alt=\"\" class=\"wp-image-3642\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-4.png 465w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-4-300x295.png 300w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><figcaption>Slightly damaged 3D printed parts<\/figcaption><\/figure><\/div>\n\n\n\n<p>We are still having trouble with the shipping\u00a0of our components, such as the\u00a0band, fans and LED strip. The shipping company mixed the addresses and sent it to the wrong location, and we are now expecting these to arrive next week. Despite all these problems we had to start testing the prototype;\u00a0this is the result of engineering improvisation.\u00a0<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"767\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-7-1024x767.jpeg\" alt=\"\" class=\"wp-image-3645\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-7.jpeg 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-7-300x225.jpeg 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-7-768x575.jpeg 768w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption>Improvised solution for making a smaller band work for our prototype<\/figcaption><\/figure><\/div>\n\n\n\n<p><strong>Computer\u00a0<\/strong><\/p>\n\n\n\n<p>This week the computer engineering students have been researching how to progress with the next step of our program (implementing rudimentary defense), fixing a couple of bugs in the program, and making some of the information more human readable for testing purposes.\u00a0<br><br>For the program, we have discussed how to best implement the computer\u2019s defensive capabilities, the very rough sketches of which is shown in the image below. Two ideas are displayed here: the first is the bottom rightmost tiny circle. Initially we thought we could perhaps simply calculate the vector between the puck\u2019s position (of which we already have an array), and a static point set in the middle of the goal, and have the stick intercept this vector. We realized after some discussion that this would not suffice, as this would only work if the puck was always aimed at the middle of the goal, which would not always be the case.\u00a0 <\/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\/11\/image-8-576x1024.jpeg\" alt=\"\" class=\"wp-image-3644\" width=\"336\" height=\"597\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-8.jpeg 576w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-8-169x300.jpeg 169w\" sizes=\"auto, (max-width: 336px) 100vw, 336px\" \/><figcaption>Preliminary sketches for basic defense<\/figcaption><\/figure><\/div>\n\n\n\n<p>Consequently, we advanced to our second idea, which was to calculate the trajectory of the puck based on its previous position, and its current position, by constructing a vector out of those two positions, but we weren\u2019t quite sure where to go from there. Steven suggested that we construct this vector, and check where said vector intersects with the X-axis (aka where Y = 0), and if it intersects in the boundaries we define to be the goal, we have the stick intersect this vector, thereby defending the goal. To accomplish this, we make use of a couple of simple formulas:\u00a0<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"326\" height=\"66\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-6.png\" alt=\"\" class=\"wp-image-3646\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-6.png 326w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-6-300x61.png 300w\" sizes=\"auto, (max-width: 326px) 100vw, 326px\" \/><\/figure><\/div>\n\n\n\n<p>Now, to find where this line intersects with the x-axis, we need to solve equation (2) for x where y = 0:&nbsp;<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"82\" height=\"43\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-5.png\" alt=\"\" class=\"wp-image-3643\" \/><\/figure><\/div>\n\n\n\n<p>This is the x-coordinate where our line intersects with the x-axis. Using this coordinate, we can check if it lies within the\u00a0boundary\u00a0we define to be the goal, so:\u00a0<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"336\" height=\"80\" src=\"http:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-10.png\" alt=\"\" class=\"wp-image-3650\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-10.png 336w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-10-300x71.png 300w\" sizes=\"auto, (max-width: 336px) 100vw, 336px\" \/><\/figure><\/div>\n\n\n\n<p>We will need to implement this math into the context of our program, and subsequently test if this gives us the correct values. To test it, we will first calculate some points by hand, and see if the program outputs the same results as we get on paper.\u00a0<br><br>As for the bug fixing, we have been able to locate and fix the issue where our program would crash if it was unable to find a contour in the initial frame, or if the contour ever went offscreen. The reason for this was that we would be checking for non-existent indexes in our centroid array, and it was fixed with a few simple \u201cif\u201d checks at the locations in our program that used the array in question, to ensure that the array had a sufficient amount of elements.\u00a0 <br><br>Finally, the smallest (but most visual) change this week was making the program more human-readable; we now output all of the information generated by our program directly onto the frame, making it far easier to discern the numbers, as opposed to reading them directly from the terminal (where they fly by extremely fast).\u00a0 <\/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\/11\/image-7.png\" alt=\"\" class=\"wp-image-3647\" width=\"580\" height=\"461\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-7.png 643w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2019\/11\/image-7-300x238.png 300w\" sizes=\"auto, (max-width: 580px) 100vw, 580px\" \/><figcaption>Information generated by program (bottom left) now more human-readable<\/figcaption><\/figure><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Mechanical\u00a0 This week has gone to further assemble the air hockey system, and we now have all the components except the timed band, which will arrive either this Friday or Monday. There has been a lot of complications with shipping, but we are\u00a0fairly\u00a0certain it will arrive\u00a0at\u00a0this time since we have had direct communications with the [&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-3640","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\/3640","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=3640"}],"version-history":[{"count":1,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/3640\/revisions"}],"predecessor-version":[{"id":3651,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/3640\/revisions\/3651"}],"wp:attachment":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3640"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3640"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}