How to stop simulink from terminating with position violation error?

13 views (last 30 days)
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.

Accepted Answer

Peter O
Peter O on 16 Mar 2022
Wrap it in a try catch block?
%for loop
% set_param calls and stuff...
outs = sim('model', ...)
disp('Bad Parameter Set')
%end for loop

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by