Direct dynamics analysis
========================
.. container:: c-code
.. highlight:: c
Introduction
------------
This tutorial introduces additional features of the Direct Dynamics
module in Robotran.
For the basics use of direct dynamics, see the Pendulum-Spring tutorial
`Getting Started `__.
.. container:: c-code
The programming language in this tutorial is **C**.
All the detailed informations is given in the `MBsysC
documentation `__.
However, this tutorial gives some insights on some specific options.
.. rubric:: Time integration
:name: time-integration-1
.. rubric:: Integrator type
:name: integrator-type-1
MBsysC comes with different integrators (RK4, Dopri5…). The selection
of the integrator is done by setting
``mbs_dirdyn->options->integrator`` to the wanted value. The list of
the available integrators is in the `MBsysC
documentation `__.
Some are implicit, multi-step, etc. See their headers for more
information (like the `Rosenbrock
header `__).
.. code:: c
//...
int main(int argc, char const *argv[])
{
//...
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/* Direct Dynamics *
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
// dirdyn options (see documentations for additional options)
mbs_dirdyn->options->integrator = "RK4";
//...
}
Other options have to follow the same syntax as above.
REMARK:
By default, the integrator is Runge Kutta with 4 steps
.. rubric:: Integrators parameters
:name: integrators-parameters-1
Depending on the integrators, various parameters can be chosen
(``toler``, ``dt_max``, …). See `MBsysC
documentation `__.
.. rubric:: Force the integrator to pass at specific time values
:name: force-the-integrator-to-pass-at-specific-time-values-1
If you need an adaptive integrator to pass at some fixed time stepped
value (for example for a synchronization), you can activate the
``flag_waypoint`` in the *MbsDirdynOptions* structure. Then the step
size is defined in the ``delta_t_wp`` field. ..
.. rubric:: Stiff systems
:name: stiff-systems-1
It is also possible to perform numerical stabilization based on
`Baumgarte method `__
at the velocities and accelerations levels. See
``flag_baumgarte_stabilization`` and ``baumgarte_alpha``
``baumgarte_beta`` options.
.. rubric:: Jacobian calculation
:name: jacobian-calculation-1
For the implicit integrators, option ``n_freeze`` may stop the
computation and compute it only each ``n_freeze``\ time. For example,
if ``n_freeze = 1``, the Jacobian will be computed every two time
steps.
Besides, the flag ``flag_ongoing_jac_computation`` says when the
integrator is computing the Jacobian (==1) or when an internal step
is processed (==0). It allows to separate calculation between the two
situations. For example, if a FSM is used, it could be better not to
change the FSM state during the Jacobian computation.
.. rubric:: Animation
:name: animation-1
Various options are available for customizing the animations saving
(see ``resfilename``, ``respath``, ``save_anim``, …).
.. rubric:: Various
:name: various-1
To make the computation time smaller, several flags allow to prevent
Robotran from computing useless values.
- ``flag_compute_Qc`` and ``compute_Qc``: computation of the driven
joint Lagrange multipliers
- ``compute_all_uxd``: computation of the user derivative