Robotran C Documentation
mbs_dirdyn.h
Go to the documentation of this file.
1 
15 #ifndef MBS_DIRDYN_h
16 #define MBS_DIRDYN_h
17 
18 #include "mbs_dirdyn_struct.h"
19 #include "mbs_data.h"
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 
41 enum {
45  };
46 
61 MbsDirdyn* mbs_new_dirdyn(MbsData* mbs_data);
62 
79 MbsDirdyn* mbs_new_dirdyn_aux(MbsData* mbs_data, MbsAux* mbs_aux);
80 
91 int mbs_run_dirdyn(MbsDirdyn* dirdyn, MbsData* mbs_data);
92 
93 
98 int mbs_dirdyn_init(MbsDirdyn* dirdyn, MbsData* mbs_data);
99 
100 
113 int mbs_dirdyn_loop(MbsDirdyn* dirdyn, MbsData* mbs_data);
114 
115 
121 int mbs_dirdyn_finish(MbsDirdyn* dirdyn, MbsData* mbs_data);
122 
123 
129 void mbs_delete_dirdyn(MbsDirdyn* dirdyn, MbsData* mbs_data);
130 
141 #ifdef __cplusplus
142 }
143 #endif
144 
155 
163 int check_user_dirdyn_options(MbsDirdyn* dd, MbsData* mbs_data);
164 
173 int mbs_dirdyn_save(MbsDirdyn* dd, MbsData* mbs_data, double t);
174 
175 #endif
mbs_new_dirdyn
MbsDirdyn * mbs_new_dirdyn(MbsData *mbs_data)
Create a new direct dynamic structure.
Definition: mbs_dirdyn.c:42
MbsSolvekin::options
MbsInvOptions * options
Structure defining the option of a inverse kinematic analysis.
Definition: mbs_solvekin_struct.h:157
mbs_anim_close_geo
int mbs_anim_close_geo(MbsData *mbs_data, MbsAux *mbs_aux)
Generate the animation for failed Newton-Raphson procedure.
Definition: mbs_close_loops.c:118
MbsInvOptions::resfilename
char * resfilename
The keyword used for determining the name of result files.
Definition: mbs_solvekin_struct.h:94
BUFFER_QQ
@ BUFFER_QQ
Definition: mbs_buffer.h:21
mbs_run_dirdyn
int mbs_run_dirdyn(MbsDirdyn *dirdyn, MbsData *mbs_data)
Run the direct dynamic simulation.
Definition: mbs_dirdyn.c:221
mbs_dirdyn_write_buffers
int mbs_dirdyn_write_buffers(MbsDirdyn *dd)
Compute the derivatives of the system (1st derivatives to be given to the ODE integrator)
Definition: mbs_dirdyn.c:1155
MbsDirdynOptions::flag_precise_dynamics
int flag_precise_dynamics
= 1 to call the direct dynamics at the beginning of each time step of integration.
Definition: mbs_dirdyn_struct.h:118
MbsDirdyn::savePeriodCounter
int savePeriodCounter
counter for checking whether results must be saved
Definition: mbs_dirdyn_struct.h:198
mbs_call_link3D
int mbs_call_link3D(double **frc, double **trq, MbsData *s, double tsim)
Symbolic link 3D forces function declaration.
Definition: mbs_project_fct_ptr.c:40
BUFFER_LINK3D
@ BUFFER_LINK3D
Definition: mbs_buffer.h:23
MbsDirdynOptions::buffer_format
char * buffer_format
if NULL, "%e" is used. Can be for instance XXX->options->buffer_format = "%4.7f";....
Definition: mbs_dirdyn_struct.h:86
mbs_msg
void mbs_msg(const char *msg,...)
Send a message.
Definition: mbs_message.c:87
print_warnings_integrator
void print_warnings_integrator(MbsData *mbs_data, MbsDirdyn *mbs_dd, int type_of_integrator)
Check the options set by user to warn him when he modified an unused option for the integrator.
Definition: integrator.c:272
Simu_realtime::options
Realtime_option * options
user options
Definition: realtime.h:145
get_char_cpy
char * get_char_cpy(const char *fmt,...)
Copy the provided formatted string into a newly allocated memory.
Definition: useful_functions.c:196
MbsData::Ncons
int Ncons
Number of algebraic constraints.
Definition: mbs_data.h:317
Functions::mbs_invdynared_dqd
mbs_invdynared_d_ptr mbs_invdynared_dqd
Definition: mbs_data.h:81
BUFFER_LINK_F
@ BUFFER_LINK_F
Definition: mbs_buffer.h:22
MbsData::qd
double * qd
Array with the current values of the generalized velocities.
Definition: mbs_data.h:285
MbsData::qa
int * qa
Array with the indices of actuated articulations (only for inverse dynamic).
Definition: mbs_data.h:277
MbsData::dt0
double dt0
Initial value of the integration step size [s]. For dirdyn and invdyn only. This parameter is set fro...
Definition: mbs_data.h:309
MbsDirdynOptions::accelred
int accelred
1 to use accelred, 0 otherwise, default = 0
Definition: mbs_dirdyn_struct.h:90
check_user_dirdyn_options
int check_user_dirdyn_options(MbsDirdyn *dd, MbsData *mbs_data)
check that the dirdyn options performed by the user are correct
Definition: mbs_dirdyn.c:156
useful_functions.h
mbs_compute_sin_cos_qv
void mbs_compute_sin_cos_qv(MbsData *s, int *qrot_qv_indvec)
Compute the sine and cosine of the q_sin and q_cos, only for the rotational joints that are dependent...
Definition: mbs_trigo.c:80
mbs_dirdyn_finish
int mbs_dirdyn_finish(MbsDirdyn *dirdyn, MbsData *mbs_data)
Run the finalization operations of the run_dirdyn function.
Definition: mbs_dirdyn.c:1023
mbs_dirdyn.h
user_realtime_visu.h
user realtime visu prototype
MbsData::tsim
double tsim
The time value.
Definition: mbs_data.h:305
MbsData::nqrot
int nqrot
Number of rotational joint (R1, R2 or R3)
Definition: mbs_data.h:269
MbsData::Nlink3D
int Nlink3D
Number of 3D links.
Definition: mbs_data.h:337
user_call_dirdyn_finish
void user_call_dirdyn_finish(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Module redirection for user own dirdyn finish function, see user_dirdyn_finish().
Definition: mbs_project_fct_ptr.c:526
BUFFER_VISU
@ BUFFER_VISU
Definition: mbs_buffer.h:22
MbsDirdyn::y
double * y
Pointer to the state vector, this is a dvec_0 of size nState.
Definition: mbs_dirdyn_struct.h:175
user_call_realtime_visu
void user_call_realtime_visu(MbsData *mbs_data, int nb_models, int *nb_q, double **q_vec)
Redirection to the user-specified user function of realtime visualization.
Definition: mbs_project_fct_ptr.c:620
MbsData::nqv
int nqv
Number of dependent articulations.
Definition: mbs_data.h:267
MbsDirdynOptions::baumgarte_beta
double baumgarte_beta
beta parameter of baumgarte stabilization (>0), default = 0.1 (1/s)
Definition: mbs_dirdyn_struct.h:124
mbs_data.h
MbsData::qc
int * qc
Array with the indices of driven (locked and driven) articulations.
Definition: mbs_data.h:272
MbsDirdyn::nState
int nState
size of the state vector
Definition: mbs_dirdyn_struct.h:174
user_call_dirdyn_loop
void user_call_dirdyn_loop(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Module redirection for user own dirdyn loop function, see user_dirdyn_loop().
Definition: mbs_project_fct_ptr.c:520
mbs_dirdyn_struct.h
mbs_run_dirdyn
int mbs_run_dirdyn(MbsDirdyn *dd, MbsData *mbs_data)
Run the direct dynamic simulation.
Definition: mbs_dirdyn.c:221
BUFFER_UX
@ BUFFER_UX
Definition: mbs_buffer.h:21
MbsData::nqu
int nqu
Number of independent articulations.
Definition: mbs_data.h:262
mbs_error_msg
void mbs_error_msg(int err, const char *msg,...)
Send an error message.
Definition: mbs_message.c:131
get_dvec_0
double * get_dvec_0(int l_v)
create (with memory allocation) a vector (length l_v) of doubles, starting at index 0
Definition: mbs_1D_array.c:955
MbsDirdynOptions::dt_max
double dt_max
maximal time step [s], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:136
_MBS_ERR_LOW_FILES
#define _MBS_ERR_LOW_FILES
Low Level error number Error during opening/writing files = -9.
Definition: mbs_errors_names.h:157
MbsDirdyn::yd
double * yd
Pointers to the derivative vector (dvec_0) of size nState.
Definition: mbs_dirdyn_struct.h:182
RK4
@ RK4
Definition: integrator.h:29
lubksb
void lubksb(double **a, int n, int *indx, double b[])
Definition: lubksb.c:10
mbs_new_sensor
MbsSensor * mbs_new_sensor(struct MbsData *mbs_data)
Create a new MbsSensor structure, allocate and initialize the memory for all fields.
Definition: mbs_sensor_utilities.c:57
DIRDYN_INTEGRATOR_OPTION_DEFAULT_dt_max
#define DIRDYN_INTEGRATOR_OPTION_DEFAULT_dt_max
Definition: mbs_dirdyn_struct.h:31
MbsData::njoint
int njoint
Number of joints in the system.
Definition: mbs_data.h:259
mbs_project_interface.h
Declaration of functions that are project dependent.
mbs_buffer_write
int mbs_buffer_write(MbsBuffer *b)
Write the content of the buffer to disk.
Definition: mbs_buffer.c:389
MbsDirdynOptions::nmax
int nmax
maximal number of steps [-], default = 1e9
Definition: mbs_dirdyn_struct.h:132
MbsData::tf
double tf
Final time of the simulation [s]. For dirdyn and invdyn only. This parameter is set from dirdyn/invyn...
Definition: mbs_data.h:308
mbs_call_cons_jdqd
int mbs_call_cons_jdqd(double *Jdqd, MbsData *s, double tsim)
Symbolic jdqd function declaration.
Definition: mbs_project_fct_ptr.c:105
mbs_define.h
_MBS_ERR_MID_UXD
#define _MBS_ERR_MID_UXD
Mid Level error number Related to uxd, i.e.
Definition: mbs_errors_names.h:82
DIRDYN_INTEGRATOR_OPTION_DEFAULT_atoler
#define DIRDYN_INTEGRATOR_OPTION_DEFAULT_atoler
Definition: mbs_dirdyn_struct.h:30
BUFFER_LAMBDA
@ BUFFER_LAMBDA
Definition: mbs_buffer.h:23
check_user_dirdyn_options
int check_user_dirdyn_options(MbsDirdyn *dd, MbsData *mbs_data)
check that the dirdyn options performed by the user are correct
Definition: mbs_dirdyn.c:156
mbs_realtime_update
void mbs_realtime_update(Simu_realtime *realtime, double tsim)
update save vectors for past investigations (graphs and Java visualization)
Definition: realtime.c:112
user_call_JointForces
double * user_call_JointForces(MbsData *s, double tsim)
Module redirection for user joint force function, see user_JointForces().
Definition: mbs_project_fct_ptr.c:202
free_set_output
void free_set_output()
release memory of auto_output
Definition: set_output.c:117
MbsSolvekin
General structure of the inverse kinematics module.
Definition: mbs_solvekin_struct.h:153
BUFFER_QD
@ BUFFER_QD
Definition: mbs_buffer.h:21
MbsDirdyn::yout
double * yout
Allocation of a vector (dvec_0) of size nState.
Definition: mbs_dirdyn_struct.h:177
BUFFER_QC
@ BUFFER_QC
Definition: mbs_buffer.h:22
mbs_fct_dirdyn
int mbs_fct_dirdyn(double tsim, double y[], double dydt[], MbsData *s, MbsDirdyn *dd)
direct dynamics derivative computation
Definition: mbs_dirdyn.c:1169
mbs_buffer_save
int mbs_buffer_save(MbsBuffer *b, double t, double *x)
Save the given array to the specified buffer with the specified time.
Definition: mbs_buffer.c:254
BUFFER_LINK_Z
@ BUFFER_LINK_Z
Definition: mbs_buffer.h:22
DIRDYN_INTEGRATOR_OPTION_DEFAULT_toler
#define DIRDYN_INTEGRATOR_OPTION_DEFAULT_toler
Definition: mbs_dirdyn_struct.h:28
MbsDirdynOptions::compute_Qc
int * compute_Qc
If options-flag_compute_Qc is set to 0, the vector allows to compute only the needed Qc.
Definition: mbs_dirdyn_struct.h:102
mbs_call_link
int mbs_call_link(double **frc, double **trq, double *Flnk, double *Z, double *Zd, MbsData *s, double tsim)
Symbolic link forces function declaration.
Definition: mbs_project_fct_ptr.c:29
mbs_warning_msg
void mbs_warning_msg(const char *msg,...)
Send a warning message.
Definition: mbs_message.c:100
MbsData::Nux
int Nux
Number of user variable.
Definition: mbs_data.h:387
copy_dvec_1
void copy_dvec_1(double *vec_src, double *vec_dest)
Copy the content of a vector (of size specified in vec_src[0]) of doubles to a second vector,...
Definition: mbs_1D_array.c:991
_MBS_ERR_MOD_DIRDYN
#define _MBS_ERR_MOD_DIRDYN
Module error number module: Direct Dynamics = -400.
Definition: mbs_errors_names.h:58
mbs_growing_buffer_write
int mbs_growing_buffer_write(MbsGrowingBuffer *b)
write the content of the growing buffer to disk
Definition: mbs_buffer.c:599
MbsData::zero_division_thrs
double zero_division_thrs
Value from which a warning is raised if a division by zero (or close to) occurs. Default=1....
Definition: mbs_data.h:407
Simu_realtime::simu_quit
int simu_quit
1 to quit the simulation, 0 otherwise
Definition: realtime.h:102
ludcmp
int ludcmp(double **a, int n, int *indx, double *d)
LU decomposition of a matrix with index starting at 1.
Definition: ludcmp.c:19
set_output_to_mbs
int set_output_to_mbs(MbsData *mbs_data, int verbosity)
Set the address of this buffers in MbsData to expose memory + synchronize verbosity.
Definition: set_output.c:26
BUFFER_QDD
@ BUFFER_QDD
Definition: mbs_buffer.h:21
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:206
COMPUTE_ALL_QC
@ COMPUTE_ALL_QC
Definition: mbs_dirdyn.h:42
mbs_new_dirdyn_aux
MbsDirdyn * mbs_new_dirdyn_aux(MbsData *mbs_data, MbsAux *mbs_aux)
Create MbsDirdyn strucure and fill it with auxiliary structure.
Definition: mbs_dirdyn.c:54
_MBS_ERR_LOW_NAN
#define _MBS_ERR_LOW_NAN
Low Level error number Number is NaN (not a number) = -7.
Definition: mbs_errors_names.h:147
MbsInvOptions::motion
int motion
Determines how the evolution of q, qd qdd are provided.
Definition: mbs_solvekin_struct.h:40
mbs_1D_array.h
MbsInvOptions::framerate
int framerate
Number of frame per second for the .anim file, default = 1000.
Definition: mbs_solvekin_struct.h:113
MbsData::flag_optim_symb_sin_cos
int flag_optim_symb_sin_cos
allow the "optimisation" of the computation of the sine/cosine in the symbolic files....
Definition: mbs_data.h:295
MbsDirdyn::bufferNb
int bufferNb
Number of buffer required to save the current system topology (ie. coordinates, links....
Definition: mbs_dirdyn_struct.h:193
_MBS_ERR_INIT
#define _MBS_ERR_INIT
Generic error number Check user options at initialization = -10.
Definition: mbs_errors_names.h:166
MBSfun.h
mbs_close_kin
void mbs_close_kin(MbsData *s, MbsAux *mbs_aux)
compute the dependent velocities that solves the constraints.
Definition: mbs_close_loops.c:146
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
MbsDirdyn::integrator_struct
void * integrator_struct
pointer to store integrator structure
Definition: mbs_dirdyn_struct.h:205
DIRDYN_INTEGRATOR_OPTION_DEFAULT_rtoler
#define DIRDYN_INTEGRATOR_OPTION_DEFAULT_rtoler
Definition: mbs_dirdyn_struct.h:29
mbs_check_nhu_nqv
int mbs_check_nhu_nqv(MbsData *mbs_data)
Check the coherence between the number of (independant) constraints and the number of dependant varia...
Definition: mbs_check.c:20
MbsDirdynOptions::saveperiod
int saveperiod
The number of time steps between two buffer records default: 1 (every time step are recorded)
Definition: mbs_dirdyn_struct.h:74
MbsDirdyn::finish_integrator
finish_integrator_ptr finish_integrator
pointer to integrator closing function
Definition: mbs_dirdyn_struct.h:211
MbsData::hu
int * hu
Array with the indices of independent constraints.
Definition: mbs_data.h:280
mbs_dirname
char * mbs_dirname(const char *path, int verbose)
mbs_dirname returns the leading part of the path (UNIX and MAC).
Definition: mbs_path.c:407
MbsDirdynOptions::dt0
double dt0
initial value of the integration step size, default = 0.001
Definition: mbs_dirdyn_struct.h:45
MbsData::Nxfrc
int Nxfrc
Number of points where an external force is applied into a body.
Definition: mbs_data.h:362
BUFFER_OTHER
@ BUFFER_OTHER
Definition: mbs_buffer.h:23
get_ivec_1
int * get_ivec_1(int l_v)
create (with memory allocation) a vector (length l_v) of integers, starting at index 1
Definition: mbs_1D_array.c:479
mbs_realtime_loop
int mbs_realtime_loop(Simu_realtime *realtime, double tsim)
one loop iteration of the real-time process
Definition: realtime.c:138
norminf_vector_1
double norminf_vector_1(double *v, int n)
Compute the maximum of a vector.
Definition: norm.c:38
MbsDirdynOptions::resfilename
char * resfilename
The keyword used for determining the name of result files Default: 'dirdyn', or 'oneshot' in case the...
Definition: mbs_dirdyn_struct.h:54
MbsData::Nlink
int Nlink
Number of forces acting between two points of the system (force law implemented in user_LinkForces())...
Definition: mbs_data.h:336
copy_ivec_1
void copy_ivec_1(int *vec_src, int *vec_dest, int l_v)
Copy the content of a vector (of size l_v) of integers to a second vector, starting with index 1.
Definition: mbs_1D_array.c:510
BUFFER_Q
@ BUFFER_Q
Definition: mbs_buffer.h:21
MbsDirdyn::tsim
double tsim
current simulation time
Definition: mbs_dirdyn_struct.h:171
BUFFER_UXD
@ BUFFER_UXD
Definition: mbs_buffer.h:21
mbs_solvekin.h
mbs_dirdyn_save
int mbs_dirdyn_save(MbsDirdyn *dd, MbsData *mbs_data, double t)
save the dirdyn results through the buffer
Definition: mbs_dirdyn.c:281
COMPUTE_CUSTOM_QC
@ COMPUTE_CUSTOM_QC
Definition: mbs_dirdyn.h:44
user_call_cons_jdqd
int user_call_cons_jdqd(double *jdqd, MbsData *s, double tsim)
Module redirection for jdqd term of the user-specified constraints, see user_cons_jdqd() however the ...
Definition: mbs_project_fct_ptr.c:280
MbsData::flag_safety_checks
int flag_safety_checks
Flag to activate safety checks everywhere in mbsysc core. Faster computation if this flag is put to 0...
Definition: mbs_data.h:406
COMPUTE_NO_QC
@ COMPUTE_NO_QC
Definition: mbs_dirdyn.h:43
user_call_dirdyn_init
void user_call_dirdyn_init(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Module redirection for user own dirdyn initialization function, see user_dirdyn_init().
Definition: mbs_project_fct_ptr.c:514
MbsDirdyn::user_buffer
MbsGrowingBuffer * user_buffer
growing buffer to store user values
Definition: mbs_dirdyn_struct.h:191
MbsBuffer
Definition: mbs_buffer.h:46
MbsDirdynOptions::respath
char * respath
Path in which result file are saved.
Definition: mbs_dirdyn_struct.h:58
Simu_realtime::ext
Realtime_extern * ext
external variables
Definition: realtime.h:143
mbs_growing_buffer_save
int mbs_growing_buffer_save(MbsGrowingBuffer *b, double t)
Save the given values of auto_output to the specified buffer with the specified time.
Definition: mbs_buffer.c:295
mbs_delete_buffer
void mbs_delete_buffer(MbsBuffer *b)
Free memory of the specified MbsBuffer.
Definition: mbs_buffer.c:206
MbsDirdynOptions::flag_compute_Qc
int flag_compute_Qc
choose to compute (or not) the Qc for driven variables.
Definition: mbs_dirdyn_struct.h:97
MbsData::MAX_NR_ITER
int MAX_NR_ITER
Maximal number of iterations for NR procedure, default 100.
Definition: mbs_data.h:320
MbsData::Nuserc
int Nuserc
Number of user constraints.
Definition: mbs_data.h:318
mbs_dirdyn_init
int mbs_dirdyn_init(MbsDirdyn *dirdyn, MbsData *mbs_data)
Run the startup operations of the run_dirdyn function.
Definition: mbs_dirdyn.c:341
mbs_delete_growing_buffer
void mbs_delete_growing_buffer(MbsGrowingBuffer *b)
release memory for growing buffer
Definition: mbs_buffer.c:230
MbsData::Fl
double * Fl
Array with the current values of the forces on each link (see: user_LinkForces()).
Definition: mbs_data.h:340
MbsData::qu
int * qu
Array with the indices of the independent articulations (free)
Definition: mbs_data.h:271
Realtime_option::nb_models
int nb_models
number of models to load
Definition: realtime.h:77
MbsData::NRerr
double NRerr
Maximal error on constraint allowed in Newton-Raphson algorithm, default 1.0e-9.
Definition: mbs_data.h:319
MbsDirdynOptions::tf
double tf
final time of the simulation, default = 5.0
Definition: mbs_dirdyn_struct.h:43
MbsDirdynOptions::save_visu
int save_visu
1 to save the visualizazion file (as it appears in 'user_realtime_visu.c'), 0 otherwise (only valid i...
Definition: mbs_dirdyn_struct.h:67
MbsDirdynOptions::flag_symbolic_jacobian
int flag_symbolic_jacobian
1 to use symbolic computation of the jacobian. Only used with implicit integrators....
Definition: mbs_dirdyn_struct.h:141
MbsData::trq
double ** trq
Matrix with the components of the resultant external torques (pure torque and couple produced by forc...
Definition: mbs_data.h:300
MbsDirdynOptions::show_failed_closure
int show_failed_closure
1 to generate animation of the failed Newton-Raphson procedure, default = 0.
Definition: mbs_dirdyn_struct.h:144
MbsData::qv
int * qv
Array with the indices of the dependent articulations .
Definition: mbs_data.h:279
MbsData::Qc
double * Qc
Array with the value of joint force introduced in driven joint to respect the user function.
Definition: mbs_data.h:332
MbsData::Nloopc
int Nloopc
Number of loop constraints.
Definition: mbs_data.h:316
BUFFER_LINK_ZD
@ BUFFER_LINK_ZD
Definition: mbs_buffer.h:22
MbsDirdynOptions::buffersize
int buffersize
The number of time step that can be recorded in the buffer.
Definition: mbs_dirdyn_struct.h:85
MbsDirdynOptions::compute_all_uxd
int compute_all_uxd
choose to compute (or not) the user derivative during dirdyn time integration. For dirdyn only....
Definition: mbs_dirdyn_struct.h:100
MbsDirdynOptions::baumgarte_alpha
double baumgarte_alpha
alpha parameter of baumgarte stabilization (>0), default = 0.1 (1/s)
Definition: mbs_dirdyn_struct.h:123
freeMbsAux
void freeMbsAux(MbsAux *mbs_aux, MbsData *s)
Definition: mbs_aux.c:174
MbsData::Zd
double * Zd
Array with the current values of the speed (spreading) between of the points of a link (see: user_Lin...
Definition: mbs_data.h:339
mbs_call_cons_hJ
int mbs_call_cons_hJ(double *h, double **Jac, MbsData *s, double tsim)
Symbolic constraints function declaration.
Definition: mbs_project_fct_ptr.c:94
MbsDirdynOptions::n_freeze
int n_freeze
number of time step when the jacobian is freezed (computed once at the start of the n_freeze time ste...
Definition: mbs_dirdyn_struct.h:140
MbsData::Qq
double * Qq
Array with the values of the joint forces.
Definition: mbs_data.h:301
MbsData::q
double * q
Array with the current values of the generalized coordinates.
Definition: mbs_data.h:284
MbsInvOptions::verbose
int verbose
Gives informations during the process.
Definition: mbs_solvekin_struct.h:147
free_dvec_1
void free_dvec_1(double *vec)
release memory for a vector of doubles, starting at index 1
Definition: mbs_1D_array.c:976
MbsDirdynOptions::framerate
int framerate
number of frame per second for the .anim file, default = 1000
Definition: mbs_dirdyn_struct.h:69
MbsData::project_path
char * project_path
Path to the mbs project folder.
Definition: mbs_data.h:411
mbs_init_sin_cos_q_vecs
int mbs_init_sin_cos_q_vecs(MbsData *s, int *qrot_qu_indvec, int *qrot_qc_indvec, int *qrot_qv_indvec)
Initialize the three vectors of indices (they are usually contained in the mbs_aux structure)
Definition: mbs_trigo.c:23
mbs_call_accelred
int mbs_call_accelred(MbsData *s, double tsim)
Symbolic reduced acceleration function declaration.
Definition: mbs_project_fct_ptr.c:62
MbsDirdynOptions::toler
double toler
mixed error tolerances [-], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:133
mbs_realtime_init
int mbs_realtime_init(MbsData *mbs_data, double t0, double tf, double dt0)
initialize the real-time structures
Definition: realtime.c:60
mbs_calc_jdqd
int mbs_calc_jdqd(MbsData *s, MbsAux *mbs_aux)
compute the quadratic term of the constraints at acceleration level:
Definition: mbs_close_loops.c:236
mbs_check_mbs_data_values
int mbs_check_mbs_data_values(MbsAux *module_mbs_aux, MbsData *mbs_data)
Check the coherence between the mbs_data used before module initialization and module run.
Definition: mbs_check.c:88
mbs_trigo.h
This header defines the functions for trigonometric handling in MBsysC integrator in C.
mbs_sensor.h
MbsDirdynOptions::flag_oneshot
int flag_oneshot
1 to compute the derivative function only once (no time integration !), default = 0 The time is the v...
Definition: mbs_dirdyn_struct.h:92
MbsData::fct
Functions fct
Structure to store the pointer to the project-specific functions.
Definition: mbs_data.h:414
nrfct.h
mbs_call_extforces
int mbs_call_extforces(double **frc, double **trq, MbsData *s, double tsim)
Symbolic external forces function declaration.
Definition: mbs_project_fct_ptr.c:51
mbs_comp_LUdcmp_mJv
int mbs_comp_LUdcmp_mJv(MbsData *s, MbsAux *mbs_aux)
compute and update (!) the mJv matrix, decomposing it to the LU format mbs_aux->mJv[i][j] = -mbs_aux-...
Definition: mbs_close_loops.c:25
init_sensor
void init_sensor(MbsSensor *psens, int njoint)
Initialize all fields of MbsSensor structure to 0.
Definition: mbs_sensor_utilities.c:25
MbsData::frc
double ** frc
Matrix with the components of the resultant external forces (in the body fixed frame) applied to the ...
Definition: mbs_data.h:299
mbs_new_growing_buffer
MbsGrowingBuffer * mbs_new_growing_buffer(int max_nx, int size, const char *respath)
create a new growing buffer for the user inputs to save
Definition: mbs_buffer.c:144
mbs_dirdyn_finish
int mbs_dirdyn_finish(MbsDirdyn *dd, MbsData *mbs_data)
Run the finalization operations of the run_dirdyn function.
Definition: mbs_dirdyn.c:1023
MbsDirdyn::buffer_visu
MbsBuffer ** buffer_visu
buffer used to save the visualization as it appears in 'user_realtime_visu.c'
Definition: mbs_dirdyn_struct.h:188
mbs_calc_force
int mbs_calc_force(MbsData *s)
compute the force and torques applied on the multibody system.
Definition: mbs_calc_force.c:16
MbsDirdynOptions::save_anim
int save_anim
1 to save the anim file, 0 otherwise (only valid if 'save2file' is set to 1), default = 1
Definition: mbs_dirdyn_struct.h:65
save_realtime_update
int save_realtime_update(MbsDirdyn *dd, MbsData *mbs_data)
update the real-time and saving modules if requested
Definition: mbs_dirdyn.c:1252
mbs_dirdyn_save
int mbs_dirdyn_save(MbsDirdyn *dd, MbsData *mbs_data, double t)
save the dirdyn results through the buffer
Definition: mbs_dirdyn.c:281
MbsData::nqc
int nqc
Number of driven articulations, it includes qlocked and qdriven.
Definition: mbs_data.h:263
MbsData::l3DWr
double ** l3DWr
Definition: mbs_data.h:342
set_output.h
set_output function called by the user to output his own variables
mbs_message.h
MbsData::realtime
void * realtime
Pointer to Simu_realtime structure.
Definition: mbs_data.h:418
mbs_close_geo
int mbs_close_geo(MbsData *s, MbsAux *mbs_aux)
compute a position of the multibody system which solves the constraints
Definition: mbs_close_loops.c:43
Realtime_option::flag_visu
int flag_visu
1 if Java visualization features activated, 0 otherwise
Definition: realtime.h:75
mbs_dirdyn_loop
int mbs_dirdyn_loop(MbsDirdyn *dd, MbsData *mbs_data)
Time loop of the run_dirdyn function:
Definition: mbs_dirdyn.c:974
MbsDirdynOptions::max_save_user
int max_save_user
The maximal number of user variables saved default: 12.
Definition: mbs_dirdyn_struct.h:79
initMbsAux
MbsAux * initMbsAux(MbsData *s)
Definition: mbs_aux.c:18
get_ivec_0
int * get_ivec_0(int l_v)
create (with memory allocation) a vector (length l_v) of integers, starting at index 0
Definition: mbs_1D_array.c:474
MbsData
Definition: mbs_data.h:246
user_call_Derivative
int user_call_Derivative(MbsData *s)
Module redirection for the time derivative of the user state variables, see user_Derivative() however...
Definition: mbs_project_fct_ptr.c:248
realtime.h
Real-time constraints main header.
user_call_cons_hJ
int user_call_cons_hJ(double *h, double **Jac, MbsData *s, double tsim)
Module redirection for user joint force function, see user_cons_hJ() however the return differs.
Definition: mbs_project_fct_ptr.c:269
DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
#define DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
Definition: mbs_dirdyn_struct.h:32
MbsDirdynOptions::rtoler
double rtoler
relative error tolerances [-], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:134
MbsDirdyn::mbs_aux
MbsAux * mbs_aux
Definition: mbs_dirdyn_struct.h:169
Simu_realtime
real-time structure
Definition: realtime.h:99
MbsDirdynOptions::flag_baumgarte_stabilization
int flag_baumgarte_stabilization
1 if user wants baumgarte stabilization of the independant accelerations
Definition: mbs_dirdyn_struct.h:122
MbsDirdynOptions
Structure defining the option of a direct dynamic.
Definition: mbs_dirdyn_struct.h:38
mbs_run_solvekin
int mbs_run_solvekin(MbsSolvekin *sk, MbsData *mbs_data)
Run the inverse kinematic analysis.
Definition: mbs_solvekin.c:105
_MBS_ERR_MOD_SPEC_11
#define _MBS_ERR_MOD_SPEC_11
Mid Level error number Module specific errors range from -11 to -19 please read the error message...
Definition: mbs_errors_names.h:172
MBS_VERBOSE_WARNING
#define MBS_VERBOSE_WARNING
Definition: mbs_define.h:45
MbsData::Qa
double * Qa
Array of active joint forces (in case of simulink,invdyna,equil,linearization,...)
Definition: mbs_data.h:302
MbsDirdynOptions::t0
double t0
initial time of the simulation, default = 0.0
Definition: mbs_dirdyn_struct.h:41
set_integrator
void set_integrator(MbsDirdyn *mbs_dd)
Set the function pointer in MbsDirdyn.
Definition: integrator.c:173
get_output_vector_size
int get_output_vector_size(int index)
get the output vector size corresponding to the requested index
Definition: set_output.c:315
dirdynared
int dirdynared(MbsAux *mbs_aux, MbsData *s)
Compute the joint accelerations of the system in the current configuration.
Definition: mbs_dirdynared.c:26
MbsData::t0
double t0
Initial time of the simulation [s]. For dirdyn and invdyn only. This parameter is set from dirdyn/inv...
Definition: mbs_data.h:307
integrator.h
This header defines specific integrators functions in C.
get_output_vector_nb
int get_output_vector_nb()
get the number of user vector inputs
Definition: set_output.c:333
MbsDirdyn::initialize_integrator
initialize_integrator_ptr initialize_integrator
pointer to integrator initialize function
Definition: mbs_dirdyn_struct.h:207
mbs_realtime_finish
int mbs_realtime_finish(Simu_realtime *realtime)
release memory used for the real-time related functions
Definition: realtime.c:306
MbsDirdynOptions::integrator
int integrator
Set integrator to use, available value: RK4, Dopri5, Rosenbrock, EulerEx, Eulaire,...
Definition: mbs_dirdyn_struct.h:109
DIRDYN_INTEGRATOR_OPTION_DEFAULT_nmax
#define DIRDYN_INTEGRATOR_OPTION_DEFAULT_nmax
Define of default options for integrator in DirdynStruc.
Definition: mbs_dirdyn_struct.h:27
free_ivec_1
void free_ivec_1(int *vec)
release memory for a vector of integers, starting with index 1
Definition: mbs_1D_array.c:495
init_set_output
void init_set_output(int max_nb_curves)
initialize the static auto_output structure
Definition: set_output.c:84
mbs_dirdyn_write_buffers
int mbs_dirdyn_write_buffers(MbsDirdyn *dd)
Compute the derivatives of the system (1st derivatives to be given to the ODE integrator)
Definition: mbs_dirdyn.c:1155
MbsData::Z
double * Z
Array with the current values of the distances between of the points of a link (see: user_LinkForces(...
Definition: mbs_data.h:338
mbs_calc_hJ
int mbs_calc_hJ(MbsData *s, MbsAux *mbs_aux)
compute the current value of the constraints ( ) and the constraint Jacobian matrix ( ).
Definition: mbs_close_loops.c:194
MbsData::flag_stop
int flag_stop
stop the simulation. For dirdyn, equil, invdyn and solvekin only.
Definition: mbs_data.h:397
get_dvec_1
double * get_dvec_1(int l_v)
create (with memory allocation) a vector (length l_v) of doubles, starting at index 1
Definition: mbs_1D_array.c:960
mbs_path.h
MbsDirdynOptions::verbose
int verbose
Verbosity level propagated to other compatible module:
Definition: mbs_dirdyn_struct.h:111
free_dmat_1
void free_dmat_1(double **mat)
release memory for a matrix of doubles, starting at index 1
Definition: mbs_matrix.c:340
MbsDirdynOptions::delta_t_wp
double delta_t_wp
time interval between two waypoints [s], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:129
MbsDirdynOptions::realtime
int realtime
1 to activate to real-time features, 0 to deactivate them, default = 0
Definition: mbs_dirdyn_struct.h:88
MBS_INFO_SUCCESS
#define MBS_INFO_SUCCESS
Definition: mbs_define.h:29
MbsDirdynOptions::flag_solout_wp
int flag_solout_wp
1 to call solout only at required waypoints (only if flag_waypoint activated), default = 0
Definition: mbs_dirdyn_struct.h:128
slct_dvec_1
void slct_dvec_1(double *vec_src, int *vec_ind_src, int l_v, double *vec_dest)
fill the third vector by slicing the first vector of doubles at the indexes specified in the second (...
Definition: mbs_1D_array.c:1323
MbsData::lambda
double * lambda
Array with the values of the Lagrange Multipliers related to the constraints.
Definition: mbs_data.h:321
Functions::symb
struct Functions::@4 symb
get_dmat_1
double ** get_dmat_1(int nb_r, int nb_c)
create (with memory allocation) a [nb_r times nb_c] matrix of doubles, starting at index 1
Definition: mbs_matrix.c:294
MbsData::uxd
double * uxd
Array with the values of the time derivatives of the user variables.
Definition: mbs_data.h:385
mbs_dirdyn_init
int mbs_dirdyn_init(MbsDirdyn *dd, MbsData *mbs_data)
Run the startup operations of the run_dirdyn function.
Definition: mbs_dirdyn.c:341
reset_flag_output
void reset_flag_output()
reset the flag_output to 0. Useful when running several simulation in a row with different save2file ...
Definition: set_output.c:76
MbsDirdyn::buffers
MbsBuffer ** buffers
buffer to store generalized coordinates, velocities, acceleration, joint forces...
Definition: mbs_dirdyn_struct.h:185
MbsDirdynOptions::atoler
double atoler
absolute error tolerances [-], default = 1.0e-6
Definition: mbs_dirdyn_struct.h:135
MbsDirdyn
General structure of the direct dynamic module.
Definition: mbs_dirdyn_struct.h:166
mbs_dirdyn_loop
int mbs_dirdyn_loop(MbsDirdyn *dirdyn, MbsData *mbs_data)
Time loop of the run_dirdyn function:
Definition: mbs_dirdyn.c:974
MbsDirdynOptions::flag_waypoint
int flag_waypoint
1 to use waypoints, 0 otherwise, default =0
Definition: mbs_dirdyn_struct.h:127
MbsDirdyn::dt
double dt
current integration step size
Definition: mbs_dirdyn_struct.h:172
mbs_new_solvekin
MbsSolvekin * mbs_new_solvekin(MbsData *mbs_data)
Create a new inverse kinematic structure.
Definition: mbs_solvekin.c:33
MbsData::nqa
int nqa
Number of actuated articulations.
Definition: mbs_data.h:266
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:206
mbs_new_dirdyn_aux
MbsDirdyn * mbs_new_dirdyn_aux(MbsData *mbs_data, MbsAux *mbs_aux)
Create MbsDirdyn strucure and fill it with auxiliary structure.
Definition: mbs_dirdyn.c:54
mbs_step_close_geo
int mbs_step_close_geo(MbsData *s, MbsAux *mbs_aux)
compute an iteration of the position of the multibody system to solve the constraints
Definition: mbs_close_loops.c:81
MbsData::qdd
double * qdd
Array with the current values of the generalized acceleration.
Definition: mbs_data.h:286
get_output_vector_label
char * get_output_vector_label(int index)
get the output vector label corresponding to the requested index
Definition: set_output.c:304
mbs_delete_solvekin
void mbs_delete_solvekin(MbsSolvekin *solvekin, MbsData *mbs_data)
Free memory of the inverse kinematic structure The options (MbsInvOptions) and MbsAux structures are ...
Definition: mbs_solvekin.c:89
mbs_check.h
mbs_new_buffer
MbsBuffer * mbs_new_buffer(char *filename, char *anim_name, int nx, int size, int id, char *buf_format, int save_anim, int save_visu, double anim_period)
Allocate and initialize a MbsBuffer structure.
Definition: mbs_buffer.c:27
mbs_makedirs
int mbs_makedirs(char *path)
Create (recursively) the specified directory.
Definition: mbs_path.c:586
MbsDirdyn::loop_integrator
loop_integrator_ptr loop_integrator
pointer to integrator looping function
Definition: mbs_dirdyn_struct.h:209
MbsDirdyn::options
MbsDirdynOptions * options
structure defining the option of a direct dynamic
Definition: mbs_dirdyn_struct.h:168
MbsDirdynOptions::flag_stop_stiff
int flag_stop_stiff
1 to stop integration if it become stiff, 0 (default value) otherwise, default = 0
Definition: mbs_dirdyn_struct.h:117
mbs_delete_sensor
void mbs_delete_sensor(MbsSensor *psens)
Free the memory of MbsSensor structure. and its contents.
Definition: mbs_sensor_utilities.c:64
MbsData::ux
double * ux
Array with the values of the user variables.
Definition: mbs_data.h:384
MbsSolvekin::mbs_aux
MbsAux * mbs_aux
Structure to store auxiliary value needed during computation.
Definition: mbs_solvekin_struct.h:160
mbs_new_dirdyn
MbsDirdyn * mbs_new_dirdyn(MbsData *mbs_data)
Create a new direct dynamic structure.
Definition: mbs_dirdyn.c:42
Functions::mbs_invdynared_dq
mbs_invdynared_d_ptr mbs_invdynared_dq
Definition: mbs_data.h:80
mbs_aux.h
MbsDirdynOptions::animpath
char * animpath
Path in which anim file is saved.
Definition: mbs_dirdyn_struct.h:63
MbsData::nhu
int nhu
Number of independent constraints.
Definition: mbs_data.h:268
_MBS_ERR_MID_CLOSE_GEO
#define _MBS_ERR_MID_CLOSE_GEO
Mid Level error number Related to the closing geometry, i.e.
Definition: mbs_errors_names.h:87
MBS_VERBOSE_ALL
#define MBS_VERBOSE_ALL
Definition: mbs_define.h:46
MbsDirdyn::savedArrays
double ** savedArrays
pointer to the array that must be saved to buffers
Definition: mbs_dirdyn_struct.h:195
get_output_vector_ptr
double * get_output_vector_ptr(int index)
get the pointer to the output vector at the requested index
Definition: set_output.c:352
mbs_errors_names.h
closeloop
@ closeloop
Definition: mbs_solvekin_struct.h:25
mbs_realtime_reset
void mbs_realtime_reset()
reset the realtime structures and flag. Useful in case we want to run several simulations in a row in...
Definition: realtime.c:43