Simulink Desktop Real-Timeのエクスターナルモードを使用する際、外部 C/C++ コードを挿入する方法(外部として関数を宣言、S Function、C Caller、C Function)の違いを知りたい。
2 views (last 30 days)
Show older comments
IMUセンサから読み取ったデータをSimulink Desktop Real-Timeのエクスターナルモードを使いリアルタイム計測・アクチュエータを使った制御を行いたいです。
IMUセンサにはC++で書かれたサンプルコードファイル(.h,.cppファイルが20個程度の規模)があり、これをsimulinkに組み込むことを考えています。
調べた限りでは以下の3つの方法があるようですが、Simulink Desktop Real-Timeのエクスターナルモードで使用可能かどうかと、使い方の違い・メリットを教えていただきたいです。
・外部コードからmexファイル( MEX 関数)を作成し、MATLAB Functionの中で「外部として関数を宣言」して実行
https://jp.mathworks.com/help/simulink/slref/coder.extrinsic.html
・外部コードからS Functionブロックを作成し実行
https://jp.mathworks.com/help/simulink/slref/legacy_code.html
・C Caller、C FunctionからSimulink で C コードを統合(Simulink Desktop Real-Timeで使えるか未確認)
https://jp.mathworks.com/help/simulink/integrate-external-c-algorithms-using-c-function-block.html
https://jp.mathworks.com/help/simulink/slref/ccaller.html
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Target Computer Setup 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!