Loop and Inverse Kinematics
Computation of loop kinematics and of the system inverse kinematics.
For more information, see Robotran theoritical framework.
Code sample
For running the kinematics, insert the following code in your main script and adapt it to your need :
%--------------------------------------------------------------------------
MBS_user.process = 'solvekin';
opt.solvekin = {
'motion',
'trajectory',
'time',0:0.01:5,
'verbose',
'yes',
'framerate',1000};
% other options :
'visualize',
'save2file',
renamefile', clearmbsglobal' % Help about options on www.robotran.be
% Kinematics results (
sensor kinematics example) [mbs_gensensor_$project_name$]
gen_sens = [];
for i=1:
length(mbs_solvekin.tsim) % Kinematics of the
generic sensor located on
joint 'joint3'
t = mbs_solvekin.tsim(i);
s.q = mbs_solvekin.q(i,:)';
s.qd = mbs_solvekin.qd(i,:)';
s.qdd = mbs_solvekin.qdd(i,:)';
[sens] = mbs_gensensor_$project_name$(s,t,[],Joint_id); % Sensor kinematics process (generic sensor on joint 'joint3')
gen_sens = [gen_sens; t sens.P(1) sens.P(2) sens.V(1)]; % - position: sens.P(i); velocity: sens.V(i); acceleration: sens.A(i)
% - rotation matrix: sens.R(i,j); angular velocity: sens.OM(i)
% - angular acceleration: sens.OMP(i); Jacobian matrix: sens.J(m,n)
end
% Graphical Results
figure(1);
plot(mbs_solvekin.tsim,mbs_solvekin.q(:,Joint_id)); % Joint motion time history : joint 'joint3' motion (example)
figure(2);
plot(gen_sens(:,1), gens_sens(:,2)); % Sensor motion time history : sensor 'joint3' - x motion (example)
pause;
close(1); close(2);
clear gen_sens sens;
Use
The inverse kinematics is performed by the function mbs_exe_solvekin() and by the generic sensors.
- Todo:
: provide more explanation about the sensor symbolic function
: change the template code (Paul)
The user specifies the desired options of the inverse kinematics in MBS_solvekin_opt structure. The results is provided in the MBS_solvekin structure.
The functions mbs_exe_solvekin() calls succesively
See diagram below for more details :
inverse kinematics function diagram