petercorke / robotics-toolbox-matlab

Robotics Toolbox for MATLAB
GNU Lesser General Public License v2.1
1.29k stars 444 forks source link

Symbolic variables in jacobian0 break the function #23

Closed joernmalzahn closed 6 years ago

joernmalzahn commented 7 years ago

I am opening this issue on behalf of Marc Killpack, who reported a bug on the googlegroup with the following desciption:

The problem is with the following lines of code in the "jacobe.m" file:

if isa(q, 'sym') J(6, robot.n) = sym(); else J = zeros(6, robot.n); end

I think the "sym()" function has changed in later versions of MATLAB. However, after examining these lines of code, I can't tell what the purpose is except to declare those entries as symbolic variables. However, just commenting out those lines in the source code solved my problem. It may be that MATLAB is handling symbolic variables overall in a better way so I don't need these lines anymore. However, if it breaks something else, I'd love to hear if someone else sees something I'm missing.

In previous mail: This tiny code snippet from below used to work in the toolbox last year, but doesn't seem to work any more:

syms q1 q2 q3

robot = SerialLink([Revolute('a', 0.4), Revolute('a', 0.4), Revolute('a', 0.4)]);
robot.jacob0([q1, q2, q3])

This snippet isn't particularly important, but being able to evaluate SerialLink functions symbolically was really nice. Any suggestions of what's happening?

joernmalzahn commented 6 years ago

Fixed in 0cf935e812c8596c0df3ca5690846becde758e09