Problems with plot function of SerialLink / Mistakes in code?

1,257 views
Skip to first unread message

Gickl

unread,
Jul 8, 2014, 7:05:14 AM7/8/14
to robotics...@googlegroups.com
Hello,

during the last days i tried out some manipulator configurations with the SerialLink class. The configuration itself with the DH parameters works fine. But the visualization using SerialLink.plot was not satisfying. I got several problems that should not be there in my opinion. I work with MATLAB version R2013b and Robotics Toolbox 9.9.0, so it should be the newest version I think:


----------------------------------------------------------------------------------------------------
MATLAB Version: 8.2.0.701 (R2013b)
MATLAB License Number: 50505
Operating System: Linux 3.5.0-51-generic #76-Ubuntu SMP Thu May 15 21:19:10 UTC 2014 x86_64
Java Version: Java 1.7.0_11-b21 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode
----------------------------------------------------------------------------------------------------
MATLAB                                                Version 8.2        (R2013b)
Simulink                                                 Version 8.2        (R2013b)
RF Toolbox                                             Version 2.13       (R2013b)
...
Robotics Toolbox                                     Version 9.9.0            
Robotics Toolbox                                     Version 9.9.0
...     
Everything else is also (R2013b) ... 
-----------------------------------------------------------------------------------------------------


The first problem is, that I cannot use a prismatic joint as end effector . My SerialLink is R1 for example:

    R1 =
    
    noname (2 axis, RP, stdDH, slowRNE)                
                                                       
    +---+-----------+-----------+-----------+-----------+
    | j |     theta |         d |         a |     alpha |
    +---+-----------+-----------+-----------+-----------+
    |  1|         q1|          1|          2|          0|
    |  2|          0|         q2|          1|          0|
    +---+-----------+-----------+-----------+-----------+
                                                       
    grav =    0  base = 1  0  0  0   tool =  1  0  0  0
                 0             0  1  0  0              0  1  0  0
             9.81            0  0  1  0              0  0  1  0
                               0  0  0  1              0  0  0  1


Plotting this SerialLink leads to the following error no matter what value I set for q2:

    >> plot(R1,[0 0],'workspace',[-5 5 -5 5 -5 5])
    creating new robot
    Operands to the || and && operators must be convertible to logical scalar values.

    Error in SerialLink/plot>create_robot (line 422)
            if (links(end).d ~= 0) || (links(end).a ~= 0)

    Error in SerialLink/plot (line 247)
            handle = create_robot(robot, opt);

Should & and | be used there instead of && and ||?

A configuration with 3 Links could be the following:

    R2 =
    
    noname (3 axis, RPR, stdDH, slowRNE)               
                                                       
    +---+-----------+-----------+-----------+-----------+
    | j |     theta |         d |         a |     alpha |
    +---+-----------+-----------+-----------+-----------+
    |  1|         q1|          1|          2|            0|
    |  2|           0|         q2|          1|     1.571|
    |  3|         q3|          2|          2|            0|
    +---+-----------+-----------+-----------+-----------+
                                                       
    grav =    0  base = 1  0  0  0   tool =  1  0  0  0
                 0             0  1  0  0              0  1  0  0
             9.81             0  0  1  0              0  0  1  0
                                0  0  0  1              0  0  0  1


When this SerialLink is plotted it looks like on the left side in the attached OriginalModified.pdf. The left red ellipse marks the part where the bar corresponding to the d1 value is missing. The second red ellipse marks where the bar representing the prismatic joint translation should be positioned. I had a closer look into the code of SerialLink.plot and SerialLink.animate and found some mistakes.
The first thing is in line 400 of SerialLink.plot. There for a second time t(2) ~= 0 is checked. But it should be t(3) I would say. If this is corrected, the bars representing the d values appear.
The second problem, the wrongly positioned prismatic joint bars, seems to be caused by applying the previous transformation (marked in green) twice on the bar.

If a joint has an alpha of half pi for example, the bar representing the d value is shown, but not where i expected it. It is linked to the end of the link so that the bars for d and a do not form a connection between the origin and the end of the link. The attached AlphaDA.pdf shows this for the following configuration:

    R3 =
    
    noname (3 axis, RRR, stdDH, slowRNE)               
                                                       
    +---+-----------+-----------+-----------+-----------+
    | j |     theta |         d |         a |     alpha |
    +---+-----------+-----------+-----------+-----------+
    |  1|         q1|          2|          1|      1.571|
    |  2|         q2|          1|          2|     -1.571|
    |  3|         q3|          0|          2|          0|
    +---+-----------+-----------+-----------+-----------+
                                                       
    grav =    0  base = 1  0  0  0   tool =  1  0  0  0
                 0             0  1  0  0             0  1  0  0
             9.81             0  0  1  0             0  0  1  0
                                0  0  0  1             0  0  0  1


I don't know yet what causes this phenomena.

I am not completely sure, if these problems are really caused by the supposed mistakes in the code or if i am doing something wrong. Anyway I modified the SerialLink.plot and SerialLink.animate files in a local toolbox copy to get a satisfying visualization. The result can be seen in the right subfigure in the attached OriginalModified.pdf.

Maybe everything was unnecessary and i am wrong. Then please tell me. Otherwise I would be pleased to receive some feedback, if anybody has the same problem for example or just comments on the presented problems.

Best regards
Gickl
AlphaAD.pdf
OriginalModified.pdf

Peter Corke

