{"id":7587,"date":"2023-09-18T19:05:54","date_gmt":"2023-09-18T18:05:54","guid":{"rendered":"https:\/\/dronesonen.usn.no\/?p=7587"},"modified":"2023-09-18T19:07:39","modified_gmt":"2023-09-18T18:07:39","slug":"group-4-week-4","status":"publish","type":"post","link":"https:\/\/dronesonen.usn.no\/?p=7587","title":{"rendered":"Group 4 &#8211; Week 4"},"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>This week was an interesting week as we were supposed to make a simple MVP1. After lecture on monday me and Lars started with exactly that. Our goal was to make the motor turn, stop and reverse on command from a computer. We connected the motor to the microbit, and the microbit to the computer. We then uploaded this code to the microbit:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" width=\"411\" height=\"262\" src=\"https:\/\/lh5.googleusercontent.com\/VyZCMETJLQycOpMbWJjZFvGjOOc4sxg132jaabW8Xvl21tUXbNz__rvpGMvkhl8NHDsQaNuA7IaqTT8vhUl45xdx-E4f3oaWo0327zbA0YlQSBT5_RkgVMWiHwPD5er02Zz2kmwt0vD1X8hGQCgeQm4\"><\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" width=\"436\" height=\"556\" src=\"https:\/\/lh4.googleusercontent.com\/8_QsjmCmdqO10vWVBaYo5ikZDb_5rwM051CZsY7IfmNBDElY6Kg169YeFj1XbzJt6OHTVxFHn8zh4JQjJ08D7n1thdtjQy93Oof4fex4A3M-NB47mvgRpUW1wAcrGn--AV08DJajNhTPPydYwBh327o\"><\/p>\n\n\n\n<p class=\"has-text-align-center\">And it worked!<\/p>\n\n\n\n<p>On Wednesday the software part of the group met up to start making some c++ code. We wanted to start developing an algorithm which can map and store data about the maze. By that I mean where the walls are, setting up how the mouse should continue mapping when it encounters multiple ways to go inside the maze, and make a visual representation of the maze. This is what I came up with: <\/p>\n\n\n\n<p>I first made a node class. This is meant to be a representation of one grid in the maze:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" width=\"571\" height=\"540\" src=\"https:\/\/lh3.googleusercontent.com\/BFB7ajXIOXghSbqg2cyaeBDiQo1qwPgQyjKX9hBJ34wethmQLP4bpPseGMteiukse5HUinpqn89h2pBk84w_FmlPF_KwQR1QvCnV4Z0LHASMaHmfv1yg7Zkv5tB6F47umPsPw26tkiUMWS6UwljIuHM\"><\/p>\n\n\n\n<p>Next I made a maze class:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/PfypjkWaRS0CIhBM0ZaGFeCU_3wjxvGFxo51q_YdW_EJjDZmzLez0F0N759F242lG-ocmy_mcE2URpcPIPQftUW-Rans4ptJ-bYwsomth-hJVT4g5scSHSYbrDilKbx6SjPOfdt70WEdnLzfcUUxGtE\" width=\"657\" height=\"345\"><\/p>\n\n\n\n<p>And then the main:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/hsD6_bgnTrgq8JeqKTnCAWCuYFcS2jpn-VSEq2sjP1NHHpyJHEFR3EAN6Vfdr8Dg_0BptbNDMSoKL4MpybvOEU8hUC75yKB1jSbe124WReIB7HoNo0Hvb4mfmCOSgGvd01b6sSirDd6NqZUF6Hfq2Y8\" width=\"602\" height=\"324\"><\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/_djycIoecUq9yxQftaUlULFlo2l-PVCZsUvjpwo26XPsiTe9sIPR5JGs_OdjwXsN00xn1CLdi--MzlIQxCSuq2We4xVMX1RGFEK1lXQBoF8yiB-QCtOPeQSMUWsVYQXpbNyzyDdQeHMAvou0S0_G3jo\" width=\"602\" height=\"356\"><\/p>\n\n\n\n<p>All of this generated this output:<\/p>\n\n\n\n<p class=\"has-text-align-center\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/53CRcHnKewUWzAnZBT5HqBs5t73mFfQssx3ozUBt2YS7fYOdg_ctT39AOAc8Y7sT4-dWj6mky0ebgDSrUuD14AlpguG2OEpeb0ML5tYVq5sxo0GcEJ9CNCStBjkv-RFX1ZAsfpAIY9Nv4wmQjCi-_gU\" width=\"484\" height=\"287\"><\/p>\n\n\n\n<p>1000 right about \u201cMaze\u201d in \u201cmaze is running\u2026\u201d is the (0,0) node.<\/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>This week I have been working on finalizing option 2 for the <strong>early-stage<\/strong> shortest path algorithm from week 3. In summary the idea was to represent the maze as a 5&#215;5 grid with <strong>no-walls<\/strong> at this point and only allowing vertical and horizontal movement. In this grid, each cell could store an object that, when combined with other cells or objects, would form a path from a specified start point to the center of the grid. Here is a visual representation of the grid populated with null-pointers before the calculation of shortest path has initiated (the vertical axis represents the x-axis in this case, while the horizontal axis represents the y-axis):&nbsp;<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-56-1024x208.png\" alt=\"\" class=\"wp-image-7588\" width=\"939\" height=\"191\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-56-1024x208.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-56-300x61.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-56-768x156.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-56.png 1074w\" sizes=\"auto, (max-width: 939px) 100vw, 939px\" \/><\/figure>\n\n\n\n<p>The actual coding of the shortest path algorithm was done using two classes: Node and Maze. Here is the blueprint\/class for the node-objects:&nbsp;&nbsp;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#pragma once\n#include &lt;iostream&gt;\n\nclass Node\n\n{\nprivate: \n\tstd::shared_ptr&lt;Node&gt; m_north_ptr = nullptr;\n\tstd::shared_ptr&lt;Node&gt; m_east_ptr = nullptr;\n\tstd::shared_ptr&lt;Node&gt; m_south_ptr = nullptr;\n\tstd::shared_ptr&lt;Node&gt; m_west_ptr = nullptr;\n\tbool m_isGoal = false;\n\tbool m_isVisited = false;\n\tdouble m_xidx = 0;\n\tdouble m_yidx = 0;\npublic: \n\tNode() {};\n\tNode(double x_idx, double y_idx, bool isGoal, bool isVisited) :\n\t\tm_xidx(x_idx), m_yidx(y_idx), m_isGoal(isGoal), m_isVisited(isVisited){}\n\n\tstd::shared_ptr&lt;Node&gt; getNorthptr() {\n\t\treturn m_north_ptr;\n\t}\n\tstd::shared_ptr&lt;Node&gt; getSouthptr() {\n\t\treturn m_south_ptr;\n\t}\n\tstd::shared_ptr&lt;Node&gt; getEastptr() {\n\t\treturn m_east_ptr;\n\t}\n\tstd::shared_ptr&lt;Node&gt; getWestptr() {\n\t\treturn m_west_ptr;\n\t}\n\tvoid setNorthptr(std::shared_ptr&lt;Node&gt; n) {\n\t\tm_north_ptr = n;\n\t}\n\tvoid setSouthptr(std::shared_ptr&lt;Node&gt; n) {\n\t\tm_south_ptr = n;\n\t}\n\tvoid setEastptr(std::shared_ptr&lt;Node&gt; n) {\n\t\tm_east_ptr = n;\n\t}\n\tvoid setWestptr(std::shared_ptr&lt;Node&gt; n) {\n\t\tm_west_ptr = n;\n\t}\n\tbool getIsVisited() {\n\t\treturn m_isVisited;\n\t}\n\tbool getIsGoal() {\n\t\treturn m_isGoal;\n\t}\n\tdouble getXidx() {\n\t\treturn m_xidx;\n\t}\n\tdouble getYidx() {\n\t\treturn m_yidx;\n\t}\n};\n<\/code><\/pre>\n\n\n\n<p>In short, objects of this class have a few get and set-functions, variables to store x and y coordinates and pointers to other node-objects in both the \u00b1x, and \u00b1y directions. These are represented through cardinal directions and is used to connect nodes or form paths. The isGoal- and isVisited variables were not used in this algorithm. The Maze class were designed as follows and includes the shortest path algorithm, and a function to connect the created node-objects:<\/p>\n\n\n\n<div class=\"wp-block-columns has-small-font-size is-layout-flex wp-container-core-columns-is-layout-d7d455e7 wp-block-columns-is-layout-flex\" style=\"padding-top:0;padding-right:0;padding-bottom:0;padding-left:0\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\">\n<pre class=\"wp-block-code\"><code>#pragma once\n#include &lt;iostream&gt;\n#include &lt;vector&gt;\n#include \"Node.h\"\n#include &lt;math.h&gt;\n\n\nclass Maze\n{\nprivate:\n\tstd::vector&lt;std::vector&lt;std::shared_ptr&lt;Node&gt;&gt;&gt; m_grid;\n\tdouble m_grid_size;\n\tdouble m_center_cord;\n\tstd::vector&lt;std::shared_ptr&lt;Node&gt;&gt; m_shortest_path_graph;\npublic:\n\tMaze(double gridSize) {\n\t\tm_grid_size = gridSize;\n\t\tm_center_cord = (gridSize - 1) \/ 2;\/\/odd number grids.\n\t\tfor (int i{ 0 }; i &lt; gridSize; i++) {\n\t\t\tstd::vector&lt;std::shared_ptr&lt;Node&gt;&gt; row;\n\t\t\tfor (int j{ 0 }; j &lt; gridSize; j++) {\n\t\t\t\trow.push_back(nullptr);\n\t\t\t}\n\t\t\tm_grid.push_back(row);\n\t\t}\n\t}\n\tstd::vector&lt;std::vector&lt;std::shared_ptr&lt;Node&gt;&gt;&gt; getGrid() {\n\t\treturn m_grid;\n\t}\n\tdouble getGridSize() {\n\t\treturn m_grid_size;\n\t}\n\tstd::vector&lt;std::shared_ptr&lt;Node&gt;&gt; getShortestPathGraph() {\n\t\treturn m_shortest_path_graph;\n\t}\n\n\tvoid calcShortestPath(std::shared_ptr&lt;Node&gt; n) {\n\t\tif (n == nullptr || n-&gt;getXidx() &lt; 0 || n-&gt;getXidx() &gt;= m_grid_size || n-&gt;getYidx() &lt; 0 || n-&gt;getYidx() &gt;= \t\t\tm_grid_size ||(n-&gt;getXidx() &gt; m_center_cord &amp;&amp; n-&gt;getYidx()&gt; \t\tm_center_cord) || n-&gt;getXidx() &gt; m_center_cord || \n\t\tn-&gt;getYidx() &gt; m_center_cord) {\n\t\t\treturn;\n\t\t}\n\t\tm_grid&#091;n-&gt;getXidx()]&#091;n-&gt;getYidx()] = n;\n\n\t\tdouble xidx_next = n-&gt;getXidx() + 1;\n\t\tdouble yidx_next = n-&gt;getYidx() + 1;\n\n\t\t\n\t\tdouble xnext_dist = sqrt(std::pow((2 - xidx_next), 2) + std::pow((2 - n-&gt;getYidx()), 2));\n\t\tdouble ynext_dist = sqrt(std::pow((2 \u2013 \n\t\tn-&gt;getXidx()), 2) + std::pow((2 - yidx_next), 2));\n\t\t\tif (xnext_dist &lt; ynext_dist || xnext_dist == \t\t\t\tynext_dist) {\t\t\t\t\t\t\t\t calcShortestPath(std::make_shared&lt;Node&gt;(xidx_next,n-&gt;getYidx(), 0, 0));\n\t\t\t}\n\t\t\telse {\n\t\t\t\tcalcShortestPath(std::make_shared&lt;Node&gt;(n-&gt;getXidx(), yidx_next, 0, 0));\n\t\t\t}\n\t\t}\n\t\n\tvoid connectNodes() {\n\t\tfor (int i{ 0 }; i &lt; m_grid_size; i++) {\n\t\t\tfor (int j{ 0 }; j &lt; m_grid_size; j++) {\n\t\t\t\tif (m_grid&#091;i]&#091;j] != nullptr) {\n\t\t\t\t\t\t\t  \t\tm_shortest_path_graph.push_back(m_grid&#091;i]&#091;j]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (int i{ 0 }; i &lt; m_shortest_path_graph.size()-1; i++) {\n\t\t\tif (m_shortest_path_graph&#091;i]-&gt;getXidx() + 1 == \t\t\t\t m_shortest_path_graph&#091;i + 1]-&gt;getXidx() &amp;&amp; m_shortest_path_graph&#091;i]-&gt;getYidx() == m_shortest_path_graph&#091;i+1]-&gt;getYidx()) {\n\t\t\t\t\n   m_shortest_path_graph&#091;i]-&gt;setSouthptr(m_shortest_path_graph&#091;i+1]);\n   m_shortest_path_graph&#091;i + 1] setNorthptr(m_shortest_path_graph&#091;i]);\n\t\t\t}\n\t\t\tif (m_shortest_path_graph&#091;i]-&gt;getYidx() + 1 == \t\t\t\tm_shortest_path_graph&#091;i + 1]-&gt;getYidx() &amp;&amp; \nm_shortest_path_graph&#091;i]-&gt;getXidx() == m_shortest_path_graph&#091;i+1]-&gt;getXidx()) {\nm_shortest_path_graph&#091;i]-&gt;setEastptr(m_shortest_path_graph&#091;i+1]);\nm_shortest_path_graph&#091;i + 1]-&gt;setWestptr(m_shortest_path_graph&#091;i]);\n\t\t\t}\n\t\t}\n\t}\n\n\n\tvoid showPointerInfo(std::shared_ptr&lt;Node&gt; n) {\n\t\tstd::cout &lt;&lt; \"  (\" &lt;&lt; n-&gt;getXidx() &lt;&lt; \", \" &lt;&lt; n-&gt;getYidx() \t\t\t&lt;&lt; \") ----&gt; \";\n\t\tif (n-&gt;getNorthptr() != nullptr) {\n\t\t\tstd::cout &lt;&lt; \"N: (\" &lt;&lt; n-&gt;getNorthptr()-&gt;getXidx() \t\t\t&lt;&lt; \", \" &lt;&lt; n-&gt;getNorthptr()-&gt;getYidx() &lt;&lt; \") \";\n\t\t} \n\t\telse {\n\t\t\tstd::cout &lt;&lt; \"N: \" &lt;&lt; 0 &lt;&lt; \", \";\n\t\t}\n\t\tif (n-&gt;getEastptr() != nullptr) {\n\t\t\tstd::cout &lt;&lt; \"E: (\" &lt;&lt; n-&gt;getEastptr()-&gt;getXidx() &lt;&lt; \t\t\t\", \" &lt;&lt; n-&gt;getEastptr()-&gt;getYidx() &lt;&lt; \") \";\n\t\t}\n\t\telse {\n\t\t\tstd::cout &lt;&lt; \"E: \" &lt;&lt; 0 &lt;&lt; \", \";\n\t\t}\n\t\tif (n-&gt;getSouthptr() != nullptr) {\n\t\t\tstd::cout &lt;&lt; \"S: (\" &lt;&lt; n-&gt;getSouthptr()-&gt;getXidx() \t\t\t&lt;&lt; \", \" &lt;&lt; n-&gt;getSouthptr()-&gt;getYidx() &lt;&lt; \") \";\n\t\t}\n\t\telse {\n\t\t\tstd::cout &lt;&lt; \"S: \" &lt;&lt; 0 &lt;&lt; \", \";\n\t\t}\n\t\tif (n-&gt;getWestptr() != nullptr) {\n\t\t\tstd::cout &lt;&lt; \"W: (\" &lt;&lt; n-&gt;getWestptr()-&gt;getXidx() &lt;&lt; \t\t\t\", \" &lt;&lt; n-&gt;getWestptr()-&gt;getYidx() &lt;&lt; \") \";\n\t\t}\n\t\telse {\n\t\t\tstd::cout &lt;&lt; \"W: \" &lt;&lt; 0 &lt;&lt; \", \";\n\t\t}\n\t\tstd::cout &lt;&lt; \"\\n\\n\";\n\t}\n\tvoid showShortestPath() {\n\t\tstd::cout &lt;&lt; \"Active nodes\/cells:\\n\\n\";\n\t\tfor (auto ptr : m_shortest_path_graph) {\n\t\t\tshowPointerInfo(ptr);\n\t\t}\n\t}\n};\n \n<\/code><\/pre>\n<\/div>\n<\/div>\n\n\n\n<p>The calcShortestPath()-function can be summarized as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Check if a set of conditions that could lead to errors or unexpected results is true or false. If true return, if false continue.<\/li>\n\n\n\n<li>Store the object in the grid-vector on indexes [object-&gt;getXidx()] [object-&gt;getYidx()].<\/li>\n\n\n\n<li>Calculate the next x and y values.<\/li>\n\n\n\n<li>Calculate the distance from the next coordinate, where either x or y has increased, to the center coordinate.<\/li>\n\n\n\n<li>Call the active function recursively and create a new object, with either the next x- or next y-value, depending on which new coordinate pair is closest to the center. Go back to step one and continue until center has been reached.<\/li>\n<\/ul>\n\n\n\n<p>After the calcShortestPath-function has run, all you get are a couple of standalone objects mapped to indexes in the grid. However, I also wanted to connect them to form a graph that could be viewed as a traversal path from a start point to the center. With this in mind I created the connectNodes()-function that works as follows:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Find the objects that are not null-pointers in the grid-vector and add them to the \u201cshortest path graph\u201d-vector.<\/li>\n\n\n\n<li>Go through every element of the &#8216;shortest path graph&#8217; vector and check the following: If the x-value of element &#8216;i&#8217; + 1 is equal to the x-value of element &#8216;i+1&#8217; and their y-values are the same, we have had an increment on the vertical axis (x-axis). In this case, set the south-pointer of element &#8216;i&#8217; to point at element &#8216;i+1,&#8217; and the north-pointer of element &#8216;i+1&#8217; to point at element &#8216;i.&#8217; If the y-value of element &#8216;i&#8217; + 1 is equal to the y-value of element &#8216;i+1&#8217; and their x-values are the same, we have had an increment on the horizontal axis (y-axis). In this case, set the east-pointer of element &#8216;i&#8217; to point at element &#8216;i+1,&#8217; and the west-pointer of element &#8216;i+1&#8217; to point at element &#8216;i.'&#8221;<\/li>\n<\/ul>\n\n\n\n<p>To print the graph, I added the showShortestPath()-function and after running it all from main we get the following results (<em>see picture below main()<\/em>):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code> int main()\n{\n    Maze grid(5);\n    grid.calcShortestPath(std::make_shared&lt;Node&gt;());\n    std::cout &lt;&lt; \"   ________\";\n    for (int i{ 0 }; i &lt; grid.getGridSize(); i++) {\n        if (i == 4) {\n            std::cout &lt;&lt; i &lt;&lt; \"________\";\n        }\n        else {\n            std::cout &lt;&lt; i &lt;&lt; \"________________\";\n        }\n    }\n    std::cout &lt;&lt; \"\\n\";\n    for (int i{ 0 }; i &lt; grid.getGridSize(); i++) {\n        std::cout &lt;&lt; i &lt;&lt; \" | \";\n        for (int j{ 0 }; j &lt; grid.getGridSize(); j++) {\n            if (grid.getGrid()&#091;i]&#091;j] != nullptr) {\n                std::cout &lt;&lt; \"     (\" &lt;&lt; grid.getGrid()&#091;i]&#091;j]-&gt;getXidx() &lt;&lt; \", \" &lt;&lt; grid.getGrid()&#091;i]&#091;j]-&gt;getYidx() &lt;&lt; \")\" &lt;&lt; \"      \";\n            }\n            else {\n                std::cout &lt;&lt; grid.getGrid()&#091;i]&#091;j] &lt;&lt; \" \";\n            }\n        }\n        std::cout &lt;&lt; \"\\n\";\n    }\n    \n    grid.connectNodes();\n    grid.showShortestPath();\n    \n}\n\n<\/code><\/pre>\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\/09\/image-58.png\" alt=\"\" class=\"wp-image-7591\" width=\"928\" height=\"426\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-58.png 945w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-58-300x138.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-58-768x353.png 768w\" sizes=\"auto, (max-width: 928px) 100vw, 928px\" \/><\/figure>\n\n\n\n<p>In the printed grid you can see what cells have been populated while the graph below indicates the connections that forms the shortest path. Here\u2019s a visual representation of it:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"640\" height=\"574\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-59.png\" alt=\"\" class=\"wp-image-7592\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-59.png 640w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-59-300x269.png 300w\" sizes=\"auto, (max-width: 640px) 100vw, 640px\" \/><\/figure>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong><em>Potential improvements &amp; challenges:<\/em><\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Limit the number of necessary turns from start point to center.<\/li>\n\n\n\n<li>Implement blockages\/walls (Combine workings with Erik-Andre\u2019s software work): Remove some cardinal coordinates in each cell?<\/li>\n\n\n\n<li>Turns and navigation should be based on sensor data in combination with algorithms.<\/li>\n\n\n\n<li>Transfer code to Visual Studio Code and Platform IO.<\/li>\n\n\n\n<li>Review and simulate other maze solving algorithms in maze simulators.<\/li>\n\n\n\n<li>Allow movement and navigation from starting points to center, where the starting points are not elements in [(0,0),(2,2)]. &nbsp;&nbsp;&nbsp;<\/li>\n<\/ul>\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 we tested the code to see if it got the motor to run.&nbsp;&nbsp;The rest of the&nbsp;week i started to work on the radio communication for the Micro mouse and I worked on how each part&nbsp;will communicate with each other.<\/p>\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 find and correct the problems encountered last week on the electrical system. Here is the original design:<\/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\/09\/image-60.png\" alt=\"\" class=\"wp-image-7594\" width=\"750\" height=\"382\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-60.png 915w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-60-300x153.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-60-768x392.png 768w\" sizes=\"auto, (max-width: 750px) 100vw, 750px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"559\" height=\"353\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-61.png\" alt=\"\" class=\"wp-image-7595\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-61.png 559w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-61-300x189.png 300w\" sizes=\"auto, (max-width: 559px) 100vw, 559px\" \/><\/figure>\n\n\n\n<p>By using the Analog Discovery oscilloscope and with the advice of our teacher, we found that the IR receiver was put in the wrong way on the breadboard. After changing it, we found three things:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The IR receiver is well receiving the IR light this way.<\/li>\n\n\n\n<li>A motor can\u2019t be supplied directly after the IR receiver (we\u2019ll use another way to do it).<\/li>\n\n\n\n<li>With the system in this disposition, the transistor after the IR emitter did not full fill its function, so we couldn\u2019t control the emission.<\/li>\n<\/ul>\n\n\n\n<p>We tried to modify the disposition of the transistor to make it work, simulated the circuit on Spice, but in the end, we changed the component for a MOSFET, because it\u2019s closer to the function we want to use (as a switch). Here is the new design we got for the emitter part:<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"666\" height=\"536\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-62.png\" alt=\"\" class=\"wp-image-7596\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-62.png 666w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-62-300x241.png 300w\" sizes=\"auto, (max-width: 666px) 100vw, 666px\" \/><\/figure>\n\n\n\n<p>After this change, here\u2019s the signal we got with the Analog Discovery (The VCC and MCU are supplied with 3V each):<\/p>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong><em>A video of the simulation:<\/em><\/strong><\/p>\n\n\n\n<p><\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/Smart-System-Week4-Simulation.mp4\"><\/video><\/figure>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong><em>A video of the system with my finger:<\/em><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-video\"><video controls src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/Smart-System-Week4-video.mp4\"><\/video><\/figure>\n\n\n\n<p>We got the signal we wanted. The signal is oscillating between 0 and 1V. With the advancement of the software team with the communication between the Microbit and the motor, doing the same with the electric system shall be easy.<\/p>\n\n\n\n<p class=\"has-text-align-center has-medium-font-size\"><strong><em>Conclusion:<\/em><\/strong><\/p>\n\n\n\n<p class=\"has-text-align-center\">The prototype is now working accordingly of what we wanted. We can now do this for the three other sensors we want.<\/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 class=\"has-text-align-center\">Connect the Microbit to the electronic system to send and receive data from it.<\/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 in the electrical part we have experienced some troubles. We tried one circuit for the IR transmitter and it didn\u2019t work, so we have to go step by step checking the circuit. We did the little circuit in a simulator to see if everything works well. <\/p>\n\n\n\n<p>As we can see in the pictures, in the two moods the transistor works well, when there was voltage in the base and when there was not as well. We have to point that this was done with an npn transistor, but the original circuit needed a MOSFET. Finally, during different tries, my partner changed the transistor and put a MOSFET instead and it worked.&nbsp;<\/p>\n\n\n\n<p>Also this week I have been trying to figure out how to connect the components in the motor driver board, as we want to put all together next week, and as the datasheet of the board doesn\u2019t said too much, I had to look at other websites.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"895\" height=\"489\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-63.png\" alt=\"\" class=\"wp-image-7599\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-63.png 895w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-63-300x164.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-63-768x420.png 768w\" sizes=\"auto, (max-width: 895px) 100vw, 895px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"859\" height=\"506\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-64.png\" alt=\"\" class=\"wp-image-7600\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-64.png 859w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-64-300x177.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-64-768x452.png 768w\" sizes=\"auto, (max-width: 859px) 100vw, 859px\" \/><\/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 I\u2019ve met several times with Richard&nbsp;to discuss about the different proptypes or ideas for the different components.&nbsp;So for starting to try all the different parts together we needed some chassis and wheels. For this I needed to take more precise measurements with a caliper, although these measurements may be changed due to trial and error. So we&nbsp; cut with the laser cut a wooden base with space to mount the initial components and the motors. The thickness is 3mm by default. We also print with the 3D printer&nbsp; some basic wheels to detect possible errors and identify the corresponding improvements the micromouse may need to move.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-core-columns-is-layout-28f84493 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"280\" height=\"431\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-67.png\" alt=\"\" class=\"wp-image-7603\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-67.png 280w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-67-195x300.png 195w\" sizes=\"auto, (max-width: 280px) 100vw, 280px\" \/><\/figure>\n<\/div>\n<\/div>\n\n\n\n<figure class=\"wp-block-image aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"517\" height=\"459\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-68.png\" alt=\"\" class=\"wp-image-7604\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-68.png 517w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/09\/image-68-300x266.png 300w\" sizes=\"auto, (max-width: 517px) 100vw, 517px\" \/><\/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 4, see you next week!\ud83d\ude0a<\/p>\n\n\n\n<p><em>Best regards<\/em>,<\/p>\n\n\n\n<p><em>Group 4 <\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Hi Dronesonen! \ud83d\ude0a Last week, we conducted the following efforts: Discipline &#8211; Software: Erik-Andre Hegna: This week was an interesting week as we were supposed to make a simple MVP1. After lecture on monday me and Lars started with exactly that. Our goal was to make the motor turn, stop and reverse on command from [&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-7587","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/7587","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=7587"}],"version-history":[{"count":9,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/7587\/revisions"}],"predecessor-version":[{"id":7681,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/7587\/revisions\/7681"}],"wp:attachment":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7587"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7587"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7587"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}