Robotran C Documentation
mbs_euler_explicit.h
Go to the documentation of this file.
1 
15 #ifndef MBS_EULEREX_H_INCLUDED
16 #define MBS_EULEREX_H_INCLUDED
17 
18 #include "mbs_project_interface.h"
19 
20 #define P_INF_VALUE 0.143 // value tat was best for haptic piano, see ST
21 
25 typedef void(*euler_integrator_implementation)(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd);
26 
30 typedef struct MbsDirdynEulerEx
31 {
33  double *a_n;
34  double *a_n_1;
36 
37  int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *);
39  void (*loop_fct)(MbsData *, MbsDirdyn *);
41  int (*save_realtime_update)(MbsDirdyn* dd, MbsData* mbs_data);
43 
51 void initialize_eulerEx(MbsData *mbs_data, MbsDirdyn *mbs_dd,
52  int (*derivs)(double, double[], double[], MbsData *, MbsDirdyn *),
53  void (*loop_fct)(MbsData *, MbsDirdyn *),
54  int (*save_realtime_update)(MbsDirdyn* dd, MbsData* mbs_data));
55 
65 int loop_eulerEx(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd);
66 
72 void finish_eulerEx(MbsData *mbs_data, MbsDirdyn *mbs_dd);
73 
80 void euler_explicit(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd);
81 
82 
90 void eulaire(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd);
91 
104 void alpha_method(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd);
105 
113 void error_eulerEx(MbsData *mbs_data, MbsDirdyn *dd, int err);
114 
115 #endif // MBS_EULEREX_H_INCLUDED
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
mbs_msg
void mbs_msg(const char *msg,...)
Send a message.
Definition: mbs_message.c:87
alpha_method
void alpha_method(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Source code for a simplified alpha-method We call it AlphaM.
Definition: mbs_euler_explicit.c:179
MbsData::tsim
double tsim
The time value.
Definition: mbs_data.h:305
MbsDirdynEulerEx::derivs
int(* derivs)(double, double[], double[], MbsData *, MbsDirdyn *)
The function computing the derivative of the system.
Definition: mbs_euler_explicit.h:37
MbsDirdyn::y
double * y
Pointer to the state vector, this is a dvec_0 of size nState.
Definition: mbs_dirdyn_struct.h:175
MbsDirdyn::nState
int nState
size of the state vector
Definition: mbs_dirdyn_struct.h:174
euler_explicit
void euler_explicit(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Source code for the Euler Explicit integration.
Definition: mbs_euler_explicit.c:155
mbs_dirdyn_struct.h
MbsData::nqu
int nqu
Number of independent articulations.
Definition: mbs_data.h:262
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
MbsDirdynEulerEx::alpha_f
double alpha_f
Definition: mbs_euler_explicit.h:35
MbsDirdyn::yd
double * yd
Pointers to the derivative vector (dvec_0) of size nState.
Definition: mbs_dirdyn_struct.h:182
mbs_project_interface.h
Declaration of functions that are project dependent.
MbsDirdynEulerEx::loop_fct
void(* loop_fct)(MbsData *, MbsDirdyn *)
The function to be called at the end of each time step, or waypoints.
Definition: mbs_euler_explicit.h:39
error_eulerEx
void error_eulerEx(MbsData *mbs_data, MbsDirdyn *dd, int err)
If an error occurs during time integration, this function prints the error message and call finish_eu...
Definition: mbs_euler_explicit.c:145
P_INF_VALUE
#define P_INF_VALUE
Definition: mbs_euler_explicit.h:20
mbs_warning_msg
void mbs_warning_msg(const char *msg,...)
Send a warning message.
Definition: mbs_message.c:100
eulaire
void eulaire(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Source code for unknown integrator but based partially on euler explicit We call it Eulaire.
Definition: mbs_euler_explicit.c:167
AlphaM
@ AlphaM
Definition: integrator.h:29
mbs_1D_array.h
loop_eulerEx
int loop_eulerEx(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf.
Definition: mbs_euler_explicit.c:64
MbsDirdynEulerEx::alpha_m
double alpha_m
Definition: mbs_euler_explicit.h:35
MbsDirdyn::integrator_struct
void * integrator_struct
pointer to store integrator structure
Definition: mbs_dirdyn_struct.h:205
MbsDirdynEulerEx::save_realtime_update
int(* save_realtime_update)(MbsDirdyn *dd, MbsData *mbs_data)
Definition: mbs_euler_explicit.h:41
MbsDirdynOptions::dt0
double dt0
initial value of the integration step size, default = 0.001
Definition: mbs_dirdyn_struct.h:45
finish_eulerEx
void finish_eulerEx(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Finalize and clear memory allocated for Euler Explicit integrator.
Definition: mbs_euler_explicit.c:128
loop_eulerEx
int loop_eulerEx(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf.
Definition: mbs_euler_explicit.c:64
MbsDirdyn::tsim
double tsim
current simulation time
Definition: mbs_dirdyn_struct.h:171
MbsDirdynEulerEx::beta
double beta
Definition: mbs_euler_explicit.h:35
MbsDirdynEulerEx
Euler Explicit structure for dirdyn.
Definition: mbs_euler_explicit.h:30
MbsDirdynEulerEx::div_alpha_m
double div_alpha_m
internal parameters of the alpha-method
Definition: mbs_euler_explicit.h:35
initialize_eulerEx
void initialize_eulerEx(MbsData *mbs_data, MbsDirdyn *mbs_dd, int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *), void(*loop_fct)(MbsData *, MbsDirdyn *), int(*save_realtime_update)(MbsDirdyn *dd, MbsData *mbs_data))
Initialize all needed fields in MbsDirdyn for Euler Explicit integrator.
Definition: mbs_euler_explicit.c:23
euler_explicit
void euler_explicit(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Source code for the Euler Explicit integration.
Definition: mbs_euler_explicit.c:155
MbsDirdynEulerEx::gamma
double gamma
Definition: mbs_euler_explicit.h:35
finish_eulerEx
void finish_eulerEx(MbsData *mbs_data, MbsDirdyn *dd)
Finalize and clear memory allocated for Euler Explicit integrator.
Definition: mbs_euler_explicit.c:128
alpha_method
void alpha_method(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Source code for a simplified alpha-method We call it AlphaM.
Definition: mbs_euler_explicit.c:179
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_message.h
mbs_euler_explicit.h
This header defines global functions for Euler Explicit integrator in C.
MbsDirdynEulerEx::a_n_1
double * a_n_1
vector used for alpha-method to store current internal accelerations
Definition: mbs_euler_explicit.h:34
error_eulerEx
void error_eulerEx(MbsData *mbs_data, MbsDirdyn *dd, int err)
If an error occurs during time integration, this function prints the error message and call finish_eu...
Definition: mbs_euler_explicit.c:145
MbsDirdynEulerEx::choice_of_euler
euler_integrator_implementation choice_of_euler
to choose between Eulaire, Alpah method and Euler explicit
Definition: mbs_euler_explicit.h:32
MbsData
Definition: mbs_data.h:246
initialize_eulerEx
void initialize_eulerEx(MbsData *mbs_data, MbsDirdyn *mbs_dd, int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *), void(*loop_fct)(MbsData *, MbsDirdyn *), int(*save_realtime_update)(MbsDirdyn *dd, MbsData *mbs_data))
Initialize all needed fields in MbsDirdyn for Euler Explicit integrator.
Definition: mbs_euler_explicit.c:23
DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
#define DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
Definition: mbs_dirdyn_struct.h:32
Eulaire
@ Eulaire
Definition: integrator.h:29
integrator.h
This header defines specific integrators functions in C.
MbsDirdynOptions::integrator
int integrator
Set integrator to use, available value: RK4, Dopri5, Rosenbrock, EulerEx, Eulaire,...
Definition: mbs_dirdyn_struct.h:109
MbsData::flag_stop
int flag_stop
stop the simulation. For dirdyn, equil, invdyn and solvekin only.
Definition: mbs_data.h:397
copy_dvec_0
void copy_dvec_0(double *vec_src, double *vec_dest, int l_v)
Copy the content of a vector (of sizel_v) of doubles to a second vector, starting with index 0.
Definition: mbs_1D_array.c:981
free_dvec_0
void free_dvec_0(double *vec)
release memory for a vector of doubles, starting at index 0
Definition: mbs_1D_array.c:971
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
MbsDirdyn
General structure of the direct dynamic module.
Definition: mbs_dirdyn_struct.h:166
MbsDirdyn::dt
double dt
current integration step size
Definition: mbs_dirdyn_struct.h:172
MbsDirdyn::options
MbsDirdynOptions * options
structure defining the option of a direct dynamic
Definition: mbs_dirdyn_struct.h:168
MbsDirdynEulerEx::a_n
double * a_n
vector used for alpha-method to store previous internal accelerations
Definition: mbs_euler_explicit.h:33
eulaire
void eulaire(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Source code for unknown integrator but based partially on euler explicit We call it Eulaire.
Definition: mbs_euler_explicit.c:167
euler_integrator_implementation
void(* euler_integrator_implementation)(double h, MbsData *mbs_data, MbsDirdyn *mbs_dd)
This pointer is used to choose between the two implementations of euler.
Definition: mbs_euler_explicit.h:25