Wait command doesn't work (no with clause matching: 4.0e3)

Hallo Farmbot community,

I am using Farmbot OS 10.0.0 on Genesis v1.4. I got errors during watering sequences.

I wrote a python script to execute commands in this order:

  • take the watering nozzle tool

  • run to a plant position

  • enable the water pump, then the water valve

  • wait for 4000 milliseconds, then disable the water valve, finally the water pump

  • return the watering nozzle tool

I got an error directly after enabling the water valve, then the water pump was disabled. The water valve was disabled after 1 min. Maybe the wait command doesn’t work.

1.PNG

Has anyone been through this before? Any comment would be greatly appreciated!

Thanks in advance.

Cheers,
Kitio

Welcome, looks like a neat script project! Have you tried using an integer instead of a float for the wait time value? Does the wait command work as expected on your device when used in a sequence written by the web app sequence editor?

1 Like

Good comment :slight_smile:

Do the API docs indicate a required type ?

The SysCalls Test script for wait suggests integer :

  test "wait()" do
    now = :os.system_time(:millisecond)
    SysCalls.wait(100)
    later = :os.system_time(:millisecond)
    assert later >= now + 100
  end

Thanks for your comment. I tried with an integer. But nothing changes. It works, when I write by the web app sequence editor

@kkana Can we see the code you are using to execute the wait command?

I call this function to enable the water valve and disable it after a given time

When you send the value as an integer, does your log read Enable peripheral water valve for 4000 milliseconds instead of Enable peripheral water valve for 4000.0 milliseconds? Have you tried something like wait(int(time_milliseconds))?

Comparing the command generated from your script (print(cmd) or otherwise viewing the assembled RPC command) to the command generated from the sequence editor may help spot any differences.

thanks for the idea. I will try it