Is it possible to use simulink coder incompatible robotics toolbox functions using S-functions?
3 views (last 30 days)
Show older comments
soorajanilkumar
on 12 Sep 2019
Commented: soorajanilkumar
on 16 Sep 2019
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:
- Make a matlab function {eg testScanMatching() } that utilizes (or calls) the matchScansGrid().
- Generate C code of this function (testScanMatching) using Matlab coder. This is possible as matchScansGrid() is supported by matlab coder.
- Use the packNGo functionality
- Unzip the output of step 3.
- Use the legacy code to generate a compatible S-function (of testScanMatching)
- Import it in simulink
Question:
- Does this method work? Can I really use matchScansGrid() in simulink using this round-about way?
- 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 Comments
Denis Gurchenkov
on 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
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Code Generation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!