Effacer les filtres
Effacer les filtres

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

2 vues (au cours des 30 derniers jours)
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 commentaires
Denis Gurchenkov
Denis Gurchenkov le 13 Sep 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

Connectez-vous pour commenter.

Réponse acceptée

soorajanilkumar
soorajanilkumar le 16 Sep 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.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by