Getting error in Inverse Kinematic block using robotics system toolbox for 2 DOF planner robot

3 views (last 30 days)
I'm trying to control 2 DOF manipulator by providing xyz waypoints using signal builder. The robot model is imported from SolidWorks.
I have also tried to run simulation without IK block providing some input to joint q1 and q2 to check the simlation model and it shows no error. However with inverse kinematics it shows error.
The Simulink model is attached below;
And when I simulate the model it shows error as;
clicking the IKBlock line and following the code going to line 69 we get;
% Assign the robot internal property by instantiating from the structure
obj.TreeInternal = robotics.manip.internal.RigidBodyTree(obj.TreeStruct.NumBodies, obj.TreeStruct);
obj.IKInternal = inverseKinematics('RigidBodyTree', obj.TreeInternal, ... % ---------------line 69
'SolverAlgorithm', obj.SolverName, 'SolverParameters', obj.SolverParameters, ...
'UserTimer', obj.UserTimer);
end
I have tried few resources but couldn't get answer to solve this issue. Unfortuanelty, I am not sure how I can make the simulation work for 2 DOF model.Thank you.

Accepted Answer

Walter Roberson
Walter Roberson on 1 Jun 2023
rename your MATLAB\inverseKinematics.m to a different name. The current name is interfering with a built-in model with the same name.

More Answers (1)

Nathan Hardenberg
Nathan Hardenberg on 1 Jun 2023
Your error seems to indicate, that you want to run a script as a function. While your setup looks good, it could be that you have a script named "inverseKinematics.m" or "inverseKinematics.mlx" in your working directory. Maybe MATLAB then confuses this with the desired function. (Link to related Post)
If this is the case, simply renaming this script should resolve the problem!
Otherwise the more time-efficient method is maybe calculating the inverse kinematics yourself with a MATLAB-function. Since it is only a 2-DOF Robot this should not be that difficult.

Community Treasure Hunt

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

Start Hunting!