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 ?