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 
166 int mbs_fct_dirdyn(double t, double y[], double dydt[], MbsData *s, MbsDirdyn *dd);
167 
175 int save_realtime_update(MbsDirdyn* dd, MbsData* mbs_data);
176 
177 
185 int check_user_dirdyn_options(MbsDirdyn* dd, MbsData* mbs_data);
186 
187 #endif
mbs_new_dirdyn
MbsDirdyn * mbs_new_dirdyn(MbsData *mbs_data)
Create a new direct dynamic structure.
Definition: mbs_dirdyn.c:33
MbsSolvekin::options
MbsInvOptions * options
Structure defining the option of a inverse kinematic analysis.
Definition: mbs_solvekin_struct.h:153
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:112
MbsInvOptions::resfilename
char * resfilename
The keyword used for determining the name of result files.
Definition: mbs_solvekin_struct.h:94
COMPUTE_NO_QC
@ COMPUTE_NO_QC
Definition: mbs_dirdyn.h:43
mbs_run_dirdyn
int mbs_run_dirdyn(MbsDirdyn *dirdyn, MbsData *mbs_data)
Run the direct dynamic simulation.
Definition: mbs_dirdyn.c:203
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:1053
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:112
MbsDirdyn::savePeriodCounter
int savePeriodCounter
counter for checking whether results must be saved
Definition: mbs_dirdyn_struct.h:176
BUFFER_OTHER
@ BUFFER_OTHER
Definition: mbs_buffer.h:23
BUFFER_QC
@ BUFFER_QC
Definition: mbs_buffer.h:22
MbsDirdynOptions::buffer_format
char * buffer_format
Definition: mbs_dirdyn_struct.h:86
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:250
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:191
MbsData::Ncons
int Ncons
Number of algebraic constraints.
Definition: mbs_data.h:218
MbsData::qd
double * qd
Array with the current values of the generalized velocities.
Definition: mbs_data.h:188
MbsData::qa
int * qa
Array with the indices of actuated articulations (only for inverse dynamic).
Definition: mbs_data.h:180
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:212
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:146
BUFFER_LINK_ZD
@ BUFFER_LINK_ZD
Definition: mbs_buffer.h:22
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:922
mbs_dirdyn.h
user_realtime_visu.h
user realtime visu prototype
MbsData::tsim
double tsim
The time value.
Definition: mbs_data.h:208
MbsData::nqrot
int nqrot
Number of rotational joint (R1, R2 or R3)
Definition: mbs_data.h:172
MbsData::Nlink3D
int Nlink3D
Number of 3D links.
Definition: mbs_data.h:238
MbsDirdyn::y
double * y
Pointer to the state vector, this is a dvec_0 of size nState.
Definition: mbs_dirdyn_struct.h:153
COMPUTE_CUSTOM_QC
@ COMPUTE_CUSTOM_QC
Definition: mbs_dirdyn.h:44
user_dirdyn_finish
void user_dirdyn_finish(MbsData *mbs_data, MbsDirdyn *mbs_dd)
user own finishing functions
Definition: user_dirdyn.c:59
mbs_error_msg
void mbs_error_msg(char *msg,...)
Send an error message.
Definition: mbs_message.c:102
MbsData::nqv
int nqv
Number of dependent articulations.
Definition: mbs_data.h:170
MbsDirdynOptions::baumgarte_beta
double baumgarte_beta
beta parameter of baumgarte stabilization (>0), default = 0.1 (1/s)
Definition: mbs_dirdyn_struct.h:118
mbs_data.h
MbsData::qc
int * qc
Array with the indices of driven (locked and driven) articulations.
Definition: mbs_data.h:175
BUFFER_QQ
@ BUFFER_QQ
Definition: mbs_buffer.h:21
MbsDirdyn::nState
int nState
size of the state vector
Definition: mbs_dirdyn_struct.h:152
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:203
MbsData::nqu
int nqu
Number of independent articulations.
Definition: mbs_data.h:165
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:880
MbsDirdynOptions::dt_max
double dt_max
maximal time step [s], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:130
_MBS_ERR_LOW_FILES
#define _MBS_ERR_LOW_FILES
Low Level error number Error during opening/writing files = -9.
Definition: mbs_errors_names.h:147
BUFFER_LINK_F
@ BUFFER_LINK_F
Definition: mbs_buffer.h:22
MbsDirdyn::yd
double * yd
Pointers to the derivative vector (dvec_0) of size nState.
Definition: mbs_dirdyn_struct.h:160
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:50
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:162
mbs_project_interface.h
mbs_buffer_write
int mbs_buffer_write(MbsBuffer *b)
Write the content of the buffer to disk.
Definition: mbs_buffer.c:347
BUFFER_LINK_Z
@ BUFFER_LINK_Z
Definition: mbs_buffer.h:22
MbsDirdynOptions::nmax
int nmax
maximal number of steps [-], default = 1e9
Definition: mbs_dirdyn_struct.h:126
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:211
_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
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:146
closeloop
@ closeloop
Definition: mbs_solvekin_struct.h:25
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:113
free_set_output
void free_set_output()
release memory of auto_output
Definition: set_output.c:56
MbsSolvekin
General structure of the inverse kinematics module.
Definition: mbs_solvekin_struct.h:149
MbsDirdyn::yout
double * yout
Allocation of a vector (dvec_0) of size nState.
Definition: mbs_dirdyn_struct.h:155
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:1067
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:212
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:101
MbsData::Nux
int Nux
Number of user variable.
Definition: mbs_data.h:288
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:916
_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:557
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:308
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
BUFFER_Q
@ BUFFER_Q
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:188
mbs_cons_jdqd
void mbs_cons_jdqd(double *Jdqd, MbsData *s, double tsim)
Definition: mbs_project_fct_ptr.c:52
user_Derivative
void user_Derivative(MbsData *mbs_data)
Definition: user_Derivative.c:15
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:45
_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:142
MbsInvOptions::motion
int motion
Determines how the evolution of q, qd qdd are provided.
Definition: mbs_solvekin_struct.h:40
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:198
MbsDirdyn::bufferNb
int bufferNb
Number of buffer required to save the current system topology (ie. coordinates, links....
Definition: mbs_dirdyn_struct.h:171
_MBS_ERR_INIT
#define _MBS_ERR_INIT
Generic error number Check user options at initialization = -10.
Definition: mbs_errors_names.h:156
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:140
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:183
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:19
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:189
MbsData::hu
int * hu
Array with the indices of independent constraints.
Definition: mbs_data.h:183
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:263
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:404
norminf_vector
double norminf_vector(double *v, int n)
Definition: norm.c:22
mbs_realtime_loop
int mbs_realtime_loop(Simu_realtime *realtime, double tsim)
one loop iteration of the real-time process
Definition: realtime.c:139
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:237
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:435
MbsDirdyn::tsim
double tsim
current simulation time
Definition: mbs_dirdyn_struct.h:149
user_cons_jdqd
void user_cons_jdqd(double *jdqd, MbsData *mbs_data, double tsim)
Definition: user_cons_jdqd.c:15
mbs_solvekin.h
mbs_dirdyn_save
int mbs_dirdyn_save(MbsDirdyn *dd, MbsData *mbs_data, double t)
Definition: mbs_dirdyn.c:251
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:307
mbs_msg
void mbs_msg(char *msg,...)
Send a message.
Definition: mbs_message.c:76
MbsDirdyn::user_buffer
MbsGrowingBuffer * user_buffer
growing buffer to store user values
Definition: mbs_dirdyn_struct.h:169
MbsBuffer
Definition: mbs_buffer.h:46
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:253
mbs_delete_buffer
void mbs_delete_buffer(MbsBuffer *b)
Free memory of the specified MbsBuffer.
Definition: mbs_buffer.c:164
MbsDirdynOptions::flag_compute_Qc
int flag_compute_Qc
choose to compute (or not) the Qc for driven variables.
Definition: mbs_dirdyn_struct.h:96
mbs_accelred
int mbs_accelred(MbsData *s, double tsim)
Definition: mbs_project_fct_ptr.c:36
MbsData::MAX_NR_ITER
int MAX_NR_ITER
Maximal number of iterations for NR procedure, default 100.
Definition: mbs_data.h:221
MbsData::Nuserc
int Nuserc
Number of user constraints.
Definition: mbs_data.h:219
user_JointForces
double * user_JointForces(MbsData *mbs_data, double tsim)
Compute the user-specified joint force in all joint.
Definition: user_JointForces.c:17
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:307
mbs_delete_growing_buffer
void mbs_delete_growing_buffer(MbsGrowingBuffer *b)
release memory for growing buffer
Definition: mbs_buffer.c:188
MbsData::Fl
double * Fl
Array with the current values of the forces on each link (see: user_LinkForces()).
Definition: mbs_data.h:241
MbsData::qu
int * qu
Array with the indices of the independent articulations (free)
Definition: mbs_data.h:174
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:220
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
MbsData::trq
double ** trq
Matrix with the components of the resultant external torques (pure torque and couple produced by forc...
Definition: mbs_data.h:203
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:137
MbsData::qv
int * qv
Array with the indices of the dependent articulations .
Definition: mbs_data.h:182
mbs_cons_hJ
void mbs_cons_hJ(double *h, double **Jac, MbsData *s, double tsim)
Definition: mbs_project_fct_ptr.c:48
MbsData::Qc
double * Qc
Array with the value of joint force introduced in driven joint to respect the user function.
Definition: mbs_data.h:233
MbsData::Nloopc
int Nloopc
Number of loop constraints.
Definition: mbs_data.h:217
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:99
BUFFER_UXD
@ BUFFER_UXD
Definition: mbs_buffer.h:21
MbsDirdynOptions::baumgarte_alpha
double baumgarte_alpha
alpha parameter of baumgarte stabilization (>0), default = 0.1 (1/s)
Definition: mbs_dirdyn_struct.h:117
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:240
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:1146
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:134
MbsData::Qq
double * Qq
Array with the values of the joint forces.
Definition: mbs_data.h:204
BUFFER_UX
@ BUFFER_UX
Definition: mbs_buffer.h:21
MbsData::q
double * q
Array with the current values of the generalized coordinates.
Definition: mbs_data.h:187
MbsInvOptions::verbose
int verbose
Gives informations during the process.
Definition: mbs_solvekin_struct.h:143
BUFFER_LAMBDA
@ BUFFER_LAMBDA
Definition: mbs_buffer.h:23
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:901
BUFFER_QD
@ BUFFER_QD
Definition: mbs_buffer.h:21
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:312
BUFFER_VISU
@ BUFFER_VISU
Definition: mbs_buffer.h:22
BUFFER_LINK3D
@ BUFFER_LINK3D
Definition: mbs_buffer.h:23
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
MbsDirdynOptions::toler
double toler
mixed error tolerances [-], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:127
mbs_realtime_init
int mbs_realtime_init(MbsData *mbs_data, double t0, double tf, double dt0)
initialize the real-time structures
Definition: realtime.c:61
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:87
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
nrfct.h
norm_vector
double norm_vector(double *v, int n)
Definition: norm.c:12
user_cons_hJ
void user_cons_hJ(double *h, double **Jac, MbsData *mbs_data, double tsim)
Definition: user_cons_hJ.c:15
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
mbs_fct_dirdyn
int mbs_fct_dirdyn(double t, double y[], double dydt[], MbsData *s, MbsDirdyn *dd)
direct dynamics derivative computation
Definition: mbs_dirdyn.c:1067
init_sensor
void init_sensor(MbsSensor *psens, int njoint)
Initialize all fields of MbsSensor structure to 0.
Definition: mbs_sensor_utilities.c:22
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:202
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:120
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:922
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:166
mbs_calc_force
int mbs_calc_force(MbsData *s)
compute the force and torques applied on the multibody system.
Definition: mbs_calc_force.c:13
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:1146
MbsData::nqc
int nqc
Number of driven articulations, it includes qlocked and qdriven.
Definition: mbs_data.h:166
MbsData::l3DWr
double ** l3DWr
Definition: mbs_data.h:243
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:322
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:873
mbs_calc_jdqd
void mbs_calc_jdqd(MbsData *s, MbsAux *mbs_aux)
compute the quadratic term of the constraints at acceleration level:
Definition: mbs_close_loops.c:216
mbs_extforces
void mbs_extforces(double **frc, double **trq, MbsData *s, double tsim)
Definition: mbs_project_fct_ptr.c:32
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:399
MbsData
Definition: mbs_data.h:149
realtime.h
Real-time constraints main header.
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:128
mbs_calc_hJ
void 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:188
MbsDirdyn::mbs_aux
MbsAux * mbs_aux
Definition: mbs_dirdyn_struct.h:147
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:116
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:101
_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:162
MbsData::Qa
double * Qa
Array of active joint forces (in case of simulink,invdyna,equil,linearization,...)
Definition: mbs_data.h:205
MbsDirdynOptions::respath
const char * respath
Path in which result file are saved.
Definition: mbs_dirdyn_struct.h:58
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:151
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:222
dirdynared
int dirdynared(MbsAux *mbs_aux, MbsData *s)
Definition: mbs_dirdynared.c:25
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:210
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:240
MbsDirdyn::initialize_integrator
initialize_integrator_ptr initialize_integrator
pointer to integrator initialize function
Definition: mbs_dirdyn_struct.h:185
mbs_realtime_finish
int mbs_realtime_finish(Simu_realtime *realtime)
release memory used for the real-time related functions
Definition: realtime.c:307
MbsDirdynOptions::integrator
int integrator
Set integrator to use, available value: RK4, Dopri5, Rosenbrock, EulerEx, Eulaire,...
Definition: mbs_dirdyn_struct.h:108
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:420
init_set_output
void init_set_output(int max_nb_curves)
initialize the static auto_output structure
Definition: set_output.c:23
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:1053
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:239
MbsData::flag_stop
int flag_stop
stop the simulation. For dirdyn, equil, invdyn and solvekin only.
Definition: mbs_data.h:298
mbs_link
void mbs_link(double **frc, double **trq, double *Flnk, double *Z, double *Zd, MbsData *s, double tsim)
Definition: mbs_project_fct_ptr.c:24
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:885
BUFFER_QDD
@ BUFFER_QDD
Definition: mbs_buffer.h:21
MbsDirdynOptions::verbose
int verbose
1 to get print indications related to time adaptive integrator, 0 otherwise, default = 1
Definition: mbs_dirdyn_struct.h:110
MbsDirdynOptions::animpath
const char * animpath
Path in which anim file is saved.
Definition: mbs_dirdyn_struct.h:63
free_dmat_1
void free_dmat_1(double **mat)
release memory for a matrix of doubles, starting at index 1
Definition: mbs_matrix.c:301
MbsDirdynOptions::delta_t_wp
double delta_t_wp
time interval between two waypoints [s], default = 1.0e-3
Definition: mbs_dirdyn_struct.h:123
COMPUTE_ALL_QC
@ COMPUTE_ALL_QC
Definition: mbs_dirdyn.h:42
MbsDirdynOptions::realtime
int realtime
1 to activate to real-time features, 0 to deactivate them, default = 0
Definition: mbs_dirdyn_struct.h:88
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:122
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:1248
MbsData::lambda
double * lambda
Array with the values of the Lagrange Multipliers related to the constraints.
Definition: mbs_data.h:222
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:255
MbsData::uxd
double * uxd
Array with the values of the time derivatives of the user variables.
Definition: mbs_data.h:286
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:307
RK4
@ RK4
Definition: integrator.h:29
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:15
MbsDirdyn::buffers
MbsBuffer ** buffers
buffer to store generalized coordinates, velocities, acceleration, joint forces...
Definition: mbs_dirdyn_struct.h:163
MbsDirdynOptions::atoler
double atoler
absolute error tolerances [-], default = 1.0e-6
Definition: mbs_dirdyn_struct.h:129
MbsDirdyn
General structure of the direct dynamic module.
Definition: mbs_dirdyn_struct.h:144
mbs_dirdyn_loop
int mbs_dirdyn_loop(MbsDirdyn *dirdyn, MbsData *mbs_data)
Time loop of the run_dirdyn function:
Definition: mbs_dirdyn.c:873
MbsDirdynOptions::flag_waypoint
int flag_waypoint
1 to use waypoints, 0 otherwise, default =0
Definition: mbs_dirdyn_struct.h:121
MbsDirdyn::dt
double dt
current integration step size
Definition: mbs_dirdyn_struct.h:150
mbs_new_solvekin
MbsSolvekin * mbs_new_solvekin(MbsData *mbs_data)
Create a new inverse kinematic structure.
Definition: mbs_solvekin.c:29
mbs_link3D
void mbs_link3D(double **frc, double **trq, MbsData *s, double tsim)
Definition: mbs_project_fct_ptr.c:28
MbsData::nqa
int nqa
Number of actuated articulations.
Definition: mbs_data.h:169
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
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:45
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:189
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:211
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:85
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
MbsDirdyn::loop_integrator
loop_integrator_ptr loop_integrator
pointer to integrator looping function
Definition: mbs_dirdyn_struct.h:187
MbsDirdyn::options
MbsDirdynOptions * options
structure defining the option of a direct dynamic
Definition: mbs_dirdyn_struct.h:146
user_dirdyn_init
void user_dirdyn_init(MbsData *mbs_data, MbsDirdyn *mbs_dd)
user own initialization functions
Definition: user_dirdyn.c:28
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:111
mbs_delete_sensor
void mbs_delete_sensor(MbsSensor *psens)
Free the memory of MbsSensor structure. and its contents.
Definition: mbs_sensor_utilities.c:57
MbsData::ux
double * ux
Array with the values of the user variables.
Definition: mbs_data.h:285
MbsSolvekin::mbs_aux
MbsAux * mbs_aux
Structure to store auxiliary value needed during computation.
Definition: mbs_solvekin_struct.h:156
mbs_warning_msg
void mbs_warning_msg(char *msg,...)
Send a warning message.
Definition: mbs_message.c:89
mbs_new_dirdyn
MbsDirdyn * mbs_new_dirdyn(MbsData *mbs_data)
Create a new direct dynamic structure.
Definition: mbs_dirdyn.c:33
mbs_aux.h
MbsData::nhu
int nhu
Number of independent constraints.
Definition: mbs_data.h:171
_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
MbsDirdyn::savedArrays
double ** savedArrays
pointer to the array that must be saved to buffers
Definition: mbs_dirdyn_struct.h:173
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:259
mbs_errors_names.h
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:44