Skip to Content
Technical Articles
Author's profile photo Jochen Rundholz

Demo connector for Fischertechnik – Part 2

Introduction

In this second blog post we are going to introduce the demo connector for Fischertechnik to connect SAP systems to a Fischertechnik model powered by a Fischertechnik TXT controller. The work is based on the “TXT C-Programming Expert Kit” provided by Fischertechnik. In most parts the demo connector for Fischertechnik is very generic and can be used for any kind of Fischertechnik model running on a TXT controller. In a later blog post we will explain some specific features we have developed for the Fischertechnik factory simulation.

The demo connector for Fischertechnik can be downloaded from the SAP store here (filter for fischertechnik).

Architecture

The architecture is quite simple and is explained in the following diagram:

The connector shown in the diagram above is the software we are going to provide via SCN to enable you to build your own IoT scenarios with SAP. The Fischertechnik TXT allows communications via a TCP/IP socket stream. The protocol for that communication is laid out in the Fischertechnik document mentioned in the introduction of this blog post and is not in the focus here. The connector itself is a tool written in Java and needs the Java 8 runtime to work. It connects to a message gateway using web sockets. For the message gateway you have multiple options, the preferred way however is to use the SAP Message Gateway. Once the connection to the message gateway is established, the SAP system can send commands to or request data from the Fischertechnik model. The communication from SAP with the connector is based on the JSON standard. Details on the JSON format we are using in this setup will follow later.

 

Initial Configuration

The connector requires some initial configuration. The configuration file is a simple text file called ftconnector.properties, which you need to have on your computer. The location where to place this file depends on your operating system.

Windows:

C:\Users\<Username>\AppData\Local\FischertechnikConfig\ftconnector.properties

Mac:

/Users/<Username>/Library/Application Support/FischertechnikConfig/ftconnector.properties

Linux:

/home/<Username>/.local/share/FischertechnikConfig/ftconnector.properties

The following parameters are the bare minimum you need to enter:

url = <IP address of your TXT controller>
ws = wss://<endpoint of your message gateway>
token = <a_unique_string_without_spaces>

The url parameter has to be the IP address of your TXT controller. The connection can either established via Wifi, USB or Bluetooth. Make sure that depending on your platform and chosen way to connect that you might need to install the Fischertechnik driver. On Windows, the easiest way to check if you can connect is to run Fischertechnik’s RoboPro software and verify that the connect function in there is working. To rule out stability issues we recommend the connection via USB whenever possible.

The ws parameter is the endpoint of your message gateway. Please note that you have to include the protocol into the parameter. So please start it with “wss://”. Without that endpoint you cannot continue.

The token parameter is a string specific to your model to avoid interference with other Fischertechnik models running on the same message gateway. Choose a unique string without spaces.

A word of caution: This piece of software is demo and educational software. For the ease of use we knowingly didn’t implement any security measures. You mustn’t use it with productive systems. Everyone connected to your endpoint is able to send commands to your model. The token is not a security feature. If you use our connector, then please don’t complain that some evil hacker has remotely controlled your robot, drove it onto a road until it was run over by some truck.

Now it is time to start the connector the first time. Simply run

java -jar ftconnector-<version>.jar

from a command prompt. After a few seconds you should be able to see two important messages. The first message is “Successfully connected to ROBOPRO server!” If you don’t get this message, then the connection from your laptop to the TXT controller didn’t work. Check the IP address again, check for firewalls, etc. The second message is “Connected to ws server.” If you don’t get this message, then there is an issue with your message gateway. In that case your best bet is probably to use some developer tool like ARC (Advanced Rest Client, a Chrome add-on) to check whether you can reach it using the URL you have specified in the config tool.

The output should be similar to the following console log (right click on the picture -> open in new tab to enlarge it)

Congratulations! Your setup seems to work. Now read on in the second part on how to send commands to your model.

 

Read on in part 3 of our blog post series.

Assigned Tags

      8 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Frederick-Claud Dimmer
      Frederick-Claud Dimmer

      Hi Jochen, THX for sharing you knowledge on this topic. We tried to get our factory running ourself but it's been a hassle to receive data from the factory via the I²C protocol using a Raspberry Pi. For the sake of simplicity we'd like to move to your solution. Nevertheless I was wondering weather you've tried to use a rather lightweight gateway solution in comparison to the SAP Message Gateway because we'd simply like to push data to SAP CP IoT Service?

      Regards

      FCD

      Author's profile photo Jochen Rundholz
      Jochen Rundholz
      Blog Post Author

      Hello,

      thanks for the interest in this topic. The SAP Message Gateway is for us the best solution for various reasons. What you could do as well is to create a web socket end point on HCP and use this as message gateway. That should be pretty straight forward. If you want to send data to IoT Services then you could re-use the MII URL. You just need a little server listening to that URL and make an IoT Service request out of it.

      Regards Jochen

       

      Author's profile photo Torsten Stuehn
      Torsten Stuehn

      Hello,

      in your post you write that this work is based on the “TXT C-Programming Expert Kit”.

      I just want to mention here, that there also exists an easy to use Python based interface [1,2] to access the complete set of I/O connectors of the TXT. The interactive command line interface of Python is very suitable for quick testing of functionalities and may speed up rapid prototyping of applications and demos. It can be used with Window, MacOS and Linux (e.g. Raspberry Pi) operating systems and also supports the I2C interface of the TXT.

      Regards, Torsten Stuehn

      [1] https://github.com/ftrobopy/ftrobopy, (manual.pdf in german)

      [2] http://www.ftcommunity.de/ftpedia_ausgaben/ftpedia-2017-2.pdf, page 58 (german)

       

       

      Author's profile photo Jochen Rundholz
      Jochen Rundholz
      Blog Post Author

      Hello Torsten,

      thanks for links, nice work. Might be useful for one or the other person within our community.

      Regards, Jochen

      Author's profile photo Michele Carolina Bassani
      Michele Carolina Bassani

      Hello!

      I tried to download the demo connector for Fischertechnik from SAP Store and the link is not working https://www.sap.com/developer/trials-downloads/additional-downloads.html

      Please could kindly send to me the new link?

       

      Thanks,

      Michele.

      Author's profile photo Jochen Rundholz
      Jochen Rundholz
      Blog Post Author

      Please enter the filter "fischertechnik" on the download page, then you can find it. I have added this to the blog post.

      Author's profile photo Ruben Louwagie
      Ruben Louwagie

      Good morning Mr Rundholdz,

       

      I'm a student from the Hochschule Luzern, currently doing my Bachelor Thesis about Fischertechnik's Learning Factory, exactly the one that you have in your video. Could I make you some questions about what you exactly did?

      What you did might be very helpful and could be a great step forward in my project.

      Thank you very much,

      Kind regards,

      Ruben Louwagie

      Author's profile photo MALENFANT Clovis
      MALENFANT Clovis

      Hi M. Rundholdz,

      We are working on the factory but it is impossible to find the FTP connector.

      We asked SAP developper team but without success.

      Is it possible to send it to me by mail?

      Thanks and regards

      Clovis Malenfant