How to stop simulink from terminating with position violation error?

8 visualizaciones (últimos 30 días)
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 comentarios
christina maher
christina maher el 27 de Oct. de 2022
Movida: Walter Roberson el 27 de Oct. de 2022
how to write it??? i entered a matlab function have inverse kinematics that should make the robot draw circle path.
Walter Roberson
Walter Roberson el 27 de Oct. de 2022
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.

Iniciar sesión para comentar.

Respuesta aceptada

Peter O
Peter O el 16 de Mzo. de 2022
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

Más respuestas (0)

Categorías

Más información sobre Simscape Multibody en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by