{"id":8458,"date":"2023-11-13T06:52:37","date_gmt":"2023-11-13T05:52:37","guid":{"rendered":"https:\/\/dronesonen.usn.no\/?p=8458"},"modified":"2023-11-13T07:52:32","modified_gmt":"2023-11-13T06:52:32","slug":"hydroplant-subsystems-week-12","status":"publish","type":"post","link":"https:\/\/dronesonen.usn.no\/?p=8458","title":{"rendered":"Hydroplant Subsystems &#8211; Week 12"},"content":{"rendered":"\n<div class=\"wp-block-group alignwide is-vertical is-layout-flex wp-container-core-group-is-layout-fe9cc265 wp-block-group-is-layout-flex\">\n<p>Welcome back! This week has been more testing of the system, fixing small bugs, calibrating different part of the system such as plant mover and plant information node. We have tested several part of the system. We are exited to make videoes and pictures of the whole system next week to show what we have done! <br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Shahin-Ostadahmadi\">Shahin Ostadahmadi<\/h2>\n\n\n\n<p>Along with the team, we did several tests of the whole system over and over.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"Nutrition-controller\">Nutrition controller<\/h4>\n\n\n\n<p>I completed the software side for the nutrition controller and prepared everything for testing. I connected all components, including pipes, valves, nutrition and water pumps, and sensors, and was ready to test. However, we faced an issue with the valves requiring a minimum pressure of 0.2 bar to function, which wasn&#8217;t feasible due to our nutrition box&#8217;s height limitations. After attempting to modify the valves and failing, I ordered new ones that don&#8217;t require a minimum pressure.<\/p>\n\n\n\n<p>We were able to test parts of the system, but encountered another problem: the water input exceeded the outflow. Fortunately, we had a Non-contact Capacitive Liquid Level Sensor. I planned to use an AND-chip connected to the liquid level sensor and to the relay which controls the water pump, so when the water reaches a certain level, the pumps will shut down until the water is below the sensor. Ivan arrived at the perfect time! we tried to integrate the sensor and AND gate into the system. Despite multiple attempts, it didn&#8217;t work initially due to the sensor requiring an analog-to-digital converter (ADC). We used an old Arduino to convert the analog signal to digital, which resolved the issue. After four hours of testing, everything finally worked.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"Library\">Library<\/h4>\n\n\n\n<p>I debugged almost the whole system for three hours to look for the wired behavior in our system when I was testing the nutrition controller. Finally, I found out that there was an issue with the Equipment which is a custom container that can hold Entities (Sensors, Actuators, and Logic controller). The class Equipment has interfaces such as:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>equipment.sensors: returns a list of the sensors in the equipment container<\/li>\n\n\n\n<li>equipment.actuators: returns a list of the actuators in the equipment container<\/li>\n<\/ul>\n\n\n\n<p>It turns out that these interfaces returned the wrong objects! I fixed this issue a long time ago, but we had some git problems a while ago and I lost some of my commits, so this was one of the commits that I lost and did not think about it. Thanks to Ole and Oscar for debugging with me.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"Gui\">Gui<\/h4>\n\n\n\n<p>I refactored some of the implementations and made some changes to the \u201cMqtt test page\u201d. It is simpler to communicate directly with part of the system with JSON formatted messages which makes it easier to test the system faster.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"345\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-54-1024x345.png\" alt=\"\" class=\"wp-image-8459\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-54-1024x345.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-54-300x101.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-54-768x259.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-54-1536x518.png 1536w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-54.png 1920w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I also implemented a new page for fetching and displaying the last image from the plant prediction server. We can now see the picture and the result from the plant prediction module right away.<\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"Snap-on-command\">Snap-on command<\/h4>\n\n\n\n<p>I&#8217;ve updated the software with new classes designed for the prediction and stage determination of plants. The predicted class uses image manipulation by scanning the green pixels of the picture and creating a mask, and it seems to fit our purpose for now. The sequence of scanning the picture and visualizing it looks as the sequence diagram below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"907\" height=\"786\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-55.png\" alt=\"\" class=\"wp-image-8460\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-55.png 907w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-55-300x260.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-55-768x666.png 768w\" sizes=\"auto, (max-width: 907px) 100vw, 907px\" \/><\/figure>\n\n\n\n<p>Snap-on command has also the following API:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The last annotated picture on IP\/picture<\/li>\n\n\n\n<li>Streaming on IP\/video_feed<\/li>\n<\/ul>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"Plant-recognition-by-pixel-manipulation\">Plant recognition by pixel manipulation<\/h4>\n\n\n\n<p>The filtering works fine for now, but in my opinion, we can rely on pixel manipulation in the future because too many uncertain aspects such as some plant light combinations in our system can reflect green pixels to the camera. However, this is a good method for us to automate some of the work of making a good dataset to train a machine learning algorithm such as U-NET, which requires masks for the pictures. Here are some of the testing pictures with different filtering methods provided by OpenCV(I will provide pictures from our system in the final blog):<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"164\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-56-1024x164.png\" alt=\"\" class=\"wp-image-8461\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-56-1024x164.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-56-300x48.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-56-768x123.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-56.png 1229w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"259\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-57-1024x259.png\" alt=\"\" class=\"wp-image-8462\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-57-1024x259.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-57-300x76.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-57-768x194.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-57-1536x388.png 1536w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-57.png 1632w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"249\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-58-1024x249.png\" alt=\"\" class=\"wp-image-8463\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-58-1024x249.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-58-300x73.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-58-768x186.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-58.png 1207w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"374\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-59-1024x374.png\" alt=\"\" class=\"wp-image-8464\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-59-1024x374.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-59-300x109.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-59-768x280.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-59-1536x560.png 1536w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-59.png 1620w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"252\" src=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-60-1024x252.png\" alt=\"\" class=\"wp-image-8465\" srcset=\"https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-60-1024x252.png 1024w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-60-300x74.png 300w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-60-768x189.png 768w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-60-1536x378.png 1536w, https:\/\/dronesonen.usn.no\/wp-content\/uploads\/2023\/11\/image-60.png 1626w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Commits\">Commits<\/h3>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/water-node\/commit\/8ddbd7b50dc70bbc0dc6dc1e719b945327ae980f\">https:\/\/github.com\/hydroplantno\/water-node\/commit\/8ddbd7b50dc70bbc0dc6dc1e719b945327ae980f<\/a>Connect your Github account<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/snap-on-command\/commits\/video_setting\/shahin\">https:\/\/github.com\/hydroplantno\/snap-on-command\/commits\/video_setting\/shahin<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/gui-node\/commit\/000c70ecba644ec317b7642623b9371e0aeb2e98\">https:\/\/github.com\/hydroplantno\/gui-node\/commit\/000c70ecba644ec317b7642623b9371e0aeb2e98<\/a>Connect your Github account<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/library\/commit\/1d7bc1a0087533f8bc519eaef0006752d66d2035\">https:\/\/github.com\/hydroplantno\/library\/commit\/1d7bc1a0087533f8bc519eaef0006752d66d2035<\/a>Connect your Github account<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Oscar-Melby\">Oscar Melby<\/h2>\n\n\n\n<p>Last week I wrote about restructuring master-controller a bit, this week I\u2019ve tackled the autonomy part and fixed some more bugs which were introduced in the restructured version.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Job-scheduling-&amp;-handling\">Job scheduling &amp; handling<\/h3>\n\n\n\n<p>In the previous version I just sent job after job and waited for the receipt to be done or partially done. This was all fine and well, but wanted to have something a bit more clear, as when gathering receipts would just be a long list (up to 100) of receipts which would be looped through and to the delete the sent job.<\/p>\n\n\n\n<p>Now I\u2019ve made a class Job which consists of a list of Steps. Reason for this is we will do things such as stop waterflow for a given stage, and move the plant holder to another stage and then turn on water again. We would of course need to wait in between these \u201csteps\u201d as we need time for the water to empty. Each step therefore has a \u201cwait\u201d-value and deadline. \u201cWait\u201d-value is the time we should wait before doing something else AFTER the step has finished. Deadline is the maximum time a step or job should take. If it is not done within this time, we should just delete it. This is done do prevent the system from halting every other action, and for reliability reasons. We might lose jobs, but this is unimportant since we scan the system and can pick up on the task again later on.<\/p>\n\n\n\n<p>Each job goes through multiple states. First it is Queued then Pending and depending on what happens could either be Done or Killed after that. This keeps track of what is happening and makes job handling a lot easier to read.<\/p>\n\n\n\n<p>There is also a difference between interval jobs (such as turning on and off the lights) and jobs which just gets added along the way (moving plantholders).<\/p>\n\n\n\n<p>Did a lot of testing and debugging of this new implementation. There were not a lack of bugs. Here are couple:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>When starting up there would be a million jobs added, even though I checked for duplicates. After a while these jobs would delete themselves, but would take a long time.<\/li>\n\n\n\n<li>When a node reconnected their actuators and logic controllers would duplicate. This was due to our broker not sending the disconnect message fast enough, so we would not delete the entries just add them again.<\/li>\n\n\n\n<li>When (only) nutrition node disconnected every belonging entity would delete except for one. This was due to my misunderstanding of how Python dealt with for-loops as I didn\u2019t think I would need to do a copy of the list in this scenario. Turns out I was wrong, when deleting in the list while looping it you would skip an index which caused the one entity to not delete.<\/li>\n<\/ul>\n\n\n\n<p>Fixed all of these, but there are most probably more bugs just waiting to be discovered.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Nutrition-node\">Nutrition node<\/h3>\n\n\n\n<p>Also worked with Shahin this week debugging some things and setup support for nutrition node on master-controller\u2019s end.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"Commits.1\">Commits<\/h3>\n\n\n\n<p><em>Only members of the organization can view these commits.<\/em><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/master-controller\/commit\/511d0b027136efe1936b7b0230f9bf281c356aab\">https:\/\/github.com\/hydroplantno\/master-controller\/commit\/511d0b027136efe1936b7b0230f9bf281c356aab<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/master-controller\/commit\/06fbfcbcfd9f7170b317f362dc2f26b2db80ebbf\">https:\/\/github.com\/hydroplantno\/master-controller\/commit\/06fbfcbcfd9f7170b317f362dc2f26b2db80ebbf<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/master-controller\/commit\/07c08d2f89353a79c11d880ea761ab2445f0b5fb\">https:\/\/github.com\/hydroplantno\/master-controller\/commit\/07c08d2f89353a79c11d880ea761ab2445f0b5fb<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/master-controller\/commit\/92be0d4af811254b7139bb1c521fae16c683181b\">https:\/\/github.com\/hydroplantno\/master-controller\/commit\/92be0d4af811254b7139bb1c521fae16c683181b<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/master-controller\/commit\/cd95cac0061e18269d5d4886c74950af0924eb28\">https:\/\/github.com\/hydroplantno\/master-controller\/commit\/cd95cac0061e18269d5d4886c74950af0924eb28<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/master-controller\/commit\/c07426cea20cfb42bec1e3fbb218147772e7502c\">https:\/\/github.com\/hydroplantno\/master-controller\/commit\/c07426cea20cfb42bec1e3fbb218147772e7502c<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Aditi-Deshpande\">Aditi Deshpande<\/h2>\n\n\n\n<p>Last week, I uploaded my UNET code on GitHub with the dataset correction, the utilization functions, the training, and the UNET classes themselves with pytorch. Here is the commit:<\/p>\n\n\n\n<p><a href=\"https:\/\/github.com\/hydroplantno\/ML\/commit\/ba4f0c490fe7e2836026c764f10be9822b75e154\">https:\/\/github.com\/hydroplantno\/ML\/commit\/ba4f0c490fe7e2836026c764f10be9822b75e154<\/a>Connect your Github account<\/p>\n\n\n\n<p>This week, I talked to Shahin and we concluded that we could take a break from machine learning for now as it is a huge subject with a lot to learn, and we don\u2019t have enough time for it. Instead, we could make it easy for us by just counting the total number of green pixels in a picture taken, dividing it by the total amount of pixels, and multiplying by 100 so we get the percentage. Out of that percentage, we decide if the plant is ready to move on to the next stage or should remain where it is. So we programmed this and it worked pretty well. Shahin has talked about this further. We got the picture visualized on the GUI command as well and the picture highlighted the amount of green.<\/p>\n\n\n\n<p>I need to fix the amount of steps the stepper motor is taking between each place as it is a bit off each time. This also connects to the fact the plant information node needs to be calibrated from the plant mover node. I need to find a way to register the amount of steps. I will try to work on this, but I have a busy week next week, we\u2019ll see how much I can get done.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Theo-Magnor\">Theo Magnor<\/h2>\n\n\n\n<p>This week I have done further testing and debugging of the plant-mover, its functions are now more refined, and it can now handle a situation that it previously couldn&#8217;t. I&#8217;m referring to when the plant-mover gets ordered to move a row from its current location to row n.<\/p>\n\n\n\n<p>Sending receipt to master-controller and some more testing still remains in order to call the plant-mover finished. I also want to create a new diagram that captures some of the logic that has not been visualized yet.<\/p>\n\n\n\n<p>This week&#8217;s commit:<br><a href=\"https:\/\/github.com\/hydroplantno\/plant-mover-node\/commit\/f81a55e7a291320921c56649db06eb140e8fd51e\">https:\/\/github.com\/hydroplantno\/plant-mover-node\/commit\/f81a55e7a291320921c56649db06eb140e8fd51e<\/a>Connect your Github account<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"Ivan-Bergmann-Maronsson\">Ivan Bergmann Maronsson<\/h2>\n\n\n\n<p>This week I disassembled the water-node board, so that all of its components could be sett up into their new node. this includes all the sensors, relays, pumps, and wiring. Only the nutrition pumps have been sett up, while the other electrical components are sett aside while we wait for the water node PCB to arrive.<\/p>\n\n\n\n<p>Speaking about the PCB, me and Shahin have ordered my PCB design for water node, and all of its components. The components should arrive in the coming week, where I am able to solder the board and implement the PCB I have designed into the system.<\/p>\n\n\n\n<p>I also explained to Aditi and Theo how to use the PISO switch register, so that they were able to test their code witch the switches already on the plant mover.<\/p>\n\n\n\n<p>I also helped Shahin test Non-contact Capacitive Liquid Level Sensor, where in the end a solution was found so that we could test the system using that specific sensor. We also wired up all of the water valves, to a external 12V source linked through a couple of relays, and Arduinos, We used 2 Arduinos for testing purposes, but the plan is still to use only 1 Arduino for the water node.<\/p>\n\n\n\n<p>The plan for the up coming week is to sett up all the components on the new node. Solder a PCB and fixing the wiring chaos I created when I disassembled the \u201coriginal\u201d water-node. And most likely more testing.<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Welcome back! This week has been more testing of the system, fixing small bugs, calibrating different part of the system such as plant mover and plant information node. We have tested several part of the system. We are exited to make videoes and pictures of the whole system next week to show what we have [&hellip;]<\/p>\n","protected":false},"author":99,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[99],"class_list":["post-8458","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-hydroplant"],"_links":{"self":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/8458","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\/99"}],"replies":[{"embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=8458"}],"version-history":[{"count":2,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/8458\/revisions"}],"predecessor-version":[{"id":8467,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=\/wp\/v2\/posts\/8458\/revisions\/8467"}],"wp:attachment":[{"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=8458"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=8458"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dronesonen.usn.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=8458"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}