petercorke / RVC3-MATLAB

New toolbox, data and examples for Robotics, Vision & Control: 3rd edition in MATLAB
MIT License
91 stars 15 forks source link

ETS3/teach has an error when the robot has a prismatic joint #5

Open amiao1017 opened 1 year ago

amiao1017 commented 1 year ago

Describe the bug ETS3/teach has an error when the robot has a prismatic joint

To Reproduce

W1 = 0.109; W2 = 0.082; L1 = 0.425; L2 = 0.392; H1 = 0.089; H2 = 0.095;

e = ETS3.Rz("q1")ETS3.Tz(H1)ETS3.Ty(W1)ETS3.Ry("q2")ETS3.Tx(L1)... ETS3.Ry("q3")ETS3.Tx(L2)ETS3.Ry("q4")ETS3.Ry(pi)ETS3.Tz("q5")ETS3.Ty(W2)ETS3.Tz(H2)ETS3.Rx(-pi/2)

e.fkine([0 -pi/2 0 0 pi/2]) e.teach

Screenshots image

when you use ETS3.Rz("q5") instead of ETS3.Tz("q5"), everything is ok.

petercorke commented 1 year ago

The first-order cause is that we have to specify the range of the joint variable for a prismatic joint. For a revolute the default is -pi to pi, but for a prismatic joint there is no obvious default value. Specify ETS3.Tz("q5", qlim=[0,1]) or whatever the working range is. However, after that, there are further bugs which I'll need a bit of time to get my head back into this code.