FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We will start the migration process in one hour.
The community will be then in READ ONLY mode.
Read more: Important
information on the platform change.
02-17-2022 02:44 PM - edited 02-17-2022 02:45 PM
I have a similiar problem like the problem described in this topic https://developer.community.boschrexroth.com/t5/SDK/Register-multiple-flatbuffer-types-in-Data-Layer...
I'd like to register a new flatbuffer type. My file mySchema.fbs is essentially the same as sampleSchema.fbs from the datalayer.register.node example. I only changed the members x,y,z to a,b,c the namespace from sample.schema to Mein.FBS and the table name from inertialValue to MyValue.
I try to register the type as "types/mySchema/MyValue". When I start my app, registerType fails with DL_INVALID_ADDRESS.
I'm at a loss what I'm doing wrong or what I'm doing so different compared to the example and to the above mentioned topic.
What in general causes the error DL_INVALID_ADDRESS ?
Solved! Go to Solution.
02-18-2022 08:23 AM
Hello,
I tried to, but could not reproduce your problem. It works fine for me.
Can you see mySchema.bfbs inside of your snap, when you unpack it?
Could you share some of your code? That may be helpful to find a solution.
Here is the registerType method in my try:
auto bfbsPath = getenv("SNAP") != nullptr ? strcat(getenv("SNAP"), "/mySchema.bfbs") : "bfbs/mySchema.bfbs";
result = myProvider->registerType("types/mySchema/myValue", bfbsPath);
Best regards,
Nick
02-18-2022 09:08 AM
Please have a look to this topics for more information:
02-18-2022 10:03 AM
Hello and thanks for your answer.
It seems you already have isolated the problem - the mySchema.bfbs is not in my snap!
Since I'm still learning how all the datalayer stuff works and did a whole lot of experimenting, my code (a modified version of the sdk-cpp-client example) is quite messy.
Therefore I'm not sure what to share, at the moment. But since the mySchema.bfbs is missing, maybe you could tell me what steps are necessary to get it into the snap. I must have missed one of those.
Best regards,
Michael
02-18-2022 10:28 AM - edited 02-18-2022 10:31 AM
First you have to generate the .bfbs file out of the .fbs file.
This is done by the flatc compiler. The settings can be found in the CMakeLists.txt and should look like this:
#
# Flatbuffers
#
set (FLATBUFFERS_FLATC_EXECUTABLE ${USER_DEPENDENCY_DIR}/bin/oss.flatbuffers/ubuntu20-gcc-x64/release/flatc)
set (FLATBUFFERS_INCLUDE_DIR ${USER_DEPENDENCY_DIR}/include/oss.flatbuffers/oss.flatbuffers)
include (${USER_DEPENDENCY_DIR}/cmake/oss.flatbuffers/FindFlatBuffers.cmake)
set( FLATBUFFERS_FLATC_SCHEMA_EXTRA_ARGS "--gen-object-api")
build_flatbuffers("mySchema.fbs" "" "registernodeflatbuffers" "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}" "${CMAKE_CURRENT_LIST_DIR}/bfbs" "")
...
#
# Define Executables to add from project files and their depending source files
#
add_executable( ${TARGET_PROJECT_NAME}
${SOURCE_FILES_REGISTERNODE}
)
add_dependencies(${TARGET_PROJECT_NAME} registernodeflatbuffers)
You can find the .bfbs file after compiling in the folder /bfbs of your sample.
Then you have to pack the file into your snap, this is done in the snapcraft.yaml.
parts:
...
flatbuffers:
plugin: dump
source: ./bfbs
...
Let me know if this solves your problem.
For further information:
02-21-2022 08:19 AM
Yes, now it works.
The part of code in the snapcraft.yaml to pack it into the snap was missing.
Thank you!