views:

58

answers:

2

I have a Hokuyo USB LADAR/LIDAR. I have problem with interfacing or connecting it to MATLAB/Simulink, such that I can do all the processing in those software packages.

I have already asked Hokuyo. They only provide C++ program interface (sample programming guide and libraries). How do I interface this to MATLAB/Simulink?

A: 

The web page you pointed to has a C API in urg_ctrl.h. I assume this comes with a DLL that implements the API? If so, you can use Matlab's interface for calling external libraries. The basic procedure is to have Matlab parse the header file using LOADLIBRARY, then view the available functions using LIBFUNCTIONS and call functions using CALLLIB.

I imagine, though I've never done it, that you can write .m functions to access the device that you can then wrap in Simulink blocks.

mtrw
thanks, u seems know a lot about it,, can u give me the sample demos or model??
Sorry, I don't use Matlab anymore (too expensive). But the documentation (http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f43202.html) is pretty clear. Just follow the steps of using LOADLIBRARY, LIBFUNCTIONS, and CALLLIB.
mtrw
A: 

Have a look at mex files. You can embed c++ code in matlab as well as simulink.

zellus
so,, i just copied the c++ code interface into matlab or simulink???
mex functions (matlab) and sfunctions (simulink) are not the same. It's a bit more than copying, but manageable with basic c/c++ programming skills. Check the documentation for detailed information.
zellus

related questions