State machine actions & transitions

68 views
Skip to first unread message

Cliff Pennalligen

unread,
Mar 23, 2021, 1:09:40 AM3/23/21
to Blockly
Hi there!

I'm working on software to control industrial machines using state engines.
state engine.png

I was hoping to use Blockly for state actions and transitions between states.

Blockly application #1: At any one time a machine has a specific state (e.g. filling bottle, punch hole in metal sheet, empty sugar out of hopper, etc).  In this state the machine has various actions (e.g. turn on valve, run motor, etc). E.g:
actions.png
Blockly application #2: To move between states, there are transition conditions, which are just boolean expressions.  The general format for each part of it is [variable] [operator] [variable2 - optional]
boolean expression.png

Now I am guessing that Blockly can do these things fine.  But ideally what I'd like to do (if possible), is have an interface similar following drop down lists for selecting objects and operators / actions.

For state actions:
create action #1.png
create action #2.png
create action #3.png
... and then the gear symbol opens up a dialogue where additional settings can be specified (not sure if that can be supported....)

For transition conditions:
create transition #1.png

create transition #2.png
create transition #3.png

create transition #4.png

Can you experienced fellows comment on the suitability or capability of Blockly to achieve these things?

Beka Westberg

unread,
Mar 23, 2021, 1:45:45 PM3/23/21
to blo...@googlegroups.com
Hello,

> I'm working on software to control industrial machines using state engines.

That sounds like a fun project :D

It's difficult to say whether Blockly will allow you to create exactly the user experience you're looking for. It seems like you want to add a lot of dynamic-ness to your blocks, which is possible with mutators and extensions, but it definitely takes work to do right.

I think what I would do if I were you is just check out some of the dynamic blocks people have built with blockly, and see if the features they've implemented suit your needs. For example, you could check out:
This will give you a better idea of what's possible and what's not. For example, having blocks with dynamic numbers of inputs/fields is pretty common and easy to do. Something like inter-dependent dropdowns (eg a pair of dropdowns whose values depend on each other) is harder, but still possible.

Sorry I can't give a really great answer to this one haha. Other people may have different opinions. It's just tricky to know what's possible and what's not until you try it.

Best of luck on your project! It definitely sounds like a fun one :D
--Beka

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/09963775-0561-4051-ae64-bc8b2800e5e6n%40googlegroups.com.

Koen Van Wijk

unread,
May 4, 2021, 9:59:29 AM5/4/21
to Blockly
Did you continue to explore this application?

Cliff Pennalligen

unread,
May 4, 2021, 2:56:09 PM5/4/21
to blo...@googlegroups.com
Yes but not with blockly at this stage. It's a winforms app and I didn't see any improvement on development time or reliability using Blockly vs creating my own controls.

--
You received this message because you are subscribed to a topic in the Google Groups "Blockly" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/blockly/lD10l7rzDks/unsubscribe.
To unsubscribe from this group and all its topics, send an email to blockly+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/blockly/5aa398ec-ab4d-4378-bc62-0344cd3fa868n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages