problem with seriallink/plot

2,286 views
Skip to first unread message

Constantin George Boanda

unread,
Jun 20, 2015, 4:50:36 PM6/20/15
to robotics...@googlegroups.com
Hello,
I`m trying to plot the robot in a gui axes.
I can get and send to function the axes handle, but when I plot in gui, it gives me an error.
The same if I create a figure, get the handle and send as parameter.
The function is:

function DH_plot%(h,q1,q2,q3,q4)
%h is the handle for the figure
L(1)=Link([0 15.5 1.2 pi/2]);
L(2)=Link([0 0 13.8 0]);
L(3)=Link([0 0 11.3 0]);
L(4)=Link([0 0 18.4 0]);
hob = SerialLink(L,'name','Hob');
hob.plot(h,[q1,q2,q3,q4]);
%hob.plot([0,0,0,0]);
end

and the command to execute is:
>> h=figure

h =

     1

>> gcf

ans =

     1

 
>> DH_plot(h,0,0,0,0)
Error using SerialLink/plot (line 200)
Insufficient columns in q

Error in DH_plot (line 8)
hob.plot(h,[q1,q2,q3,q4]);

Where to set the handle for the plot. I want to display this in a gui built with guide. on axes>
My mathlab version is R2014b. toolbox ver: release 9.10

Thank you.

Regards,

Peter Corke

unread,
Jun 20, 2015, 9:19:51 PM6/20/15
to robotics...@googlegroups.com, boanda...@gmail.com
The plot function doesn't support a figure/axis handle argument.  It will draw in the current axis though,

figure
subplot(121)
p560.plot(qz)

will draw the robot in the subplot.

Constantin George Boanda

unread,
Jun 21, 2015, 5:38:21 AM6/21/15
to robotics...@googlegroups.com, boanda...@gmail.com
Hello,
Thank you.
I sent axes handles and called in my function before the plots.
It works.
You are the best.
DH - plot j.jpg

dzmo...@gmail.com

unread,
Jul 23, 2017, 12:13:31 AM7/23/17
to Robotics & Machine Vision Toolboxes, boanda...@gmail.com
hi  there.
can you please send me the  photo of the code that you wrote because  i had the same problem  and i tried this solution but it didnt work

dzmo...@gmail.com

unread,
Jul 23, 2017, 12:13:31 AM7/23/17
to Robotics & Machine Vision Toolboxes, boanda...@gmail.com
hi guys i have similar problem  but i couldn't solve it . i need help

this is the code that i wrote and  it gives me errors


>> L1=10;
L2=9;
L3=9;
L5=6.25;

L(1)=Link([0 L1 0 pi/2]);
>> L(2)=Link([0 0 L2 0]);
>> L(3)=Link([0 0 L3 0]);
>> L(4)=Link([0 0 0 pi/2]);
>> L(3)=Link([0 L5 0 0]);
>> 
>> 
>> R=SerialLink(L);
>>   
>> q1=0;q2=0;q3=0;q4=0;q4=0;q5=0;
>>  
>> 
>> R.plot([0 0 0 0 0])
Error using SerialLink/plot (line 205)
Insufficient columns in q
 
>> subplot(121)

>> p560.plot(qz)
Error using qz
Not enough input arguments.
 
>> figure(1)
p560.plot(qz)
Error using qz
Not enough input arguments.

Erik van Oene

unread,
Jul 23, 2017, 7:12:59 AM7/23/17
to Robotics & Machine Vision Toolboxes, boanda...@gmail.com, dzmo...@gmail.com
I think you made a typo when constructing link 5

Erik

Op zondag 23 juli 2017 06:13:31 UTC+2 schreef dzmo...@gmail.com:

dzmo...@gmail.com

unread,
Jul 25, 2017, 5:22:45 PM7/25/17
to Robotics & Machine Vision Toolboxes
i asked one of my professors and he helped me figure it out. actually for my MatLab version (2016) i have to use "figure(1) command 1st before i use "R.plot" command.

Therefore when i tried this way it worked


>> L1=10;
L2=9;
L3=9;
L5=6.25;

L(1)=Link([0 L1 0 pi/2]);
>> L(2)=Link([0 0 L2 0]);
>> L(3)=Link([0 0 L3 0]);
>> L(4)=Link([0 0 0 pi/2]);
>> L(5)=Link([0 L5 0 0]);
>>
>>
>> R=SerialLink(L);
>>
>> q1=0;q2=0;q3=0;q4=0;q4=0;q5=0;
>>
>> figure (1)
>> R.plot([q1,q2,q3,q4,q5])

fg

unread,
Oct 18, 2021, 1:08:48 AM10/18/21
to Robotics & Machine Vision Toolboxes
Hello all, I am trying to make a robot move back and forth drawing a line from (10,10,5) to (20,15,5). I make DH Table as follow:
173pic.JPG
173pic.JPG
I am trying to utilize the code from a handout in class to do this. This code draws a line from (1,1,0) to (0,2,0). As of now, I know how move the z value to be 5. But from there, any type of adjustment I make to the code will not work. I try to extend link length to 10, I get this error:

addpath 'insert your respective path to rvctools folder here'
startup_rvc

L1=Link([0 5 1 0 ],'standard');
L2=Link([0 0 1 0 ],'standard');
L2.qlim=[10 20];
r=SerialLink([L1 L2]);
x=[];y=[];shoulder=[];elbow=[];
x0=1;y0=1;delta=0.1;        %initial position and increment of motion
T=[0 -1 0 x0;1 0 0 y0;0 0 1 0; 0 0 0 1];    %initial transformation matrix
xx0=x0/delta+1;
for i=1:xx0
    T(1,4)=x0-(delta*(i-1));
    T(2,4)=-T(1,4)+2;
    Ti=r.ikine(T, 'q0',[0 pi/4],'mask',[1 1 0 0 0 0], 'deg');        %inverse kinematics
    x(i)=T(1,4);
    y(i)=T(2,4);
    shoulder(i)=Ti(1)*(180/pi);
    elbow(i)=Ti(2)*(180/pi);
    angles=[shoulder' elbow'];
    x1(i)=cos(Ti(1));y1(i)=sin(Ti(1));
end

plot(x,y);axis([-5 5 -5 5 -5 5]);hold on% draw the trajectory
TTT=[(shoulder*pi/180)' (elbow*pi/180)'];plot(r,TTT,'delay',0.2,'loop')  
%animation
plot(x',y','-');axis([-5 5 -5 5]); %trajectory 
hold on
for ii=(n-1)/2:n-1   %plot the two links
    line([0 x1(ii)],[0 y1(ii)]);hold on;
    line([x1(ii) x(ii)],[y1(ii) y(ii)]); 
    hold on
end
grid
173pic.JPG
And here we get successful animation along line from (1,1,0) to (0,2,0)! But, I want (10,10,5) to (20,15,5)...
I get error when I try to adjust link lengths to 10 like this:
...
L1=Link([0 5 10 0 ],'standard');
L2=Link([0 0 10 0 ],'standard');
L2.qlim=[10 20];
r=SerialLink([L1 L2]);
x=[];y=[];shoulder=[];elbow=[];
x0=10;y0=10;delta=0.1;
...
Now it seems like its moving from (10, -10, 5) to (0, 0,5). I have a feeling that it involves creating a new transformation matrix, so I made this one from the DH Table above:
[0 0 1 5; 0 1 0 10; -1 0 0 0; 0 0 0 1]
and plugged it into T, and it did not work...

Any help would be appreciated please!

Daniel Moshi

unread,
Oct 23, 2021, 10:50:19 AM10/23/21
to robotics...@googlegroups.com
Thank You very much for the feedback it worked !

--
You received this message because you are subscribed to a topic in the Google Groups "Robotics & Machine Vision Toolboxes" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/robotics-tool-box/5KKEw1Fn2k4/unsubscribe.
To unsubscribe from this group and all its topics, send an email to robotics-tool-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/robotics-tool-box/d0183c60-2fd7-4922-b607-2728c40f2de6n%40googlegroups.com.


--
Regards,
Daniel Moshi
Reply all
Reply to author
Forward
0 new messages