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.
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.
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.
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.