Farmware MoveAbsolute and ExecuteSequence not working

Tried with 9.0.2 and 8.2.4 I am getting a small number usually 3 log writes and then all subsequent log writes are blocked.

@whitecaps , any danger you could post a simple reproducer that I could play with ? Thanks !

Are they working for you? If so Iā€™ll give it another go when Iā€™m back home it may have been some kind of server issue last night.

I donā€™t use these from Farmware, but theyā€™re certainly working in v9.0.2 using CeleryScript RPC over MQTT.

Thisā€™s why I would like to see your simple reproducer in Python3.

@whitecaps Weā€™ve been able to perform movements on multiple devices via 9.0.2. I tried moving my bot and executing a sub-sequence just now and it appears to be working OK (via my.farm.bot). Are you self-hosting your device?

Please let me know if you have any other information available and I can look into the matter further.

Thanks @RickCarlino and @jsimmonds I will try again when I am back home on Thursday.

If I still have issue and Iā€™m stuck, I will create and post a test python farmware script.

1 Like

Hi @RickCarlino & @jsimmonds,

I am not self hosting yet. Iā€™m not using the CeleryScript (probably a hang over from how I started out). I expect I am getting something very basic wrong in calling Farmware-tools because the Farmware code is quite old.

Below is some test code just a modified Hello Farmware, this used to work in FBOS 7 and I think I saw it working on 8 but maybe something has changed.

from farmware_tools import app
from farmware_tools import device
from farmware_tools import env
from farmware_tools import get_config_value

try:
device.move_absolute(
{
ā€˜kindā€™: ā€˜coordinateā€™,
ā€˜argsā€™: {ā€˜xā€™: 100, ā€˜yā€™: 100, ā€˜zā€™: 0}
},
100,
{
ā€˜kindā€™: ā€˜coordinateā€™,
ā€˜argsā€™: {ā€˜xā€™: 0, ā€˜yā€™: 0, ā€˜zā€™: 0}
}
)
INPUT_VALUE = get_config_value(farmware_name=ā€˜Hello Farmware Inputā€™, config_name=ā€˜inputā€™, value_type=str)
device.log(message=ā€˜Hello Farmware! Input was: {}ā€™.format(INPUT_VALUE), message_type=ā€˜successā€™)
except Exception as error:
device.log(repr(error))

When I run this I get no movement but get the message output so it is calling Farmware-tools. No error is logged. I have also noticed the Farmware page doesnā€™t update when you remove the Farmware and there is still a FarmwareToolsVersion field showing which is no longer part of the manifest contract these are obviously low priority errors.

Thank you for any help!

@whitecaps, a caveat up-front : of all the languages out there, Python and I just donā€™t get along.

Do you know that only Python 3 is supported for Farmware coding . . I think that applies from v8 up, but @RickCarlino is the authority.

Your code as posted wouldnā€™t execute. I had to change it to this to make it work :slight_smile:

from farmware_tools import app
from farmware_tools import device
from farmware_tools import env
from farmware_tools import get_config_value

try:
    device.move_absolute(
        device.assemble_coordinate(100, 100, 0),
        100,
        device.assemble_coordinate(0, 0, 0))

    INPUT_VALUE = get_config_value(farmware_name="wc-farmware", config_name="input", value_type=str)
    device.log(message="Hello Farmware! Input was: {}".format(INPUT_VALUE), message_type="success")

except Exception as error:
    device.log(repr(error))
1 Like

@jsimmonds thank you! I will give that a go. I didnā€™t need to call assemble_coordinate in the past. I saw that method in the latest farmware-tools and I should have given it more thought, was very tired today :crazy_face:. Iā€™m not great at python as well lol.

Unfortunately there is something else going on as your code isnā€™t working. The Farmware page is not updating if I remove, update or delete all Farmware data, so I think thereā€™s a bigger issue here. I think I will have to debug it (https://developer.farm.bot/docs/common-farmware-problems). Itā€™s just starnge it worked before and not now. I may also have to do a factory reset just in case my user data has somehow been corrupted.

Ran into the same issue yesterday. This looks like a WebApp/OS based issue. When a farmware is deleted by pressing the ā€˜deleteā€™ button, its still shown in the farmwares list but when clicking any farmware button like run, update or delete, a toast message pops up saying that the farmware is not installed.
CC: @RickCarlino - Any idea on that?

Hi @jsimmonds @Ascend @whitecaps,

I will take a look at this matter today. Thank you so much for all the detailed code samples.

2 Likes

Hi @whitecaps @Ascend @RickCarlino !

I also saw the same poor behaviour on the Farmware page when trying to remove 3rd party Farmwares but forgot to mention that.

@whitecaps, you should be able to change the manifest.json item ā€œpackage_versionā€ to a value that youā€™ve not used before, zip it all up, and then press UPDATE to install the package with your latest changes, provided that your Farmware server URL hasnā€™t changed.
Otherwise, just try changing the Farmware name and then INSTALL-ing as a new package.
( I had to use both methods )

Iā€™m not sure that your original Python code is ā€œwrongā€ or just not Python3-compatible . . Iā€™m just not familiar enough ( or bothered enough to make the effort to learn right now ) :neutral_face:
I definitely have that code sample that I posted working ( move and INPUT ) on FBOS v9.0.2

Thatā€™s what I am doing :wink:. I can definitely upload the code but some functions arenā€™t working for some reason. I need to look further into it.

Iā€™m not sure if my move_absolute statement was wrong either. I have just changed back from mac to pc after a few years and need to sort out a better python IDE than sublime :joy:.

@jsimmonds I really appreciate your help!!!

1 Like

Youā€™ve given me courage to analyze why your initial code post wonā€™t execute.

This means me learning a lot more about Python. Apparently, indentation and case are meaningful in Python so I should feel ā€œat homeā€ . . ( e.g. Ruby and CoffeeScript . . my fave )

Thanks :slight_smile:

P.s. That Mac back to PC transition ā€¦ hmmm, I can relate to that. When Apple ā„¢ stopped supporting my beautiful MacBook Pro ( Intel Core2 Duo ) after Lion because ā€œmy hardware was too oldā€ I spat out that Apple core and bit the PC bullet. Itā€™s an ongoing disappointment.

1 Like

@whitecaps , the quick way to see Python failures in Farmwares is to connect to your FarmBotā€™s Raspberry Piā€™s serial console using a TTL-232-RPi ( FTDI ) cable ( or similar ).

1 Like

@whitecaps
I just took a look at your code and found a few small mistakes. The main reason that your farmware didntā€™t work, was probably that your ā€œargsā€ in the manifest.json was pointing to a false python file. I linked the comparison to my fork right here. I guess with that mistake you always ran the original ā€œHello Farmware Inputā€ script that was still saved and didnā€™t contain your changes.

Iā€™ve also tried different versions of device.move_absolute since I wasnā€™t sure if the short version also works, and it does.

Yup I copied that over from farmbot labs to create the test code and neglected to change that. Iā€™m back home later today and will give it another push tonight sort out my IDE and debug. Thanks again @Ascend and @jsimmonds. Will let you know how it goes.

Ok the argument path was it. Stupid sleepy mistake like I thought. I can now go and fix up my old python gridit code because I have a working test.

BTW @jsimmonds both ways of calling move_absolute work. I am going to use yours as itā€™s cleaner.

Thanks guys!

Cool, @whitecaps . . good work.

The latest Developer docs suggest that

Farmware should only be used in cases when it would be impractical to
run software remotely, such as operations that require offline support
or extremely low latency.

@RickCarlino , which doc details precisely which ā€œAPIā€ functions are available to an offline bot ?