How to stop simulink from terminating with position violation error?

조회 수: 6 (최근 30일)
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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Simscape Multibody에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by