What do I need?
EtherLab runs on almost any hardware.However, depending on the application, there may be requirements that are not covered by this example. For more information, see Selecting the right Hardware on GitLab.
To run the (real-time) control, you need a computer with Linux operating system. We recommend a Linux distribution for which there are ready-made packages in our Open Build Service Project These are Debian, Fedora, openSUSE, Raspbian or Ubuntu. In this example we use openSUSE Leap 15.4.
We recommend a Linux kernel for the control computer with „Full RT Preemption“ enabled. Most Linux distributions offer such a realtime kernel out of the box - mostly it is called "kernel-rt". The EtherLab runtime environment and also the EtherCAT-Master also run with a standard kernel without realtime function, but if you later need higher sample rates or synchronization features like "distributed clocks", the realtime kernel will provide the right timing.
If you want to use our EtherLab toolkit for Simulink® to generate the real-time code for your controller, you should first install MATLAB Simulink according to the instructions. For this example this is not necessary. It is also possible to program the control part in C++. A directly executable example can be found below.
If you haven't used Linux before and don't know how to use a terminal yet, we recommend that you watch one of the many online tutorials.
The easiest way to install EtherLab is to use the EtherLab repository from the OpenSUSE Build Service. To do this, we open a terminal and enter the following command to add the repository:
sudo zypper ar https://download.opensuse.org/repositories/science:/EtherLab/15.4 etherlab
You will now be asked if you trust the key of the repository.
Once the repository is added, you can easily list all the packages that the repository provides with the following command:
zypper se -r etherlab
Now would be the time to create a real-time application in C++, or the EtherLab toolkit for MATLAB SIMULINK®. But for this example we will use the pdserv-example from the repository. To visualize the process data, we will also install the testmanager with the following command:
sudo zypper in pdserv-example testmanager-ng
Launching the real-time application
Now we can start the Pdserv example with the following command:
The example program will complain about some things it is not allowed to do if it is not started as user root, but that should not bother us here. The PdServ example now provides cyclic data in the network, which can be displayed in the following with the Testmanager. Best we let it run in this terminal and open a new terminal for the next step.
Starting the Testmanager with a sample layout
The Testmanager we installed above comes with a sample layout that matches the data in the PdServ sample. We can start it with the following command. The option -c makes the Testmanager connect directly to the data source.
testmanager-ng -c /usr/share/testmanager-ng/example.tml
The window that opens should look something like this:
On the left is the data source with the variables and on the right a page with controls that are already connected to the variables. You can now switch to edit mode with E and play with the layout as you like. For example, add new pages with new controls (right click on the page) and connect them to the variables from the tree on the left by dragging them to the controls with the mouse. Have fun!