How to stop simulink from terminating with position violation error?

6 ビュー (過去 30 日間)
Timothy Mountford-Lister
Timothy Mountford-Lister 2022 年 3 月 16 日
コメント済み: Walter Roberson 2022 年 10 月 27 日
Hi MATLAB Community,
I have built up a model of a parallel industrial robot using Simulink Simscape Multibody, and I am now attempting to model the work volume, or space of reachable points. I am doing this by programmatically running the simulation using a script that goes through all possible positions of the actuated joints and recording the achievable positions of the end effector. I am using the ‘sim’ command method to run the simulation, rather than the run-button method. There are a number of input positions that will not be possible for the robot due to other joint limits and hence not solvable for the simulation, and I need to know which positions are possible and which are not. The issue is that whenever an input is used that is not solvable, the position violation error (see below) is thrown. This causes the simulation and the script to terminate. Is there a method to have Simulink and the MATLAB script not terminate when this error is thrown? If I can ignore this error, then the simulation would be able to move onto the next points, which may be possible, and simply not record the point that was not possible.
The error:
['Machine_model/Solver Configuration']: Model not assembled due to a position violation. The failure occurred during the attempt to assemble all joints in the system and satisfy any motion inputs. If an Update Diagram operation completes successfully, the failure is likely caused by motion inputs. Consider adjusting the motion inputs to specify a different starting configuration. Also consider adjusting or adding joint targets to better guide the assembly.
Thanks
  3 件のコメント
christina maher
christina maher 2022 年 10 月 27 日
移動済み: Walter Roberson 2022 年 10 月 27 日
how to write it??? i entered a matlab function have inverse kinematics that should make the robot draw circle path.
Walter Roberson
Walter Roberson 2022 年 10 月 27 日
You currently have a MATLAB function or script that calls sim(). That call should have "try" inserted before it, and "catch ME" and then "end", like Peter O showed.

サインインしてコメントする。

採用された回答

Peter O
Peter O 2022 年 3 月 16 日
Wrap it in a try catch block?
%for loop
try
% set_param calls and stuff...
outs = sim('model', ...)
catch
disp('Bad Parameter Set')
end
%end for loop
  2 件のコメント
Timothy Mountford-Lister
Timothy Mountford-Lister 2022 年 3 月 16 日
That has worked great, thank you for your help.
christina maher
christina maher 2022 年 10 月 27 日
編集済み: christina maher 2022 年 10 月 27 日
where to write it? 😅

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSimscape Multibody についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by