Scratch for sequences

Hi,

I am enjoying farmbot so far and getting in the details of programming relevant sequences. While I think the programming interface is working okay so far, I quickly missed functionality to make sequences more flexible and readable. Although developing your own programming language might be an option, I thought that the project might benefit more if we interface with existing programming languages like scratch. This way we would benefit from their resources for our project. What do you think?

2 Likes

There is a JS interface to the web API therefore a Blockly interface should be achievable.

1 Like

@jensGeorgsen The main reason we didn’t use Scratch/Blockly (and we did consider it when I started building the sequence editor years ago) was that the sequence editor is a core part of the application and we need full control over every aspect of it. We did not want to make compromises on this particular part of the application. I have seen some apps that do have Blockly-based plugin systems, but typically, the plugin system is not the core of the application. In the case of the sequence editor it’s a huge feature, if not the biggest feature.

From a risk perspective, this could be a problem for us long term. For example, what happens if the Blockly project makes a long term decision that is in line with their needs, but not the needs of FarmBot? For a feature as important as the sequence editor, we felt it was better to “re-invent the wheel” instead of purchasing a wheel that could change without notice and leave us stranded. We’ve seen this happen to us in the past with other third tools we’ve used, such as early versions of the app that were built with AngularJS v1.

With that being said, what do you like about Blockly and Scratch that you would like to see in the sequence editor?

And to continue what @aronrubin said, we would absolutely love to see a third party tool that users Blockly to control FarmBotJS.

1 Like

Hej @RickCarlino, thanks forr your explanations. I see the dilemma.

Concerning your core question, what I would like to see in the sequence editor are programming functionalities as for example functions that accept several variables, variables that are independent from locations, handling and passing on of lists, comparisons, execution of code without the machine connected (fx changing state of plants), just some of the features that I was looking for in the last days. I found workarounds for some of the issues, but I still felt limited when for example trying to write sequences that can pick up seeds from a container that can be defined by the caller to a variable plant location. File export and import are also features that would be helpful.

Would it be a possibility to integrate third party solutions while keeping the sequence editor as a backup? I would imagine that defining an interface to a third party would require a well defined amount of resources while it would provide great benefits. This would also allow the farm bot community to focus on automatic farming more than reinventing wheels, to stay within your metaphor.

Thank you also @aronrubin for the hint. That’s definitely worth looking into. We will see if I am the right one to find out how this can be done :wink:

1 Like

@jensGeorgsen Those are all features that are on the roadmap, actually. The import / export will take the form of a more “social” sequence editor that allows for sharing. Lists are currently implemented as “groups”. Non-location variables are also planned, but as I mentioned in a different thread, it’s not our main priority yet.

Do you have a preferred programming language? If so, it might be possible to do a lot of the things you mention via scripting. I’m happy to answer questions if you have any. A good first stop is the developer documentation. If something in those docs does not make sense, please let me know and I can provide further clarification.

I’ve also written some examples in Javascript and Python. Please let me know if that helps.

1 Like

Hej @RickCarlino,

I have done programming in different languages but I suppose that python should be fine for this purpose. Reading the documentation, I get the impression that quite some setup of an environment is needed before I can start coding, also requiring an additional computer that will talk to the message broker of the webserver. Is this correctly understood?

@jensGeorgsen

This is correct. Allowing arbitrary code to run on the RPi is possible (via Farmware) but it is highly discouraged. FBOS was not intended to be a development environment and has a number of limitations, such as not having a package manager and only supporting one version of Python. Additionally, the Python version and libraries installed have historically needed to change to meet the internal needs of FBOS, which has shown to cause upgrade issues for third party Farmwares.

A simple setup can run on just about any internet connected machine (such as a laptop or a Raspberry Pi). It could even run only occasionally via the use of cron jobs.

1 Like

Hej @RickCarlino, I had a look at the doc and setting up a 3rd party server to do programming for the farmbot seems to require significant research and setup for me before I can get started. Apart from that, I think that the interface has already come far and that we might benefit from it. I think, I will try working with the webGUI for the moment. What would be the best way to give feedback for functionalities that would be useful for farmbot coding?

@jensGeorgsen I check the forum nearly every day. Feel free to create a new post in the software section. I usually respond to most software-related inquiries in 48 hours.

With regard to your comment about setup difficulty, this is something we have considered improving. We are considering adding an integrated text editor to the web app for more serious coding. It won’t allow for things like adding new packages (and probably never will) but it could be a nice middle ground between the simplicity of the Web UI and the advanced use case of self-hosting an application. There seem to be many users that want something more configurable than the sequence editor, but less configurable than a full-blown independent application.

The forum is always a good place to discuss your ideas and proposals.