petercorke / robotics-toolbox-matlab

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

problem with SerialLink.rne #87

Open williamledda opened 4 years ago

williamledda commented 4 years ago

There might be an issue in computing the RNE after changing the payload.

Example:

1) Set my robot

>> bot = mybot()
>> q = [-1.6007, -1.7271, -2.203, -0.808, 1.5951, -0.031];
>> qd = zeros(1, 6);
>> qdd = zeros(1, 6);

2) Now I compute the inverse dynamic

>> bot.rne(q, qd, qdd)
ans =

   -0.0000   43.7711   30.9951    3.2651    0.0218         0

3) I set the payload to 5Kg and recompute the inverse dynamics

>> bot.payload(5.0, [0.0, 0.0, 0.5]);
>> bot.rne(q, qd, qdd)

ans =

    0.0000   69.6220   52.7389    7.6602    0.7439         0

4) I remove the payload and i have a different result respect to step 2

>> bot.payload(0)
>> bot.rne(q, qd, qdd)

ans =

   -0.0000   40.0525   27.8525    2.5556    0.0085         0
>> >> bot.payload(0.0, [0.0, 0.0, 0.0]);
>> 
>> bot.rne(q, qd, qdd)

ans =

   -0.0000   40.0525   27.8525    2.5556    0.0085         0

Am I doing something wrong? Why I have different results when changing payload and removing it afterwards?

I'm running the following versions of Matlab and robotics toolbox

MATLAB                                                Version 9.5         (R2018b)
Robotics Toolbox for MATLAB                           Version 10.3.1              
petercorke commented 4 years ago

this function is a bit lazy, have a look at the source, it clobbers the original link mass and cog rather than adding to it. Needs work, it's in the queue