geez0x1 / CompliantJointToolbox

Compliant Joint Toolbox (CJT) for MATLAB and Simulink
GNU General Public License v3.0
38 stars 14 forks source link

Link dynamics incorporation #61

Closed VishnuDevA7 closed 6 years ago

VishnuDevA7 commented 6 years ago

While using any of the "locked_output" models from the library with the mechanical subsystem block, through the q_l_dot input, I am feeding the link velocity after a forward link dynamics operation. The user would naturally expect to see non-zero link position or velocity when the motor is moved (in this case, the link is not locked anymore, the link velocity is fed through the inputs). However, the link remains 'locked', contrary to one's expectation. This can be rightly implemented!

geez0x1 commented 6 years ago

I'm not sure what you're doing and why you're confused by the results you see. From what I understand you close the tau -> q_l_dot loop through a load admittance (say Y(s) = s q_l(s) / tau(s)), which is indeed its intended use. From what you've written I'm assuming you're then looking at the load velocity/position outputs on the jointBus of the actuator, which is correct.

Allow me to paste a bit of code from the output_fixed_rigid_gearbox model, specifically the feed-through matrix D:

    % Direct Feedthrough
    nIn     = size(B,2);
    nOut    = size(C,1);
    D       = zeros(nOut,nIn);
    D(6,2)  = 1;        % Link velocity
    D(7,2)  = -d_gl;    % Torque

As you can see this feed-forwards the secondary input (q_l_dot) directly to the 6th output, which is link velocity (as well as the damping term in the output torque for a series-elastic element with internal damping). For the link position, a simple integrating state computes the position q_l which becomes the 3rd output.

If you think you've perhaps found a bug, could you provide some more info and possibly the model/script you're using?

VishnuDevA7 commented 6 years ago

Oh yeah, I found a bug in my simulation. So, its not a bug with CJT. My bad, cheers!