# prismatic joint limit

775 views

### dan...@gmail.com

Dec 2, 2017, 5:28:21 PM12/2/17
to Robotics & Machine Vision Toolboxes
Hi All, May I ask why the prismatic joint limits have to be >= 0 as in RTBPlot.m:

if ~isempty(L(j).qlim)
% use the maximum joint value
assert(all(L(j).qlim >= 0),  'RTB:RTBPlot:plot_options', 'prismatic joint %d qlim values cannot be negative', j)
reach = reach + abs(L(j).a) + max(abs(L(j).qlim));

Thank you very much!

### Peter Corke

Dec 2, 2017, 5:39:34 PM12/2/17
to Robotics & Machine Vision Toolboxes
Two reasons:
- a negative length is not physically possible (just my opinion)
- the way the prismatic links are animated involves scaling a unit length cylinder by the link length and MATLAB graphics won't allow a negative scaling factor

Peter

### Heng Wang

Dec 4, 2017, 1:24:21 AM12/4/17
to Robotics & Machine Vision Toolboxes
Peter,
Thank you very much for the response. However, when the prsimatic joint is a base, like in your mdl_p8.m example, the 2 base prismatic link could be negative, and that model gives error when I try p8.plot(qz). The ikine function also could return a negative number for these joints. So, how should I solve these problem since my actual robot does need to go to negative x-axis.
Thank you very much again!
Heng

### Heng Wang

Dec 4, 2017, 1:26:43 AM12/4/17
to Robotics & Machine Vision Toolboxes
By the way, I am using the 10.2 version of your toolbox. Thanks!

### Peter Corke

Dec 4, 2017, 11:29:18 PM12/4/17
to Robotics & Machine Vision Toolboxes
I'd have to completely redo the way I draw the prismatic link, since there's an underlying MATLAB constraint.  Are you willing to dig into that part of the code?  Maybe change the X/Y/ZData of the object when the length goes negative...

### Heng Wang

Dec 5, 2017, 1:14:41 AM12/5/17
to Robotics & Machine Vision Toolboxes
What kind of matlab constraint? I didn't notice any. Of course I am willing to dig in to the code, but which part are you referring to? Please let me know. Currently, I did change the x and y axis ranges of the prismatic joints to positive to make them work, however, that do not match how our physical robot work. Or I could change the world reference origin to (0.2, 0, 0) instead of (0, 0, 0), but that feels weird. Don't know if people ever do that. I am new to robotics and might say things wrong....Thank you very much again!

### Peter Corke

Dec 5, 2017, 2:29:04 AM12/5/17
To make the link change in length I create a unit length object and attach a MATLAB hgtransform to it which scales it in the length direction.  However MATLAB doesn’t allow me to have a negative scaling factor, to make it extend in the negative direction.  I don’t know why it can’t do this, it just complains about Invalid value for Matrix property

Peter

--
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/sEMqJnC15zo/unsubscribe.
To unsubscribe from this group and all its topics, send an email to robotics-tool-...@googlegroups.com.
To post to this group, send email to robotics...@googlegroups.com.

### Heng Wang

Dec 5, 2017, 10:51:55 AM12/5/17
to Robotics & Machine Vision Toolboxes
Peter, Would you please send me this part of your code that is not working. I think I might be able to figure out why. Thank you very much! Heng

### Erik van Oene

Dec 5, 2017, 12:32:07 PM12/5/17
to Robotics & Machine Vision Toolboxes
You already have the code yourself right?

Run the code with negative link length until the error.
If the error which is thrown is written by Peter himself, than suppress that one and try again. By doing this you will finally end up at the error from Matlab about the hgtransform.

Erik

Op dinsdag 5 december 2017 16:51:55 UTC+1 schreef Heng Wang:

### Heng Wang

Dec 5, 2017, 2:50:55 PM12/5/17
to Robotics & Machine Vision Toolboxes
I see. So I just need to suppress the assert line, that will lead me into the matlab error, right?
Thanks,
Heng

### Peter Corke

Dec 9, 2017, 5:54:47 PM12/9/17
to Robotics & Machine Vision Toolboxes
Yep.  Sorry, but I can't customise for everybody who wants a slightly different thing.  But I'm happy to integrate useful improvements back into the code base with acknowledgement.

Peter

### Michael Carvajal

Feb 24, 2022, 4:17:41 PM2/24/22
to Robotics & Machine Vision Toolboxes
@Peter:
I am going through the examples and tutorials from your RVC (2nd edition) textbook for the first time and ran into an error that I don't understand:

I built an 'RP' arm (based in ETS2) by defining:
>> E = Rz('q1')*Tx(a1)*Tx('q2')
where a1 = 1.

When I solve a forward-kinematics configuration (q1 = 90 deg and q2 = 1 [meter?]), everything solves as expected:

>> E25.fkine([pi/2 1])
ans =
0        -1         0
1         0         2
0         0         1

However, when I try to plot the arm in that very configuration, I get the following error:
>> E25.plot([pi/2 1])
Index exceeds the number of array elements. Index must not exceed 0.

Error in ETS2/plot (line 485)
reach = reach + e.qlim(2);

I've been trying to set a min-max range for the prismatic joint but have been unsuccessful:

>> E25.qlim(2) = [0, 0.5];
Intermediate dot '.' indexing produced a comma-separated list with 3 values, but it
must produce a single value when followed by subsequent indexing operations.

Any advice on how to overcome this error?

Warm regards / thanks in advance!
-Michael C.