course angle control using simulink PID and a c++ code
8 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Abdulhady Feteiha
am 11 Mär. 2017
Beantwortet: Michelle Wu
am 13 Mär. 2017
Hello fellows, i've prepared a simple c++ code that generates the course angle of a robot given its current position and the desired one. I'd like to link this code to simulation using simulink PID block. Note that my experience with simulink is limited, all i know is that i can put a PID block and a scoop to receive the result. I'd appreciate it if you helped.
0 Kommentare
Akzeptierte Antwort
Michelle Wu
am 13 Mär. 2017
I am assuming that you are looking to include existing C++ code in Simulink. There are three ways which allows you to integrate C++ code into Simulink:
1) You can integrate existing C (or C++) functions, such as device drivers, lookup tables, and general functions and interfaces, into Simulink models by using the Legacy Code Tool. Please refer to the following documentation for more information:
2) You can manually write a wrapper S-function to call external C++ code. The procedure is very similar to writing a wrapper function in C. Please refer to the following doc page:
3) Another option is to use Stateflow custom code interface. You may refer to the following documentation:
There is also an example available demonstrating how to use Stateflow to integrate external code into a model:
After creating the necessary blocks (S-Function block or Stateflow chart) to include the C++ code, you can use them together with the PID Controller block for your application.
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Block and Blockset Authoring finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!