I would like to upload the dynamic model equation into the APM2.5. An example coding and simulink model can be found in Peter Corke's Robotics Toolbox which can be viewed on Matlab. The dynamics is coded in an S-function and is solved using continuous state solver. However, the manual in this blockset says that all completed model has to be run on fixed-step discrete solver.
I have tried the following but to no avail
1) changing the code from continuous input states to discrete states
2) Introducing ts = [1 0] where it solves in continuous state with minor sample time
I am guessing that I have to recode the S-function into a MEX or C file before I can use the Run On Hardware option in simulink.
Any additional help would be gladly appreciated.
There are two options
1) One could use for iterator block or something that can read bytes one by one and then buffer them as per application needs in the model
2) or on the contrary create a custom block that uses the Serial.readBytes function from the arduino standard library. http://arduino.cc/en/Serial/ReadBytes
For creating a Custom driver block one could follow the guide published at
Hope this helps,