{"id":8211,"date":"2023-10-30T20:05:12","date_gmt":"2023-10-30T19:05:12","guid":{"rendered":"https:\/\/dronesonen.usn.no\/?p=8211"},"modified":"2023-10-30T20:05:12","modified_gmt":"2023-10-30T19:05:12","slug":"group-4-week-10","status":"publish","type":"post","link":"https:\/\/dronesonen.usn.no\/?p=8211","title":{"rendered":"Group 4 &#8211; Week 10"},"content":{"rendered":"\n<p class=\"has-text-align-center\" style=\"font-size:1.5rem\">Hi Dronesonen! \ud83d\ude0a<\/p>\n\n\n\n<p class=\"has-text-align-center\">Last week we conducted the following efforts:<\/p>\n\n\n\n<p class=\"has-text-align-center has-large-font-size\"><strong>Discipline &#8211; Software:<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p style=\"font-size:1.5rem\"><strong>Erik-Andre Hegna:<\/strong><\/p>\n\n\n\n<p>Monday was spent with Lars and Ask to map the logic of our micromouse on a whiteboard. By that I mean, in what order things are completed\/terminated, and depending on what is happening with the sensors the mouse will make decisions accordingly.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-179.png\" alt=\"\" class=\"wp-image-8293\" width=\"651\" height=\"481\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-179.png 827w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-179-300x222.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-179-768x567.png 768w\" sizes=\"auto, (max-width: 651px) 100vw, 651px\" \/><\/figure>\n\n\n\n<p>Wednesday was spent on creating the PID regulator using the left and right side sensor. It is supposed to make the mouse able to hold and auto correct its path inside the maze. As geometrical size will change once the PCB arrives, I have not been able to calibrate the movement and adjust correct motor movement for optimal movement through the maze. But the mouse was able to autocorrect its movement to a certain degree:<\/p>\n\n\n\n<figure class=\"wp-block-video aligncenter\"><video controls src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/PID-test.mp4\"><\/video><\/figure>\n\n\n\n<p>This is the code i created:<\/p>\n\n\n\n<p class=\"has-text-align-center\" style=\"font-size:1.5rem\">Needed functions:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"941\" height=\"801\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-180.png\" alt=\"\" class=\"wp-image-8295\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-180.png 941w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-180-300x255.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-180-768x654.png 768w\" sizes=\"auto, (max-width: 941px) 100vw, 941px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"342\" height=\"731\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-181.png\" alt=\"\" class=\"wp-image-8296\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-181.png 342w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-181-140x300.png 140w\" sizes=\"auto, (max-width: 342px) 100vw, 342px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center\" style=\"font-size:1.5rem\">Main loop:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"834\" height=\"585\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-182.png\" alt=\"\" class=\"wp-image-8297\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-182.png 834w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-182-300x210.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-182-768x539.png 768w\" sizes=\"auto, (max-width: 834px) 100vw, 834px\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p style=\"font-size:1.5rem\"><strong>Lars Leganger:<\/strong><\/p>\n\n\n\n<p>On Monday I worked on the structure of the mouses movement. We set up diagram on how the mouse will move and what it should prioritize based on how we want it to move.<\/p>\n\n\n\n<p>On Wednesday we started to take measurements to use in the driver functions of the mouse. We decided to wait because we think we can get even more accurate data from the sensors.&nbsp;&nbsp;<\/p>\n\n\n\n<p>I worked on ways to solve the mapping problem for the mouse.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p style=\"font-size:1.5rem\"><strong>Ask Lindbr\u00e5ten:<\/strong><\/p>\n\n\n\n<p>On Monday, the other software guys and I decided to have a theoretical discussion about the conditions the micromouse must validate before conducting actions in the maze, since we had to wait for some electrical and mechanical changes before we could conduct more practical tests. Additionally, we also discussed what specific motor control functions are needed to perform these actions. We began by writing a rough check-list, before I had to leave for my usual mandatory work. But later I was informed that Erik-Andre and Lars decided to create a small tree-graph instead, since it made it a lot easier to visualize all the possible outcomes of the conditions in the check-list.<\/p>\n\n\n\n<p>On Wednesday, my main goal was to hopefully verify that the \u201clistening to port and writing to text files\u201d \u2013 script I created last week would work and start running measurement tests for cm\u2019s between 0 to 50 to find an improved best fit linear function to adjust measurements to real world distances. We realized that we had to adjust our \u201cdriving forward\u201d \u2013 range to &gt; 50, since having it set to &gt; 20, left us with little time to make any necessary adjustments, should we for instance encounter an obstacle at a distance of 21 cm from the front\/middle sensor.<\/p>\n\n\n\n<p>However, After a brief update on the PCB with Hugo, we decided to halt the entire measurement test until we receive the PCB. The possible changes to the sensor\u2019s placement, connections and noise as a result of a cleaner setup would most likely result in me and Lars having to run the entire measurements test a second time under the final test conditions, which would be quite time-consuming and unnecessary. But we still wanted to verify that the script would work as intended, so we can start the practical tests as soon as the PCB arrives. Me and Lars tested it for a few cm\u2019s, and it worked! \ud83d\ude01 Finally!!<\/p>\n\n\n\n<p>After that, I talked a little bit with Erik-Andre on how he visualized we could apply the lowpass-filter to our project. We want to apply it for singular values and return a single filtered value based on the previous filtered value, instead of a filtered data set. The script I created and added below does exactly that. Bear in mind that the constant values for the strength variables, which decides if the new filtered value are closer to the previous filtered value or the measurement, are just examples and have to be adjusted after further tests and discussions with the group. There is pros and cons with increasing or decreasing both, but we have to find what works best for us.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>double adjLowPass(double arr&#091;], double nv_strength, double oldv_strength, double x);\n\nint main()\n{\n\tdouble prev_val_arr&#091;1] = { 0 };\n\tdouble new_val_str = 0.5;\n\tdouble old_val_str = 0.5;\n\n\tdouble measure = 5.75;\n\tdouble filtered_measure = adjLowPass(prev_val_arr, new_val_str, old_val_str, measure);\n\tstd::cout &lt;&lt; \"Old value = \" &lt;&lt; measure;\n\tstd::cout &lt;&lt; \"\\nfiltered val = \" &lt;&lt; filtered_measure;\n\n\tmeasure = 6;\n\tfiltered_measure = adjLowPass(prev_val_arr, new_val_str, old_val_str, measure);\n\tstd::cout &lt;&lt; \"\\nOld value = \" &lt;&lt; measure;\n\tstd::cout &lt;&lt; \"\\nfiltered val = \" &lt;&lt; filtered_measure;\n\n\tmeasure = 10;\n\tfiltered_measure = adjLowPass(prev_val_arr, new_val_str, old_val_str, measure);\n\tstd::cout &lt;&lt; \"\\nOld value = \" &lt;&lt; measure;\n\tstd::cout &lt;&lt; \"\\nfiltered val = \" &lt;&lt; filtered_measure;\n\n\tprev_val_arr&#091;0] = 0;\n\n\tdouble measures&#091;8] = { 5.75, 5.71, 5.68, 8.45, 5.74, 6.00, 5.67, 5.70 };\n\tconst int size = sizeof(measures)\/sizeof(measures&#091;0]);\n\tdouble filtered_measures&#091;size];\n\n\tfor (int i{ 0 }; i &lt; size; i++) {\n\t\tfiltered_measures&#091;i] = adjLowPass(prev_val_arr, new_val_str, old_val_str, measures&#091;i]);\n\t}\n\n\tstd::cout &lt;&lt; \"\\n\\nUnfiltered measure with spike:\\n\";\n\tfor (int i = 0; i &lt; size; i++) {\n\t\tstd::cout &lt;&lt; measures&#091;i] &lt;&lt; \", \";\n\t}\n\tstd::cout &lt;&lt; \"\\nFiltered measures:\\n\";\n\tfor (int i = 0; i &lt; size; i++) {\n\t\tstd::cout &lt;&lt; filtered_measures&#091;i] &lt;&lt; \", \";\n\t}\n\t\n   \n}\n\ndouble adjLowPass(double arr&#091;], double nv_strength, double oldv_strength, double x)\n{\n\tif (arr&#091;0] == 0) {\n\t\tarr&#091;0] = x;\n\t\treturn arr&#091;0];\n\t}\n\telse {\n\t\tdouble filtered_x = arr&#091;0] * oldv_strength + x * nv_strength;\n\t\tarr&#091;0] = filtered_x;\n\t\treturn arr&#091;0];\n\t}\n}\n<\/code><\/pre>\n\n\n\n<p>Running this script gives the following results: &nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"945\" height=\"291\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-153.png\" alt=\"\" class=\"wp-image-8213\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-153.png 945w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-153-300x92.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-153-768x236.png 768w\" sizes=\"auto, (max-width: 945px) 100vw, 945px\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p class=\"has-text-align-center has-large-font-size\"><strong>Discipline &#8211; Electrical:<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p style=\"font-size:1.5rem\"><strong>Hugo Valery Mathis Masson-Benoit:<\/strong><\/p>\n\n\n\n<p>The objective for this week was to finish the design of the PCB, and do the testing for the magnetic sensors.<\/p>\n\n\n\n<p class=\"has-text-align-center\" style=\"font-size:1.5rem\">Magnetic sensors:<\/p>\n\n\n\n<p>Unexpectedly, I needed to do myself the testing for the implementation of the magnetic sensor. So, I tested them to see how they would react in a circuit. After some time and the help of Mr.Bos, I\u2019ve realized that a pull-down resistor is needed to make the magnetic sensor switch.<\/p>\n\n\n\n<p>The final design for the implementation of the sensors was this:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"465\" height=\"449\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-183.png\" alt=\"\" class=\"wp-image-8298\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-183.png 465w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-183-300x290.png 300w\" sizes=\"auto, (max-width: 465px) 100vw, 465px\" \/><\/figure>\n\n\n\n<p>To make everything work, the polarity of the magnets needs to be altered on the wheel like this : one South pole, one North pole, one South pole, etc \u2026 So, the sensor will switch between an high state and a low state each time it encounters a magnet.<\/p>\n\n\n\n<p>I\u2019m going to write a document to show the mechanical engineer how to implement the magnets.<\/p>\n\n\n\n<p class=\"has-text-align-center\" style=\"font-size:1.5rem\">PCB design:<\/p>\n\n\n\n<p>The PCB design is finished. I\u2019ve checked with the mechanical engineer to confirm that the design was good for her and that she had the place needed to work with to fix the motor and other mechanical part.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"785\" height=\"619\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-184.png\" alt=\"\" class=\"wp-image-8299\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-184.png 785w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-184-300x237.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-184-768x606.png 768w\" sizes=\"auto, (max-width: 785px) 100vw, 785px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"749\" height=\"583\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-185.png\" alt=\"\" class=\"wp-image-8300\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-185.png 749w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-185-300x234.png 300w\" sizes=\"auto, (max-width: 749px) 100vw, 749px\" \/><\/figure>\n\n\n\n<p>The PCB was commanded the 26\/08\/2023, so it should be delivered for the next week.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong><em>Conclusion: <\/em><\/strong><\/p>\n\n\n\n<p>The magnetic sensors are tested and implemented, and PCB is done, approved and commanded.<\/p>\n\n\n\n<p class=\"has-text-align-center\"><strong><em>Objective for next week: <\/em><\/strong><\/p>\n\n\n\n<p>I\u2019m waiting for the delivery, then I\u2019ll solder all the component and I\u2019ll be finished for my part.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p style=\"font-size:1.5rem\"><strong>Jemima Niquen Tapia<\/strong>:<\/p>\n\n\n\n<p>This week I prepared the prototype for the rice drag, finally fixed the code problem and it worked as we planned.&nbsp;<\/p>\n\n\n\n<p>Then with the mechanical engineer we prepared the next prototype too. We connect the new motors and the regulator as we have\u00a0 9V motors now, and they are little. The software team needed the connection of the motors and the sensors to do some calibration, so we did a quick adaptation till we didn&#8217;t have the PCB. In the picture we can see the final result.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"534\" height=\"950\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-186.png\" alt=\"\" class=\"wp-image-8301\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-186.png 534w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-186-169x300.png 169w\" sizes=\"auto, (max-width: 534px) 100vw, 534px\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p class=\"has-text-align-center has-large-font-size\"><strong>Discipline &#8211; Mechanical:<\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" \/>\n\n\n\n<p style=\"font-size:1.5rem\"><strong>Cesia Niquen Tapia<\/strong>:<\/p>\n\n\n\n<p>This week in order to have a functional prototype I designed a quick second floor&nbsp; with the laser cut. This was needed since the last 3D printing failed. This laser cut assy &nbsp;was made in order to start with the testing, and meanwhile we wait for the pcv.<\/p>\n\n\n\n<p>There was also a redesign with the wheels, in order to make them fit better in the engines, improving the traction and movement of the micromouse.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"516\" height=\"685\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-187.png\" alt=\"\" class=\"wp-image-8302\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-187.png 516w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/10\/image-187-226x300.png 226w\" sizes=\"auto, (max-width: 516px) 100vw, 516px\" \/><\/figure>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\" \/>\n\n\n\n<p class=\"has-text-align-center\" style=\"font-size:1.5rem\">This concludes our blog post for week 10, see you next week!\ud83d\ude0a<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi Dronesonen! \ud83d\ude0a Last week we conducted the following efforts: Discipline &#8211; Software: Erik-Andre Hegna: Monday was spent with Lars and Ask to map the logic of our micromouse on a whiteboard. By that I mean, in what order things are completed\/terminated, and depending on what is happening with the sensors the mouse will make [&hellip;]<\/p>\n","protected":false},"author":97,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-8211","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/8211","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\/97"}],"replies":[{"embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8211"}],"version-history":[{"count":5,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/8211\/revisions"}],"predecessor-version":[{"id":8303,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/8211\/revisions\/8303"}],"wp:attachment":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8211"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8211"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8211"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}