Robotran Matlab Documentation

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 :

%% 4. Kinematics [mbs_exe_solvekin]
%--------------------------------------------------------------------------
MBS_user.process = 'solvekin';
mbs_data = mbs_set_qdriven(mbs_data,mbs_data.qu); % Set all independent variables as driven
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
[mbs_solvekin,mbs_data] = mbs_exe_solvekin(mbs_data,opt.solvekin);
% Kinematics results (sensor kinematics example) [mbs_gensensor_$project_name$]
Joint_id = mbs_get_joint_id(mbs_info,{'joint3'});
mbs_data = mbs_set_qa(mbs_data,Joint_id); % Set variables [Joint_id] as actuated
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
mbs_set_qa
function mbs_set_qa(in mbs_data, in qa)
count_struct::joint
count joint
number of joints
Definition: mbs_get_data.m:642
my_cut::length
my_cut length
distance between the anchor points (=rod length) for cut of type 'rod'
Definition: missing_struct.m:148
MBS_dirdyn_opt::renamefile
MBS_dirdyn opt renamefile
Rename the result files.
Definition: mbs_new_dirdyn.m:123
mbs_get_joint_id
function mbs_get_joint_id(in mbs_info, in varargin)
mbs_set_qdriven
function mbs_set_qdriven(in mbs_data, in qdriven)
MBS_dirdyn::opt
MBS_dirdyn opt
MBS_dirdyn_opt structure containing the direct dynamics options.
Definition: mbs_new_dirdyn.m:68
count_struct::sensor
count sensor
number of kinematic sensor
Definition: mbs_get_data.m:664
mbs_exe_solvekin
function mbs_exe_solvekin(in mymbs_data, in options, in t)
count_struct::driven
count driven
Definition: mbs_get_data.m:644
actuated
MBS_info oint actuated
Definition: mbs_set_data.m:98