Robotran C Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mbs_custom.h
Go to the documentation of this file.
1 
13  #ifndef MBS_CUSTOM_H_INCLUDED
14 #define MBS_CUSTOM_H_INCLUDED
15 
16 #include "mbs_project_interface.h"
17 
21 typedef struct MbsDirdynCustom
22 {
23  double *yt2;
24 
25  int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *);
27  void (*loop_fct)(MbsData *, MbsDirdyn *);
29  int (*save_realtime_update)(MbsDirdyn* dd, MbsData* mbs_data);
31 
39 void initialize_custom(MbsData *mbs_data, MbsDirdyn *mbs_dd,
40  int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *),
41  void (*loop_fct)(MbsData *, MbsDirdyn *),
42  int (*save_realtime_update)(MbsDirdyn* dd, MbsData* mbs_data));
43 
53 int loop_custom(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd);
54 
60 void finish_custom(MbsData *mbs_data, MbsDirdyn *mbs_dd);
61 
62 
70 void error_custom(MbsData *mbs_data, MbsDirdyn *dd, int err);
71 
72 #endif // MBS_CUSTOM_H_INCLUDED
error_custom
void error_custom(MbsData *mbs_data, MbsDirdyn *dd, int err)
If an error occurs during time integration, this function prints the error message and call finish_cu...
Definition: mbs_custom.c:132
MbsDirdynCustom::loop_fct
void(* loop_fct)(MbsData *, MbsDirdyn *)
The function to be called at the end of each time step, or waypoints.
Definition: mbs_custom.h:27
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:162
mbs_msg
void mbs_msg(const char *msg,...)
Send a message.
Definition: mbs_message.c:87
MbsData::tsim
double tsim
The time value.
Definition: mbs_data.h:306
MbsDirdyn::y
double * y
Pointer to the state vector, this is a dvec_0 of size nState.
Definition: mbs_dirdyn_struct.h:219
MbsDirdyn::nState
int nState
size of the state vector
Definition: mbs_dirdyn_struct.h:218
MbsDirdynCustom::derivs
int(* derivs)(double, double[], double[], MbsData *, MbsDirdyn *)
The function computing the derivative of the system.
Definition: mbs_custom.h:25
mbs_dirdyn_struct.h
loop_custom
int loop_custom(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf with a custom integrator implemented by the user.
Definition: mbs_custom.c:45
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:1055
finish_custom
void finish_custom(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Finalize and clear memory allocated for Custom integrator.
Definition: mbs_custom.c:122
MbsDirdyn::yd
double * yd
Pointers to the derivative vector (dvec_0) of size nState.
Definition: mbs_dirdyn_struct.h:226
mbs_project_interface.h
Declaration of functions that are project dependent.
MbsDirdyn::yout
double * yout
Allocation of a vector (dvec_0) of size nState.
Definition: mbs_dirdyn_struct.h:221
mbs_warning_msg
void mbs_warning_msg(const char *msg,...)
Send a warning message.
Definition: mbs_message.c:100
mbs_1D_array.h
MbsDirdyn::integrator_struct
void * integrator_struct
pointer to store integrator structure
Definition: mbs_dirdyn_struct.h:262
loop_custom
int loop_custom(double t0, double tf, MbsData *mbs_data, MbsDirdyn *mbs_dd)
Integrate the motion from t0 to tf with a custom integrator implemented by the user.
Definition: mbs_custom.c:45
MbsDirdyn::tsim
double tsim
current simulation time
Definition: mbs_dirdyn_struct.h:215
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:1451
mbs_message.h
initialize_custom
void initialize_custom(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 Custom integrator.
Definition: mbs_custom.c:24
ThetaSC
int ThetaSC(double y[], double dydx[], int n, double x, double h, double yout[], int(*derivs)(double, double[], double[], MbsData *, MbsDirdyn *), MbsData *s, MbsDirdyn *dd)
Unknown integrator.
Definition: thetaSC.c:25
MbsData
Definition: mbs_data.h:247
DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
#define DIRDYN_INTEGRATOR_WAYPOINT_TIME_ERROR_max
Definition: mbs_dirdyn_struct.h:32
MbsDirdynCustom::yt2
double * yt2
allocated state vector
Definition: mbs_custom.h:23
error_custom
void error_custom(MbsData *mbs_data, MbsDirdyn *dd, int err)
If an error occurs during time integration, this function prints the error message and call finish_cu...
Definition: mbs_custom.c:132
integrator.h
This header defines specific integrators functions in C.
MbsData::flag_stop
int flag_stop
stop the simulation in case of non zero value. Negative for error, positive for user_wanted behavior.
Definition: mbs_data.h:409
mbs_custom.h
This header defines global functions for custom integrator in C. Advanced user can modify this file.
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:172
MbsDirdyn
General structure of the direct dynamic module.
Definition: mbs_dirdyn_struct.h:210
MbsDirdynCustom::save_realtime_update
int(* save_realtime_update)(MbsDirdyn *dd, MbsData *mbs_data)
Definition: mbs_custom.h:29
initialize_custom
void initialize_custom(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 Custom integrator.
Definition: mbs_custom.c:24
MbsDirdyn::options
MbsDirdynOptions * options
structure defining the option of a direct dynamic
Definition: mbs_dirdyn_struct.h:212
finish_custom
void finish_custom(MbsData *mbs_data, MbsDirdyn *mbs_dd)
Finalize and clear memory allocated for Custom integrator.
Definition: mbs_custom.c:122
MbsDirdynCustom
Custom integrator structure for dirdyn.
Definition: mbs_custom.h:21