How can i use ' libisloaded() ' function and ' addpath' function in SIMULINK?

1 visualización (últimos 30 días)
준기 홍
준기 홍 el 26 de Feb. de 2021
Respondida: Aghamarsh Varanasi el 11 de Mzo. de 2021
Hi, I have a project using RPLIDAR A1M8, Dynamixel MX-64 and two motors with encoder to make 3D scan with 2D lidar.
Connectting and using each thing was not that problem. and I made it act step by step (scan -> turn lidar -> move -> scan ....).
I tried it to act parallel but I can't load library in parpool. It showed error.
So I'm trying to make it in Simulink. (I think it will be more convenient because motor PID file is simulink file.)
But it showed error too.
when I use
hardwarex_init;
this mfile is
%hardwarex_init
if not(libisloaded('hardwarex'))
addpath('.');
switch (computer)
case 'PCWIN64'
addpath('x64');
%loadlibrary('hardwarex', @hardwarex_proto);
[notfound,warnings]=loadlibrary('hardwarex', @hardwarex_proto);
case 'PCWIN'
addpath('x86');
%loadlibrary('hardwarex');
[notfound,warnings]=loadlibrary('hardwarex', @hardwarex_proto);
otherwise
%loadlibrary('hardwarex');
[notfound,warnings]=loadlibrary('hardwarex', 'hardwarex.h', 'includepath', 'MAVLinkSDK', 'includepath', '/usr/local/include', 'includepath', 'sbgECom/src', 'includepath', 'sbgECom/common', 'includepath', '/usr/local/include/sbgECom/src', 'includepath', '/usr/local/include/sbgECom/common', 'includepath', 'rplidar_sdk/sdk/sdk/include', 'includepath', 'rplidar_sdk/sdk/sdk/src', 'includepath', '/usr/local/include/rplidar_sdk/sdk/sdk/include', 'includepath', '/usr/local/include/rplidar_sdk/sdk/sdk/src');
end
%libfunctions hardwarex -full
end
libisloaded and addpath were problem when this file was processed.
I got this file in github.

Respuestas (1)

Aghamarsh Varanasi
Aghamarsh Varanasi el 11 de Mzo. de 2021
Hi,
You can call this MATLAB Script in the 'PreLoadFcn' callback of Simulink.
Refer to this documentation page to learn more about Model Callbacks.

Categorías

Más información sobre General Applications en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by