etcipnja / MLH

[FARMWARE] Mother's little helper
MIT License
5 stars 6 forks source link

Optimise order of watering plants 2nd #6

Open derletztename opened 6 years ago

derletztename commented 6 years ago

Hello Eugene I am very sorry to kind of reopen this old issue. At least on my farmbot it seems still very inefficient the way the bot drives around the field. I guess it goes through by plant name doing one kind of plant after another? Couldn’t it be changed to start at x axis 0 (home) and then moves in y axis movements to x axis max? I would assume this is a lot faster and energy efficient. This is extremely important for me, as the farmbot is very off grid and powered by solar power (wind energy will follow soon - in germany there is usually more wind than sun). If you are interested we could collaborate on this via any chat program your prefer Best regards Paul

etcipnja commented 6 years ago

Hello,

Thank you for keeping the interest to MLH. Currently I am pulled away to a different project and can not devote much time in supporting FB. On the same note - my FB is stuck (I suspect some sort of power issue) and I am not able to test the changes.

If you are familiar with Python - I can show the places where you may change to stop sorting by plant name. I probably can even add those changes, but I won't be able to test it.

Thank you, Eugene

derletztename commented 6 years ago

Hey Eugene, thx for writing back. Yeah showing me the places might be a good starting point. I have to learn how to use python anyways, why not start this way ;) What's the easiest way for you for us to collaborate?

derletztename commented 6 years ago

MLH is the only thing that makes the farmbot useful at all by the way 😄

derletztename commented 6 years ago

Dear Eugene, Sorry to be so pushy, we finally got the high resolution version with plant names in the file name working, and now I am very interested to make as many pictures as possible, to be able to teach the neuronal network, but because of the low amount of sun light and being off grid and the chinese guys not delivering the second solar panel, we are really low on energy. I am so desperate, I started to build a human powered generator based on a bicyle 😆 Please tell me where in you code I have to look to change the order of plants being visited, this will save us so much energie/power... best Paul

etcipnja commented 6 years ago

Sorry for the delay. I'll push the new version today but won't be able to test it. So your testing would be highly appreciated

etcipnja commented 6 years ago

please check 2.4.18 - I did not test it on my FB because it is down. If I made a mistake - other people will be affected, so your feedback will be really appreciated

  if iw:
            while True:
                distances=[(self.distance(x, self.head), x) for x in plants if x['name'] not in processed]
                if len(distances) == 0: break  # all done
                d,p=min(distances)
                to_process=self.sort_plants([x for x in plants if x['name'] == p['name']])
                self.process_plants(to_process, iw, skip)
                processed.append(p['name'])
        else:
            to_process = self.sort_plants(plants)
            self.process_plants(to_process, iw, skip)

This is the portion that I've changed. As you see that I am not sorting by plant name in case if iWatering mode is not selected. hope it helps, good luck. Thank you, Eugene

derletztename commented 6 years ago

Thx so much Eugene I will test as soon as possible. Sadly I am right now a little stuck between Farmbot Version v6 and v7 because they changed how the database is being used. It's a big change and I just updated my server without knowing it. I am fighting through the database transition as fast as possible and then will give feedback on your improvement. See here for the database/update topic

derletztename commented 6 years ago

Hey Eugene, I am very sorry. We were not able to fix this database issue after updating. I've given up this approach and have a complete new and clean install now. I need to add the plants by hand this way and rebuild the sequences and stuff, but the system got more and more f**ked up trying to fix it. After this painful restauration I finally will be able to test MLH and give you feedback.

derletztename commented 6 years ago

So after doing all this restauration, I finally was able to test the new version of MLH today. And I get an error. I did change the https to http as my personal server still does not use https yet

Error | CS Failed: [execute_script] - "Farmware failed"
Warn | #Farmware<MLH(2.4.18)> completed with exit status: 1
Busy | Beginning execution of #Farmware<MLH(2.4.18)>
derletztename commented 6 years ago

Wait, after going back to my old version, it also failed. Maybe the issue is not your farmware, but the newest version of the webserver...

derletztename commented 6 years ago

As MLH 2.4.18 is working now, I can say the "watering" is more efficient now :) Though I don't understand which algorithm it follows. It's still does not seem to be the most efficient way as it still goes back and forth, but it looks far less random than before :) Thx Eugene