Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

BaSyx / RevPi Integration

< BaSyx
Revision as of 10:05, 5 April 2021 by Webmaster.eclipse.org (Talk | contribs) (Reverted edits by Unnamed Poltroon (talk) to last revision by Melissa.silva.ee.ufcg.edu.br)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

How to handle Pictory

After you have connected your RevPi modules physically, you also need a configuration file. This file needs to include information about used hardware modules, their position and basic configurations linked to those modules. You can create this configuration file using the web application called “Pictory”. The Kunbus website details how you can use Pictory to create your configuration file: https://revolution.kunbus.com/tutorials/was-ist-pictory-2/pictory/


How to set up the Modbus Gateway Component

As demonstrated on the Kunbus website, you can use your RevPi module to be connected as a Modbus TCP Master or as a Modbus TCP Slave. To do this, you need to use the virtual devices directory. However, if there is also a Gateway Component in your hardware system, it is important to notice that it can only work as a Slave. To establish a connection in the system, it is necessary that the IPs of the router, the RevPi module and the Gateway Component are in the same range.

Scheme.png

How can this be achieved?

First of all, the Gateway Component always uses the address schema 192.168.0.X You can determine the “X” by looking at the switches on your Gateway Component.

Switch.png

For example, in this figure above, the Gateway Component has the 192.168.0.20 IP Address (16+4). If for some reason you want to have access to the gateway, your computer’s IP also needs to be in the same 192.168.0.X range. To achieve this, you can manually change your Ipv4 address, and then, type the IP of your Gateway Component on the browser. The user is “Admin” and the password is 1701.

Second, if your RevPi module is not located in the same range, this has to be changed through the router. You can change the IP configuration of your router manually. How to change will vary according to your router device. The configuration used in our case was: https://support.ringlogix.com/index.php?/Knowledgebase/Article/View/231/110/mikrotik---change-lan-subnet In the moment you change the range of your router to 192.168.0.X, your RevPi module will automatically get a new IP in this same range and the connection between the RevPi module and the Gateway Component can be established.


How to read data from a C program

On Kunbus’s website there’s a small tutorial about the first c steps: https://revolution.kunbus.com/first-steps-in-c-c/ So we can have a base on how to improve the code according to what we really need.

  1. include <piControlIf.h>
  2. include <piControl.h>
  3. include <string.h>
  4. include <stdio.h>


int main(int argc, char** argv) {

   uint16_t val = 0;

   // structures containing variable information: Name, Offset, Bit, Length
   SPIVariable sPiVariable = {"Input_Pin_1", 0, 0, 0};
   piControlGetVariableInfo(&sPiVariable);

   // structures containing variable value: Offset, Bit, Value
    SPIValue sPIValue;
    sPIValue.i16uAddress = sPiVariable.i16uAddress;
    sPIValue.i8uBit = sPiVariable.i8uBit;
              
    piControlRead(sPiVariable.i16uAddress, 2, (uint8_t *) & val);
    printf("%u\n", val);

}


BaSyx on the RevolutionPi


1. How to build the Basyx C++ SDK

Please follow the tutorial bellow: https://wiki.eclipse.org/BaSyx_/_Download_/_Cpp_Setup


2. Install the CMake on the RevPi

First, an ssh connection with the RevPi needs to be established. In the next step, download the package lists from the repositories and update them to get information on the newest versions of packages and their dependencies. This is done by the following command:

                                      sudo apt-get update

Next, use the following command to install available upgrades of all packages currently installed on the system:

                                       sudo apt-get upgrade

After this, install CMake by typing:

                                    sudo apt-get install cmake


3. Download or copy the BaSyx SDK onto the RevPi

If your RevPi is connected to the internet, you can follow the installation guide on the Wiki. Alternatively, you can copy the files via scp from another device. For example, on Windows, the WinSCP tool is available.


4. Execute the CMake on the RevPi To see if your CMake is running on the RevPi, use the established ssh connection and now:

                                             cmake .

o Troubleshooting There is a chance of getting a problem with the version of the cmake. In some cases, this is not fixed by an update/upgrade. Fortunately, there is a way to fix it. First , uninstall cmake by typing:

                                    sudo apt-get purge cmake

For convenience, you build some variables on your command line. Type:

                                          version = 3.x 

Let’s say you version is “3.19.2”. Then your x will be 19.

                                           build = y

Considering the example above, your y would be 2. Now create a new directory and change to it by typing:

                                         mkdir  ~/temp
                                           cd  ~/temp

Now, download the cmake version from the internet by typing the following command:

                  wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz

Store and extract your file:

                               tar –xzvf cmake-$version.$build.tar.gz

Change to your new directory:

                                     cd make-$version.$build/

Install the extracted file:

                                         ./bootstrap
                                           make –j4
                                       sudo make install

If cmake is complaining about a missing OpenSSL lib, you can install it by:

                               sudo apt-get install libssl-dev

Finally, to test if your RevPi is now running the latest version of Cmake, just type:

                                         cmake –version

Back to the top