Borrar filtros
Borrar filtros

Is it possible to use simulink coder incompatible robotics toolbox functions using S-functions?

2 visualizaciones (últimos 30 días)
Hi,
I am trying to develop a stand-alone ROS node in simulink that utilizes the robotics toolbox matchScansGrid() function.
But as simulink coder does not support code generation for the matchScansGrid() function (or any of the lidarSLAM tools), I was proposed an alternate method to use the matchScansGrid() in simulink:
  1. Make a matlab function {eg testScanMatching() } that utilizes (or calls) the matchScansGrid().
  2. Generate C code of this function (testScanMatching) using Matlab coder. This is possible as matchScansGrid() is supported by matlab coder.
  3. Use the packNGo functionality
  4. Unzip the output of step 3.
  5. Use the legacy code to generate a compatible S-function (of testScanMatching)
  6. Import it in simulink
Question:
  1. Does this method work? Can I really use matchScansGrid() in simulink using this round-about way?
  2. Is there a guide to implement S-functions from matlab coder generated C/C++ code ?
Thanks in advance.
note: I am testing this method but currently I have trouble building an S function from the code generated of testScanMatching
  2 comentarios
Denis Gurchenkov
Denis Gurchenkov el 13 de Sept. de 2019
If you just put the use of matchScansGrid into a MATLAB Function block, that should work fine in Simulink Coder. E.g. have a block with four inputs and one output, like this:
function relPose = useMatchScansGrid(ranges1, angles1, ranges2, angles2)
x = lidarScan(ranges1, angles1);
y = lidarScan(ranges2, angles2);
relPose = matchScansGrid(x,y);
end

Iniciar sesión para comentar.

Respuesta aceptada

soorajanilkumar
soorajanilkumar el 16 de Sept. de 2019
Thanks Denis,
It worked now.
I'm not sure, but when I tried before I was not successful. In addition I had to enable dynamic memory allocation to generate code for the matlab function.

Más respuestas (0)

Categorías

Más información sobre Code Generation en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by