unread,
Aug 10, 2014, 2:06:01 AM8/10/14
to robotics...@googlegroups.com
Daniel,

in 9.9 there was a pretty major rewrite of the graphics code, which had gotten very scruffy over a long period of time.  I test on a few robot cases, but clearly not enough, so thanks for the feedback.  There are a few problems with prismatic joints.  Some comments below.

Yes, and fixed now in SVN. 

A configuration with 3 Links could be the following:

    R2 =
    
    noname (3 axis, RPR, stdDH, slowRNE)               
                                                       
    +---+-----------+-----------+-----------+-----------+
    | j |     theta |         d |         a |     alpha |
    +---+-----------+-----------+-----------+-----------+
    |  1|         q1|          1|          2|            0|
    |  2|           0|         q2|          1|     1.571|
    |  3|         q3|          2|          2|            0|
    +---+-----------+-----------+-----------+-----------+
                                                       
    grav =    0  base = 1  0  0  0   tool =  1  0  0  0
                 0             0  1  0  0              0  1  0  0
             9.81             0  0  1  0              0  0  1  0
                                0  0  0  1              0  0  0  1


When this SerialLink is plotted it looks like on the left side in the attached OriginalModified.pdf. The left red ellipse marks the part where the bar corresponding to the d1 value is missing. The second red ellipse marks where the bar representing the prismatic joint translation should be positioned. I had a closer look into the code of SerialLink.plot and SerialLink.animate and found some mistakes.
The first thing is in line 400 of SerialLink.plot. There for a second time t(2) ~= 0 is checked. But it should be t(3) I would say. If this is corrected, the bars representing the d values appear.
The second problem, the wrongly positioned prismatic joint bars, seems to be caused by applying the previous transformation (marked in green) twice on the bar.

good catch.
 

If a joint has an alpha of half pi for example, the bar representing the d value is shown, but not where i expected it. It is linked to the end of the link so that the bars for d and a do not form a connection between the origin and the end of the link. The attached AlphaDA.pdf shows this for the following configuration:

    R3 =
    
    noname (3 axis, RRR, stdDH, slowRNE)               
                                                       
    +---+-----------+-----------+-----------+-----------+
    | j |     theta |         d |         a |     alpha |
    +---+-----------+-----------+-----------+-----------+
    |  1|         q1|          2|          1|      1.571|
    |  2|         q2|          1|          2|     -1.571|
    |  3|         q3|          0|          2|          0|
    +---+-----------+-----------+-----------+-----------+
                                                       
    grav =    0  base = 1  0  0  0   tool =  1  0  0  0
                 0             0  1  0  0             0  1  0  0
             9.81             0  0  1  0             0  0  1  0
                                0  0  0  1             0  0  0  1


I don't know yet what causes this phenomena.

I am not completely sure, if these problems are really caused by the supposed mistakes in the code or if i am doing something wrong. Anyway I modified the SerialLink.plot and SerialLink.animate files in a local toolbox copy to get a satisfying visualization. The result can be seen in the right subfigure in the attached OriginalModified.pdf.

Maybe everything was unnecessary and i am wrong. Then please tell me. Otherwise I would be pleased to receive some feedback, if anybody has the same problem for example or just comments on the presented problems.

Can you send me your modified code and I can integrate the patches with my version?
 

Best regards
Gickl

Alex Smith

unread,
Dec 5, 2014, 5:48:54 AM12/5/14
to robotics...@googlegroups.com
Hi Peter, 

Has this been integrated with the toolbox downloadable from your website? I got my students to download the latest version today, and they were getting these errors. I found the first error is caused by checking the value of 'd' for the last joint, which if prismatic is set to an empty vector '[]'. Quick fixed this by filling it with a zero. Is it better to replace the || with | ? 

Cheers, 
Alex 

Daniel Nickchen

unread,
Dec 5, 2014, 6:42:54 AM12/5/14
to robotics...@googlegroups.com
Hello everybody,

I know you asked me to send you my modified code, Peter. And it's been a long time ago now...I told my boss about your request and she actually wanted to contact you concerning the code and other matters. I think, she didn't had the time yet to contact you or the intention got lost in all the other work, respectively. I'm sorry for that. I will discuss this matter again and I hope that we can provide the code in next days.

Best regards
Daniel Nickchen

--
You received this message because you are subscribed to the Google Groups "Robotics & Machine Vision Toolboxes" group.
To unsubscribe from this group and stop receiving emails from it, send an email to robotics-tool-...@googlegroups.com.
To post to this group, send email to robotics...@googlegroups.com.
Visit this group at http://groups.google.com/group/robotics-tool-box.
For more options, visit https://groups.google.com/d/optout.

Peter Corke

unread,
Dec 7, 2014, 3:19:14 PM12/7/14
to robotics...@googlegroups.com
I've made quite a few changes and at the moment these are al in svn, I'm hoping to get a new distro out before Christmas

peter

Peter Corke

unread,
Dec 7, 2014, 3:20:56 PM12/7/14
to robotics...@googlegroups.com
Or else her email got lost in my inbox.  Either way, if you can followup or let me know who to expect email from on, that'd be great.

peter

Daniel Nickchen

unread,
Dec 18, 2014, 3:24:00 AM12/18/14
to robotics...@googlegroups.com
Hello Peter,

you should hear from Prof. Mertsching in the next days I hope. Then you'll get the code and so on.

Best regards
Daniel Nickchen

Reply all
Reply to author
Forward
0 new messages