Sequence sharing / sequence hub


#1

@RickCarlino @roryaronson

Hi,

playing around with the sequence builder, it dawned on me that there will be a lot of reinventions of the wheel.

So I’m thinking to build a little sequence hub, to which you can upload your sequences and from which you can download other people’s sequences.

In the farmbot frontend app, this would require a JSON export/import mechanism.

As I don’t want to reinvent the wheel with this myself, I was wondering: Is anybody working on something similar, or are there plans to set up something like this by the farmbot team?


#2

@creimers It’s on our road map, and a lot of folks are asking about it. We don’t have any solid dates on when we will start work on this, though.

A bit of background on sequences:

JSON for sequences is stored in a representation know internally as “CeleryScript”. It is basically an abtract syntax tree written as JSON.

You can see your sequences as JSON using this snippet in the Chrome Javascript console (log in first):

Object.values(store.getState().resources.index.references).filter(x=>x.kind === "sequences")

The AST must be properly formed or it will be rejected by the bot and/or API. I am planning on doing a write up about how it works soon, but have not yet gotten around to it.

If you are familiar with Typescript, you can see interface definitions for all of the different AST nodes here.

Right now, we have a custom validator for these nodes written in Ruby, but I would really like to switch over to something more reusable like JSON schema so that people could write third party tools and editors for things similar to what you are suggesting.

I’m happy to help with any other questions you may have.


#3

A great place to start with this @creimers is adding import and export buttons on the frontend. The biggest challenge though is that most sequences will be utilizing imported coordinates from tools and soon plants, weeds, parent sequences, groups of plants, etc. So for a sequence to be really usable by someone else it will need to either bring along its dependencies (which sounds like a bad idea), or drop its dependencies and require the user to “re-wire” them which might make the imported sequence useless if it has a lot of dependencies… :thinking:


#4

@RickCarlino Yes, I saw the TS interfaces and also started analysing the redux store. Thanks.

@roryaronson I have a basic export button integrated, but as of now it’s not able to export nested sequences. Why do you think bringing along its dependencies is a bad idea? Too much clutter? Maybe there’s a way to encourage users to compose small, reusable sequences.

On the other hand, sharing complex and nested and very specific sequences can potentially also be useful if you look at it as a source of inspiration more than a no brainer import…


#5

Passing dependencies indeed will be a tough one to tackle. Over the next few weeks, we will be modifying the structure of sequences to have a parameter/argument list (probably in the “args” attr of “sequence” nodes). This will make things more portable, similar to how a traditional programming language might use parameter passing for dependency injection (think: Angular 1 dependency injector, where everything is listed in a parameter list before running) we will eventually add a UI so that the user can import these things before running them.

I will keep you posted on that as it is updated.


#6

Importing dependencies seems useful to someone who is just starting out so, as you mentioned, they do not have to reinvent the wheel. But for someone who has their tools, sequences, plants, etc already established, they probably wouldn’t want to import a bunch of things just to help someone troubleshoot or just to poke around. Because then they will need to go through and delete stuff in multiple places if they decide they don’t want to use it, and they might miss something, or delete the wrong thing. For example: if the imported sequence included a tool that had the same name as an existing tool, it would be unclear which one to delete. Or if a child sequence was named the same as an existing sequence. Maybe during import there could be checkboxes for the user to selectively import dependencies?


#7

+1 for import/export button.

Also, there is u huge overlap for most used sequences and all the common tools/trays.

Some other other software that come to my mind right now, is zabbix and templating:

  • you can define macros with k=>v and use that in template, defined later.
  • defined named regular expressions

This leads me to an idea of abstract (shareable) sequence. Tools are defined elsewhere, and create name/value list with coordinates. Also pins are defined as table with name and value. All this dependencies could use some place-holder, later populated.

Just a rough idea.

The import feature would make it easier to write some simple macro-expanded language. Or even full verification on server side, for dependencies.


#8

So gentlemen, and sequences to share? My sequence is:

  • My pick up seeds sequence I made
  • Move absolute to location of plant
  • Move Z axis down to put needle a few cm under the soil
  • Turn off vacuum
  • Find Home
  • Repeat

My seed injector keeps getting sand stuck in it every half a dozen plants though. Any ideas? I’m interested to see what anyone else does.