How to use the ikcon

529 views
Skip to first unread message

cassie zhou

unread,
Aug 3, 2017, 8:17:09 AM8/3/17
to Robotics & Machine Vision Toolboxes
   
   Hello everyone,I am a newcomer to learn the robot toolbox. I try to  find the example but did not find. I want to let the joint 1 ' angle be -pi/2, and the joint2' angle be pi/2, and the joint3' angle  between -35 deg and 35 deg, but the answer seems is not correct. Could anyone tell me what should i do?


clear all
clc
startup_rvc
 
fingersA
(1) = Link([ -pi/2 0.061112 0 pi/2 ], 'qlim', [-pi/2 -pi/2], 'standard');
fingersA
(2) = Link([ pi/2 -0.044475 0.021514 pi/2 ], 'qlim', 'pi/2', 'standard');
fingersA
(3) = Link([ 0 0 0.05715 0 ], 'qlim', [-0.6109 0.6109], 'standard');
fingersA
(4) = Link([ 0 0 0.0381 0 ], 'qlim',[0 pi/2], 'standard');
fingersA
(5) = Link([ 0 0 0.0381 0 ], 'qlim',[0.4363 1.2741], 'standard');
finger1
= SerialLink(fingersA, 'name', 'finger1');


T1
= transl(0.0445, -0.0000, -0.2160)*trotx(pi/2)*trotz(pi/2)
q1
= finger1.ikcon(T1)
finger1
.plot(q1)


results:

Erik van Oene

unread,
Aug 3, 2017, 6:06:43 PM8/3/17
to Robotics & Machine Vision Toolboxes, cassiezh...@gmail.com
Hi,

Few remarks:

  • Your limits are not set correctly. Check finger1.qlim to verify this. I usually make the link first. and than set the limits seperatly. This worked for me. Here an example:
    >> fingersA(3) = Link([ 0 0 0.05715 0 ]); fingersA(3).qlim = [-0.6109 0.6109]%, 'standard');
  • Try to give it a initial condition which is within the limits. Default is one, which is not. So that is not a good starting point.
  • Note that, with such constraints, the goal may not be achievable...
Please test with a desired pose T1, from which you know the q exists and lays within the limits.

Erik


Op donderdag 3 augustus 2017 14:17:09 UTC+2 schreef cassie zhou:

cassiezh...@gmail.com

unread,
Aug 4, 2017, 6:58:05 PM8/4/17
to Robotics & Machine Vision Toolboxes, cassiezh...@gmail.com
Thank you very much, it is useful. And i also find that it can  be written in this way:
    LA(3) = Revolute('d', 0, 'a', 0.05715, 'alpha', 0, ...
                                 'qlim', [-0.6109  0.6109] );
 which is according to mdl_puma560

Faiz Azuwir

unread,
Sep 19, 2017, 10:58:24 PM9/19/17
to Robotics & Machine Vision Toolboxes
Hi,
Im just here for some help, i tried to use the same ikcon function but it returns this error.
--------------------------------------------------------------------------------------------------------------------------------------------------------
 Error using assert
The condition input argument must be a scalar logical.

Error in SerialLink/ikcon (line 72)
    assert( exist('fmincon'), 'rtb:ikcon:nosupport',
    'Optimization Toolbox required');
 ---------------------------------------------------------------------------------------------------------------------------------------------------------

I have confirmed that my matlab license has Optimization Toolbox on it using ver. I was wondering if you can help me by running my code to confirm that it works. 

-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


%ForeLimb
%L3 = Link('a', 0.0203, 'qlim', [pi/2 1]);
L(1) = Link('d',0,'a', 1.7 ,'qlim',[1.2 pi/2]);
L(2) = Link('d',0,'a', 1.8 ,'qlim',[0.5 1.1]);
L(3) = Link('d',0,'a', 2.5 ,'qlim',[-0.3 -1.4]);
L(4) = Link('d',0,'a', 2.0 ,'qlim',[0 2.6]);
L(5) = Link('d',0,'a', 1.0 ,'qlim',[-0 2.6]);




Fore = SerialLink(L)
Fore.name = 'Forelimb'

q0 = [1.204 0.751 -.977 0.139 -0.157];
q1 = [1.274 1.065 -.855 0.069 -0.628];
q2 = [pi/2 0.698 -.349 0.279 -0.75];
q3 = [1.466 0.7853 -0.8377 0.9250 0.4014];
q4 = [1.222 0.9425 -1.361 0.977 0.995];


t=0:.03:2;%Time vector & steps
traj1 = jtraj(q0,q1,t); 
traj2 = jtraj(q1,q2,t);
traj3 = jtraj(q2,q3,t);
traj4 = jtraj(q3,q4,t);
traj5 = jtraj(q4,q0,t);

Fore.plot(traj1);
Fore.plot(traj2);
Fore.plot(traj3);
Fore.plot(traj4);
Fore.plot(traj5);

%Fore.plot([1.466 0.7853 -0.8377 0.9250 0.4014])
T0 = Fore.fkine(q0);
T1 = Fore.fkine(q1);
T2 = Fore.fkine(q2);
T3 = Fore.fkine(q3);
T4 = Fore.fkine(q4);
%inv =  Fore.ikine(T,'mask', [1 1 1  1 1])
%figure
%Fore.plot(inv)

q12 = [1.274 1.065 -.855 0.069 -0.628];
Q0 = Fore.ikcon(T0,q12);
Q1 = Fore.ikcon(T1,q12);
Q2 = Fore.ikcon(T2,q12);
Q3 = Fore.ikcon(T3,q12);
Q4 = Fore.ikcon(T4,q12);


Q02 = [1.222 0.9425 -1.361 0.977 0.995];
t=0:0.03:2;%Time vector & steps

Traj1 = jtraj(Q,Q1,t); 
Traj2 = jtraj(Q1,Q2,t);
Traj3 = jtraj(Q2,Q3,t);
Traj4 = jtraj(Q3,Q2,t);
Traj5 = jtraj(Q2,Q,t);

figure(2)
Fore.plot(Traj1);
Fore.plot(Traj2);
Fore.plot(Traj3);
Fore.plot(Traj4);
Fore.plot(Traj5);

Reply all
Reply to author
Forward
0 new messages