Farmware development workflow


#1

I’m just getting started on Farmware development and am wondering if anyone would like to share their workflow for such things.
Usually when programming things one can work locally and have instant feedback on changes but this doesn’t seem possible with coding Farmware as it has to be hosted.
It would also appear that there might be some caching issues as small quick changes do not seem to to be reflected when updating from the Farmware console.
I am also having an issue of installing my Farmware at times with the only feedback being a toast saying that the Farmware installation failed, which doesn’t really help me understand what went wrong or where to look for reasons why.
Any help would be appreciated.


#2

This error usually comes up if your “manifest.json” file contains errors. This file is a bit fragile, the more you are changing, the higher the chance that you accidently delete a character or add something that should not be there. Always double check the spelling of your urls and arguments. Also keep in mind, that if you are using GitHub for hosting, it can sometimes take a few minutes until your manifest file is refreshed in the raw view.


#3

OK, so there is a delay when hosting from Github, that would make sense of behavior I attributed to caching.


#4

I’ve added a page to the Farmware development documentation regarding different hosting options and workflows.

Future software releases will provide more information about why a Farmware failed to install. I’ve also added a few additional tips to the common Farmware problems documentation page.


#5

Awesome, this helps.

I am no stranger to computer programming but I am still struggling with getting started on communicating with the Farmbot via Farmware. Admittedly, Python isn’t a language I am well versed in but I know a bit. I’ve been searching for a complete and simple Farmware sample that I can dissect but haven’t really found one that makes complete sense to me, yet.

Not that I’m asking, but it would be nice if a step by step tutorial existed for writing a Farmware. This would definitely help.


#6

What are you trying to accomplish? Basic device control can be as simple as:

from farmware_tools import device

device.move_relative(x=0, y=100, z=0, speed=100).
device.log('Bot is at position {{ x }}, {{ y }}, {{ z }}.')

which will move the y-axis +100mm and report the new position.

By the way, each of the code samples on the Farmware development page can be run as a Farmware.


#7

At this point I am trying to get a log message to show up as I believe that this will be my only output for debugging.
I have the Farmware installing fine but I am not seeing any logs coming through using the example from the developer docs.


#8

Does the Farmware complete successfully? Have you tried a simpler command like device.log('message')? Does the code execute successfully on your computer?


#9

The only thing in the python script at the moment is the log message and I am not seeing it.

This is the output from running the python file locally:
{'kind': 'e[35msend_messagee[0m', 'args': e[36m{'message': 'Hello Farm.', 'message_type': 'info'}e[0m}


#10

What log messages are you seeing on the logs page?

Also, I’ve created a simple example here: https://github.com/FarmBot-Labs/hello-farmware


#11

It looks like you may have a typo in your manifest args. The part before -master must match your repository name exactly.


#12

OK, so I had the log filters set to ‘Normal’. They are now set at max and I am getting the following when running the Farmware
2 - Error CS Failed: [execute_script] - "Farmware failed" - 0, 0, 0 - Jan 10, 9:32m' 2 - Warn #Farmware<Single Axis(1.0.4)> completed with exit status: 2 - 0, 0, 0 - Jan 10, 9:32am 2 - Busy|Beginning execution of #Farmware<Single Axis(1.0.4)&g;

You bare bones example installed and worked fine.

Got it to work as I was writing this post. Had to do with letter case in my my manifest. (smacks forehead)

Thank you for assisting me on this. I should now be able to make some headway.