Robotran C 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 :

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/* DIRECT DYNAMICS *
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
MbsDirdyn *mbs_dirdyn;
mbs_data->process = 3;
mbs_dirdyn = mbs_new_dirdyn(mbs_data);
// dirdyn options (see documentations for additional options)
mbs_dirdyn->options->dt0 = 1e-3;
mbs_dirdyn->options->tf = 10.0;
mbs_dirdyn->options->save2file = 1;
//mbs_dirdyn->options->realtime = 1;
mbs_run_dirdyn(mbs_dirdyn, mbs_data);
mbs_delete_dirdyn(mbs_dirdyn, mbs_data);

Use

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

The user specifies the desired options of the direct dynamics in MbsDirdynOptions structure. The results are provided in the MbsBuffer structure (par of the MBS_part structure) and written to files at the end of computation.

You should call successively :

mbs_new_dirdyn
MbsDirdyn * mbs_new_dirdyn(MbsData *mbs_data)
Create a new direct dynamic structure.
Definition: mbs_dirdyn.c:33
mbs_run_dirdyn
int mbs_run_dirdyn(MbsDirdyn *dd, MbsData *mbs_data)
Run the direct dynamic simulation.
Definition: mbs_dirdyn.c:203
mbs_delete_dirdyn
void mbs_delete_dirdyn(MbsDirdyn *dirdyn, MbsData *mbs_data)
Free memory of the direct dynamic structure The options (MbsDirdynOptions) and MbsAux structures are ...
Definition: mbs_dirdyn.c:188
MbsDirdynOptions::save2file
int save2file
Determine whether results are written to files on disk (in resultsR folder): 1: results are saved 0: ...
Definition: mbs_dirdyn_struct.h:51
MbsDirdynOptions::dt0
double dt0
initial value of the integration step size, default = 0.001
Definition: mbs_dirdyn_struct.h:45
MbsDirdynOptions::tf
double tf
final time of the simulation, default = 5.0
Definition: mbs_dirdyn_struct.h:43
MbsData::process
int process
Flag that indicate which module is currently running (1=partitioning, 2=equilibrium,...
Definition: mbs_data.h:297
MbsDirdyn
General structure of the direct dynamic module.
Definition: mbs_dirdyn_struct.h:144
MbsDirdyn::options
MbsDirdynOptions * options
structure defining the option of a direct dynamic
Definition: mbs_dirdyn_struct.h:146