Saturday, August 19, 2017
Home » Flowstone Workshop » Flowstone Workshop 11 Part 2

Flowstone Workshop 11 Part 2

Flowstone-HeaderServo FLOWSTONE WORKSHOP 11 pt2-2 - Copy (2)Erector Set – Part 2

FLOWSTONE WORKSHOP 11 pt2-1 - Copy (2)


Welcome to the FlowStone Workshop number 11, Part 2, where we give a beginners guide to computer programming using the FlowStone graphical programming language inside FlowBotics Studio.

FLOWSTONE WORKSHOP 11 pt2-3 - Copy (2)
User Programming Area.

In the last issue we covered the new Servo Erector Set from RobotShop which contains the parts to build five different robot kits, the FlowBotics Studio software and pre-made projects to control the robots. In this issue we are going to dig a little deeper and enter the world of the FlowStone programming language running underneath the main projects to explore the possibilities of creating custom projects. This can be split into three parts, 1) Using the stock programmability, 2) Tweaking the User Programming Area, and 3) Full custom programming.


FLOWSTONE WORKSHOP 11 pt2-4 - Copy (2)
Servo Erector Set kit.
FLOWSTONE WORKSHOP 11 pt2-6 - Copy (2)
Enter the User Programming Area.

With the latest version of FlowBotics Studio you get some neat pre-programmed features that allow you to take external control of your robot without creating any code. These largely use the spare input pins (ABCD) on the SSC-32 servo controller to control the software state as well as hardware control from the included wireless PS2 controller. In the last issue we introduced the concept of patterns and sequences allowing you to build a library of robotics movement. Now using the ‘Special Operations’ tools you can add a ‘Pause Before Frame’ command on the timeline to control your robot. This will pause the sequencer at a particular frame until you toggle input ‘B’ on the SSC-32 server controller board which will resume playing. Input ‘B’ can also be used to start playing from anywhere in the sequence. Input ‘C’ will stop the sequence, giving you full control of the timeline transport via external hardware pins. This basic functionality enables you to get multiple robots to interact and can be used to add various sensors to control your robots behavior.

Gripper Control. Drop down menus to select operation.


If you want to add more functionality than the basic start/stop/pause then you can create whatever you need in the User Programming Area. This is nothing more than an area within the FlowStone code set aside for users to be creative without the worry of messing up the whole program; after all you get access to the full source code so you can change absolutely everything!

In the User Programming area we have made a set of simple building blocks and Ruby scripts that should allow the more adventurous roboteers to create custom interactivity with the minimum of effort.

What’s really exciting about FlowBotics Studio when you start to delve deeper is the fact that the FlowStone code used to create the project is running underneath the main application all of the time in real-time. This means that there is only one program running not a separate source code that needs compiling. If you press ‘Shift+ESC’ from inside a FlowBotics application it will reveal the FlowStone code underneath, since these projects are quite sophisticated and complex we have made a special module for beginners to create their custom interaction, this can be found at the top left of the project one level down once you are in the FlowStone mode:

Once in the User Programming Area you can see a set of pre-made modules that you can easily re-connect and modify:

For example you can now see how the pre-made pause mode works and how it’s controlled from Input ‘B’ & ‘C’ from the SSC-32 servo controller. These inputs are on drop down menus so you can easily select a different input etc.

You can also see the pre-made modules for the PS2 controller interaction. If we enter one of these modules for example the ‘Gripper Open/Close’ then you can see how the interaction is allocated:

These are wired to the PS2 Controller by default but could be wired up to a different interface very easily. For example if we were to add a Phidgets 8/8/8 interface board we could have 8 digital and 8 analogue inputs with sensors to control our robot:

Adding the FlowStone Phidgets 8/8/8 module we now have control of the base rotate from analogue inputs 0 & 3. If input 0 > 100 rotate clockwise, if input 3 > 50 rotate anti-clockwise. The same with the Gripper Open Close, if digital input 0 = 1 Open Gripper, if digital input 1 = 1 Close Gripper. For those of you that also spotted the ‘After Load’ module on the Phidgets Start input, this merely connect to the Phidgets hardware on start-up by sending a trigger to the Start input of the module when the project loads. FlowBotics Studio supports literally hundreds of different hardware interfaces including the entire Phidgets range, all sorts of motor controllers, sensors, cameras, soundcards, DAQ interfaces, USB, serial, and networking too.

So far we have seen how we can control our robots movement via external inputs and use the SSC-32 ABCD inputs to play/pause and stop our sequencer but what if we want to play specific patterns of movement from external control?

This is where the Ruby code scripts come in, these are inside the modules across the top called things like ‘Play Home’, ‘ Play Pattern1’ etc.

Phidgets 888, used to control robot, and Code.
Play Patterns. Pre-made modules control pattern playback from hardware.

Inside these we have made some Ruby scripts that you can modify to create complex interaction with your patterns of movement:

These look complex at first but once you understand the Ruby code are quite simple. We have basically given you seven script commands: Play, Stop, Reset, Goto Pattern, Loop False, Loop True, and Speed, these can be seen in the ‘Sequencer Commands’ Help bubble. This script works by receiving a Start Trigger from some external hardware, then as can be seen in the Ruby code: stopping the sequencer, setting the playback speed to 2, turning off the loop mode, then setting the play position at the pattern called ‘Home’, and then finally playing that pattern. Once the Pattern called ‘Home’ is finished it outputs a trigger to the ‘Done’ output so that the next pattern can be started etc. You can edit this Ruby code to do whatever you like, it is totally open and very powerful. For example you could add some more ins and outs and make logical decisions to create a fully autonomous robot!

In addition to controlling your robot from external hardware and programming some decisions for pattern playback within the sequencer you can also add any of the 100’s of FlowStone modules to create something even more elaborate. For example you could add a webcam module and some motion or color detection to give your robot vision, or add speech synthesis or audio playback to give it a voice, the possibilities with FlowBotics Studio are truly endless!


For most people the ‘User Programming’ area will be more than enough to enhance your robot to be all it can be, but for some they might consider making a totally new robot using the servo erector set parts. After all this is a kit of over 500 parts and isn’t limited to just the five stock robot configurations!

Pattern Shown in Ruby. Ruby script controls the sequencer.
Hex Arm interface. Hexapod and Am projects added together.

For example you could have a hexapod robot with a robot arm on top of its body or something total new and innovative. For this you would need to make your own program with your design mirrored in the FlowStone code. To cater for every eventuality and make FlowBotics Studio future proof you can create your own projects in FlowStone from scratch from inside FlowBotics Studio. To do this from the FlowBotics Studio main window click the ‘+’ sign to create an empty project. This is exactly what it says, a totally blank sheet for you to create your FlowStone code. You can of course copy and paste between projects too, so you can re-use parts from other projects or in fact entire projects if you like. Here’s an example of the Hexapod and arm projects added together:


So from what we have shown you here today you can see that Flowbotics Studio is far more powerful and open than a fixed robotic application and is ideal for education, learning computer science or just playing with Robotics. For most people using the FlowStone ‘User Programming’ area will be plenty to keep you inspired for the foreseeable future and for those that want to create something entirely new there is the full FlowStone programming language underneath to liberate your inventions. If you would like to try FlowBotics Studio it is available from RobotShop form $39.00 USD


Leave a Reply

Your email address will not be published. Required fields are marked *