Inverse Kinematic Solver solutions
20 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Kyle Lammers
il 5 Set 2019
Commentato: Cam Salzberger
il 13 Nov 2020
Hello, I am using the robotic toolbox inverse kinematic solver as shown below.
My main question is why do I get different results everytime this script is ran? There are small differneces in the outputs but then every few iterations the values seem to almost double.
Thank you for any advice you can offer!
clear
robot = importrobot('appleRobot.urdf');
homeConfig = robot.homeConfiguration;
ik = robotics.InverseKinematics('RigidBodyTree', robot);
ik.SolverParameters.AllowRandomRestarts = true;
ik.SolverParameters.MaxIterations = 1500;
x = 24;
y = 25;
z = 26;
%inches to meters
x = x / 39.37; y = y / 39.37; z = z / 39.37;
pos = [x y z];
pose = eye(4);
pose(1:3, 4) = pos';
weights = [0.25 0.25 0.25 1 1 1];
[configSoln,solnInfo] = ik('end', pose, weights,...
homeConfig);
dis = 0; theta = 0; phi = 0;
dis = configSoln(1).JointPosition;
theta = configSoln(2).JointPosition;
phi = configSoln(3).JointPosition;
[dis theta phi];
%solnInfo
0 Commenti
Risposta accettata
Cam Salzberger
il 6 Set 2019
Hello Kyle,
The inverse kinematics solver parameter AllowRandomRestarts is likely the culprit here. If you check the documentation:
AllowRandomRestarts — Indicator if random restarts are allowed. Random restarts are triggered when the algorithm approaches a solution that does not satisfy the constraints. A randomly generated initial guess is used. MaxIteration and MaxTime are still obeyed. By default, random restarts are enabled.
Since there is some randomness in the solver process, the results may differ every time. Especially if there are multiple solutions for the same position.
-Cam
3 Commenti
Cam Salzberger
il 13 Nov 2020
Mosen, if you check out the examples attached to the inverseKinematics documentation, this example shows precisely how to do this.
ik = inverseKinematics('RigidBodyTree', pr2);
ik.SolverParameters.AllowRandomRestart = false;
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Inverse Kinematics in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!