ctrlX Data Layer Provider¶
The app demonstrates how a ctrlX Data Layer connection is established and a string and flatbuffers node are provided.
Function Description¶
The app connects to the ctrlX Data Layer and provides a string and flatbuffers node .
If the ctrlX Data Layer connection breaks the app will exit. After 10s it will be automatically restarted by snapd.
Preparation¶
This sample uses a flatbuffers node defined in sampleSchema.fbs.
For easy of use the project contains the according compiled files:
- sampleSchema.fbs: ./bfbs/sampleSchema.bfbs, ./sample/schema/InertialValue.py
With these compilation files the project can instantly debugged or snaps can be build.
If changes have been made to the definition files, the compiles must be regenerated. This is done by the script make-bfbs.sh.
The script can be called from the console:
./make-bfbs.sh
It can also be called from Visual Studio Code:
Main menu -> Terminal --> Run Task... --> Make bfbs
Implementation Description¶
Definition Files¶
Flatbuffers¶
- sampleSchema.fbs: Defines a flatbuffers value (structed value). If changed compile it - see above.
Modules¶
- The module main.py manages the ctrlX Data Layer connection and the creation of the ctrlX Data Layer nodes.
- The module helper/ctrlx_datalayer_helper.py Provides methods to easily establish a ctrlX Data Layer connection.
- The module app/my_provider_node.py contains the class MyProviderNode with the callback function needed by the ctrlX Data Layer.
- The module sample/schema/InertialValue.py is generated by flatc from sampleSchema.fbs. It is used to manage the flatbuffers data struct.
License¶
SPDX-FileCopyrightText: Bosch Rexroth AG SPDX-License-Identifier: MIT