Robotran Matlab Documentation

Direct dynamics

Time integration of the system direct dynamics.
For more information, see Robotran theoritical framework.

Code sample

For running the direct dynamics, insert the following code in your main script and adapt it to your need :

%% 5. Direct dynamics [mbs_exe_dirdyn]
%--------------------------------------------------------------------------
MBS_user.process = 'dirdyn';
mbs_data = mbs_set_qu(mbs_data,mbs_data_ini.qu); % Retrieving of the initial set of independent variables
opt.dirdyn = {'time',0:0.01:5,'motion','simulation',...
'odemethod','ode45','save2file','yes','framerate',1000,...
'renamefile','no','verbose','yes'};
% other options : 'visualize', 'save2file', 'depinteg', 'dtmax', 'dtinit',
% 'reltol', 'abstol', 'clearmbsglobal' % Help about options on www.robotran.be
[mbs_dirdyn,mbs_data] = mbs_exe_dirdyn(mbs_data,opt.dirdyn); % Direct dynamics process (time simulation)
% Graphical Results
figure(1);
plot(mbs_dirdyn.tsim,mbs_dirdyn.q(:,1)); % Joint motion time history : joint n° 1 motion (example)
pause;
close(1);

Use

The direct dynamics is performed by the function mbs_exe_dirdyn().

The user specifies the desired options of the direct dynamics in MBS_dirdyn_opt structure. The results are provided in the MBS_dirdyn structure.

The function calls successively :

See diagram below for more details :

direct dynamics function diagram
mbs_set_qu
function mbs_set_qu(in mbs_data, in qu)
count_struct::joint
count joint
number of joints
Definition: mbs_get_data.m:642
MBS_dirdyn_opt::motion
MBS_dirdyn opt motion
Determines how qdd and &lambda, frc and trq are computed.
Definition: mbs_new_dirdyn.m:78
mbs_exe_dirdyn
function mbs_exe_dirdyn(in mymbs_data, in options, in t)
MBS_dirdyn_opt::time
MBS_dirdyn opt time
Vector containing the initial time, the printing time interval and the final time of the simulation :...
Definition: mbs_new_dirdyn.m:72
MBS_dirdyn::opt
MBS_dirdyn opt
MBS_dirdyn_opt structure containing the direct dynamics options.
Definition: mbs_new_dirdyn.m:68