frame

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In Register

RTMaps block based on a MATLAB script

I am currently testing RTMaps to determine whether it is suitable for our needs and how difficult the building process is.

My goal is to do a basic Lidar point cloud segmentation, clustering and bounding box detection (input: pointcloud in Matlab, xyz-vector in RTMaps; output: array with Objects).

I am not too familiar with C++ yet, so I tried using the Simulink (/Matlab) rtmaps TLC. So far I have had no success in building an example package that only contains the segmentation for example.

The issues the coder seems to have is with the size of the in/output.

I have tried a similar example directly in simulink, where I would get either a bus propagation error or a problem with the size of the output variables. (I am currently trying to solve the memory allocation issue with the outputs)



The code looks like:


Comments

  • Update: The build was successful with the same example in a Matlab Fcn inside a simple Simulink model.

    However, when trying to register the pck, I receive: Error: Unable to load package ..\MinEx.pck: third party dependencies may be missing (.dll/.so/.dylib files). Das angegebene Modul wurde nicht gefunden.

    It might come from the usage of Matlab Toolbox functions regarding Lidar. I tried an even more simple version, without any pointcloud/pcfitplane and with only XYZ_Out = XYZ_In*10

    That does work and so I assume that using the Lidar Toolbox together with the coder, you need to link the Matlab dependecies. (How do you do that?)

    That kind of narrows down my question I guess.

  • Hello,

    As you guessed it, there is a missing dynamic library (.DLL file in Windows or .SO file in Linux) required by the package. You will need to identify it and then place it in the correct folder.

    • In Windows, in order to know which DLLs are missing, use the Dependency utility. You can also find it here : https://github.com/lucasg/Dependencies
      • Open your package file with this tool and you will find what module is missing.

    Please note that Dependency may issue warnings on "system DLLs". Those are usually false positives. Start with direct (first-level) dependencies of your package and check if one of the problematic DLLs is specific to your component (e.g. a library against which your component has been linked, a driver used by your component. etc.) and focus on these ones first. Please avoid copying/moving Windows system DLLs.

    • In Linux, run the "ldd -r myPackage.pck" command and see if there are shared libraries that are not found.


    Now let's say the missing file is libmwrgb2gray_tbb.dll 

    On Windows :

    1. Find where libmwrgb2gray_tbb.dll is located on your system.
    2. copy libmwrgb2gray_tbb.dll to <Generated .pck Dir>/bin
    3. Restart RTMaps


    On Linux you will need to edit your build files in order to have the dynamic linking system search the lib folder.

    1. If you use Make, add the following to your makefile:
    2. LDFLAGS += -Wl,-rpath=\$$ORIGIN/lib
    3. If you use CMake, the relevant instructions for adding $ORIGIN/lib to the RPATH can be found in the Rpath handling article 


    You could also modify the OS standard paths. That way the libraries will be shared with all other applications that require them

    1. In Windows: C:\System32 or a folder that is in the PATH
    2. In Linux: You can configure LD_LIBRARY_PATH
      1. Either temporarily, for RTMaps:
        1. LD_LIBRARY_PATH="path/to/my/so/library/folder:${LD_LIBRARY_PATH}" rtmaps
      2. Or permanently, system-wide:
        1. echo 'path/to/my/so/library/folder' | sudo tee '/etc/ld.so.conf.d/my-library.conf'
        2. sudo ldconfig


    Let me know if that solves it,

  • edited April 29

    Hi Teo,

    thank You for the hint. It did work for me, a Matlab dll was missing.

    However I can't use this rather simple block as it can't stand real time replay with the block.

    I will have to try a different approach, I think.


    Greetings,

    Markus

Sign In or Register to comment.