From: Guy Rouleau on
"Matej Zorko" <dastruja(a)yahoo.com> wrote in message <ha7c8h$4im$1(a)fred.mathworks.com>...
> Greetings,
>
> I am trying to control a robotic arm that performs a high speed task using a model in Simulink. The arm has it's own server that communicates with the control computer via UDP protocol.
> The problem that I am experiencing is very low task repeatability. This seems to be due to execution time beeing non-linear where it should be linear. One of the reasons for this is that outside processes are interrupting matlab while the task is beeing executed. I tried closing as many as possible, but the problem still persists.
> I also tried using real-time windows target, but it wouldn't compile because I am using MATLABfcn blocks in simulink.
> Is there any way you could suggest to solve this problem?
>
> Thank you in advance,
> Matej Zorko

To control a robot in real time, usually you need to generate C code from tehe model that will be run on a real-time OS, something like xPC target for example.

In your application, it seems that you want to control a robot from a Simulink model running in normal simulation mode. There is probably an s-function doing the communication. You will never be able to obtain the timing necessary to drive a robot from a a Simulink model in normal mode, this is intended for simulation only.

I suggest looking if your MATLAB fcn block could be replaced by EML. Once you can generate code for the model, then maybe Real-Time Windows Target will be able to communicate with your robot. For better performance, you should consider bypassing the actual robot controller and implement everything in Simulink and deploy it on a real-time target, like xPC to generate the voltage to your motor drive directly.

Hope it helps

Guy