Robotran C Documentation
mbs_json.h
Go to the documentation of this file.
1 
10 #ifndef MBS_JSON_h
11 #define MBS_JSON_h
12 
13 #include "json.h"
14 #include "mbs_data.h"
15 
25 
33 int count_json_elements(JsonNode* node);
34 
51 JsonNode *find_element_with_key(JsonNode *list, char *key_name, char *key_value,
52  int *err);
53 
71 int mbs_json_double(JsonNode *node, double *val_ptr, char *key, int read_write,
72  int allow_missing);
73 
85 int mbs_json_get_double(JsonNode* node, double *val_ptr);
86 
98 int mbs_json_set_double(JsonNode *node, double value);
99 
118 int mbs_json_string(JsonNode *node, char **str_ptr, const char *key, int mission,
119  int allow_missing);
120 
132 int mbs_json_cmp_string(JsonNode *node, char *string);
133 
144 int mbs_json_get_string(JsonNode *node, char **str_ptr);
145 
156 int mbs_json_set_string(JsonNode *node, const char *string);
157 
181 int mbs_json_array(JsonNode *node, double **tab_ptr, int *size, const char *key,
182  int mission, int allow_missing);
207 int mbs_json_array_3(JsonNode *node, double **tab, const char *key,
208  int mission, int allow_missing);
209 
225 JsonNode* mbs_json_add_array(JsonNode *root_node, double *array, int size,
226  const char *key, int *err);
227 
245 int mbs_json_tab(JsonNode *node, double ***tab_ptr, int size_1, int size_2, const char *key, int mission);
246 
264 int mbs_json_bool(JsonNode *node, int *val_ptr, char *key, int mission, int allow_missing);
265 
280 int mbs_json_get_bool(JsonNode* node, int *val_ptr);
281 
293 int mbs_json_set_bool(JsonNode *node, int value);
294 
312 int mbs_json_int(JsonNode *node, int *val_ptr, char *key, int read_write, int allow_missing);
313 
325 int mbs_json_get_int(JsonNode* node, int *val_ptr);
326 
338 int mbs_json_set_int(JsonNode *node, int value);
339 
361 JsonNode *mbs_json_save_mbs(MbsData *mbs_data, char *filename, int flag_q, int flag_qd,
362  int flag_qdd, int flag_mass, int *err);
363 
364 JsonNode* load_and_create_json(const char* mbs_json_filename, int* err);
365 
379 int json_save(const char *filepath, JsonNode *node, int verbosity, int *err);
380 #endif
MbsData::qrot
int * qrot
Array with the indices of the rotational articulations (incremental values)
Definition: mbs_data.h:342
find_element_with_key
JsonNode * find_element_with_key(JsonNode *list, char *key_name, char *key_value, int *err)
Find the element (JSON_OBJECT) of the list whith the key matching the string.
Definition: mbs_json.c:48
re_copy_dvec_0
double * re_copy_dvec_0(double *src, int s_nx, double *dest, int d_nx)
Copy an array of double into another, reallocate the destination if required.
Definition: mbs_1D_array.c:1438
mbs_print_diff_dvec_1
static void mbs_print_diff_dvec_1(const char *prefix, double *v1, double *v2, int size)
Definition: mbs_data.c:19
MBS_INFO_UPDATER
#define MBS_INFO_UPDATER
Definition: mbs_define.h:24
json_mkobject
JsonNode * json_mkobject(void)
Definition: json.c:531
dpt_absolute_to_dvec3
double * dpt_absolute_to_dvec3(MbsData *mbs_data, MbsSensor *sens, int body_id, int point_id, double coord_I[3])
Compute the absolute coordinate of an anchor point from the base origin.
Definition: mbs_data.c:1313
MBS_INFO_FAILURE
#define MBS_INFO_FAILURE
Definition: mbs_define.h:32
mbs_msg
void mbs_msg(const char *msg,...)
Send a message.
Definition: mbs_message.c:87
MbsData::xfidpt
int * xfidpt
Array of the points defined as force application points.
Definition: mbs_data.h:443
mbs_json_int
int mbs_json_int(JsonNode *node, int *val_ptr, char *key, int read_write, int allow_missing)
Link between integer value and the specific key of a Json node or the current node.
Definition: mbs_json.c:1004
print_dvec_0
void print_dvec_0(double *vec, int l_v)
print a (x sized) vector of doubles in console, starting with index 0
Definition: mbs_1D_array.c:1487
mbs_print_diff_dmat_1_inertia
static void mbs_print_diff_dmat_1_inertia(const char *prefix, double **m1, double **m2, int nc)
Definition: mbs_data.c:53
mbs_json_array
int mbs_json_array(JsonNode *node, double **tab_ptr, int *size, const char *key, int mission, int allow_missing)
Link an array (1D) value and the specific key of a Json node or the current node.
Definition: mbs_json.c:605
mbs_json_tab
int mbs_json_tab(JsonNode *node, double ***tab_ptr, int size_1, int size_2, const char *key, int mission)
Link between array (2D) value and the specific key of a Json node or the current node.
Definition: mbs_json.c:777
get_char_cpy
char * get_char_cpy(const char *fmt,...)
Copy the provided formatted string into a newly allocated memory.
Definition: useful_functions.c:235
MbsData::Ncons
int Ncons
Number of algebraic constraints.
Definition: mbs_data.h:378
MbsData::qd
double * qd
Array with the current values of the generalized velocities.
Definition: mbs_data.h:346
mbs_json_double
int mbs_json_double(JsonNode *node, double *val_ptr, char *key, int read_write, int allow_missing)
Link between double value and the specific key of a Json node or the current node.
Definition: mbs_json.c:286
mbs_json_set_double
int mbs_json_set_double(JsonNode *node, double value)
Set a double into a node.
Definition: mbs_json.c:398
MbsData::qa
int * qa
Array with the indices of actuated articulations (only for inverse dynamic).
Definition: mbs_data.h:338
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:370
count_json_array_elements
int count_json_array_elements(JsonNode *node)
Counts the number of element in the Json array.
Definition: mbs_json.c:18
MbsData::m
double * m
Array containing the mass of each body.
Definition: mbs_data.h:313
MbsData::DonePart
int DonePart
Flag that indicates if the coordinate partitioning module has been executed (default: 0=not done; 1=d...
Definition: mbs_data.h:482
MbsData::user_IO
UserIO * user_IO
Structure containing all the user IO.
Definition: mbs_data.h:465
useful_functions.h
mbs_json_array_3
int mbs_json_array_3(JsonNode *node, double **tab, const char *key, int mission, int allow_missing)
Link an array of size 3 and the specific key of a Json node or the current node.
Definition: mbs_json.c:699
JsonNode::children
struct JsonNode::@8::@10 children
MbsData::tsim
double tsim
The time value.
Definition: mbs_data.h:366
identity_dmat_4x4_ptr
double ** identity_dmat_4x4_ptr(double **mat)
Set the matrix to identity (diagonal to 1, outside to 0).
Definition: mbs_matrix.c:1323
MbsData::nqrot
int nqrot
Number of rotational joint (R1, R2 or R3)
Definition: mbs_data.h:330
MbsData::Nlink3D
int Nlink3D
Number of 3D links.
Definition: mbs_data.h:417
mbs_print_qc
int mbs_print_qc(MbsData *s, FILE *fs)
Print the names of the driven and locked joints.
Definition: mbs_data.c:268
MbsData::mbs_filename
char * mbs_filename
Path to mbs file including the file with the extension (.mbs)
Definition: mbs_data.h:505
load_and_create_json
JsonNode * load_and_create_json(const char *mbs_json_filename, int *err)
Definition: mbs_json.c:116
mbs_compute_sin_cos_q_all
void mbs_compute_sin_cos_q_all(MbsData *s)
Compute the sine and cosine of the q_sin and q_cos, for all the rotational joints.
Definition: mbs_trigo.c:88
MbsData::nqv
int nqv
Number of dependent articulations.
Definition: mbs_data.h:328
Functions::mbs_new_user_model
mbs_new_user_model_ptr mbs_new_user_model
Definition: mbs_data.h:125
MbsData::DoneEquil
int DoneEquil
Flag that indicates the equilibrium module output.
Definition: mbs_data.h:488
mbs_data.h
MbsData::qc
int * qc
Array with the indices of driven (locked and driven) articulations.
Definition: mbs_data.h:333
MbsData::ux0
double * ux0
Array with the initial values of the user variables.
Definition: mbs_data.h:476
mbs_copy_data
void mbs_copy_data(MbsData *s, MbsData *s_copy)
Copy all fields between two MBSdata structures.
Definition: mbs_data.c:369
MbsData::nqu
int nqu
Number of independent articulations.
Definition: mbs_data.h:323
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:1318
_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
mbs_json_set_int
int mbs_json_set_int(JsonNode *node, int value)
Set an integer into a node.
Definition: mbs_json.c:1122
JsonNode::bool_
bool bool_
Definition: json.h:53
mbs_json_set_bool
int mbs_json_set_bool(JsonNode *node, int value)
Set a bool (int) into a node.
Definition: mbs_json.c:964
MbsData::njoint
int njoint
Number of joints in the system.
Definition: mbs_data.h:320
mbs_json_get_string
int mbs_json_get_string(JsonNode *node, char **str_ptr)
Get the node value content as a string.
Definition: mbs_json.c:522
dot_3x3_arr
void dot_3x3_arr(double res[3], double mat[3][3], double vec[3])
Compute the dot product of a matrix by a vector.
Definition: mbs_matrix.c:41
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:369
MbsData::npt
int npt
Number of anchor points.
Definition: mbs_data.h:310
mbs_define.h
mbs_json_tab
int mbs_json_tab(JsonNode *node, double ***tab_ptr, int size_1, int size_2, const char *key, int mission)
Link between array (2D) value and the specific key of a Json node or the current node.
Definition: mbs_json.c:777
json_foreach
#define json_foreach(i, object_or_array)
Definition: json.h:100
dvec_3_to_dpt
int dvec_3_to_dpt(MbsData *mbs, int point_id, double coord[3])
Set the coordinate in the mbs anchor point.
Definition: mbs_data.c:1393
Functions::symb
struct Functions::@3 symb
mbs_reset_joints_kine
void mbs_reset_joints_kine(MbsData *s)
Reset joints kinematics (q, qd, qdd) of a MbsData structure to initial values.
Definition: mbs_data.c:499
MbsData::n_ball
int n_ball
Number of ball constraint in the system.
Definition: mbs_data.h:374
mbs_strcmp
int mbs_strcmp(const char *__s1, const char *__s2)
Compare two char with strcmp.
Definition: useful_functions.c:569
print_dmat_0
void print_dmat_0(double **mat, int nb_r, int nb_c)
print a [nb_r times nb_c] matrix of doubles in console, starting with index 0
Definition: mbs_matrix.c:901
MbsData::data_utils
MbsDataUtils * data_utils
Structure gathering multibody informations that are not required for computation.
Definition: mbs_data.h:526
mbs_json_get_int
int mbs_json_get_int(JsonNode *node, int *val_ptr)
Get the node value content an integer.
Definition: mbs_json.c:1067
json_validate
bool json_validate(const char *json)
Definition: json.c:433
UserIoInfo::n_in
int n_in
Number of user input port.
Definition: mbs_user_interface.h:35
Functions::mbs_save_um
mbs_save_um_ptr mbs_save_um
Definition: mbs_data.h:148
mbs_json_set_bool
int mbs_json_set_bool(JsonNode *node, int value)
Set a bool (int) into a node.
Definition: mbs_json.c:964
mbs_compare_data
int mbs_compare_data(MbsData *s1, MbsData *s2, int accelred)
Compare two MbsData.
Definition: mbs_data.c:808
JSON_OBJECT
@ JSON_OBJECT
Definition: json.h:36
mbs_matrix.h
Declares all operation betweens matrices, matrice and vector, matrice and scalars.
mbs_warning_msg
void mbs_warning_msg(const char *msg,...)
Send a warning message.
Definition: mbs_message.c:100
mbs_json_get_int
int mbs_json_get_int(JsonNode *node, int *val_ptr)
Get the node value content an integer.
Definition: mbs_json.c:1067
mbs_print_qu
int mbs_print_qu(MbsData *s, FILE *fs)
Print the names of the independent joints.
Definition: mbs_data.c:202
MbsData::Nux
int Nux
Number of user variable.
Definition: mbs_data.h:477
mbs_json_cmp_string
int mbs_json_cmp_string(JsonNode *node, char *string)
Compare a string node content with a string.
Definition: mbs_json.c:509
MbsData::flag_jac_position
int flag_jac_position
Flag to compute the Jacobian of the constraint for position or velocity solution.
Definition: mbs_data.h:494
MbsData::jac_user
double ** jac_user
Jacobian of constraints [nqv x njoint] (starting at 1), only used in symbolic accelred,...
Definition: mbs_data.h:408
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:503
MbsData::DoneModal
int DoneModal
Flag that indicates if the modal module has been executed (default: 0=not done; 1=done).
Definition: mbs_data.h:489
MbsDataUtils
Gather utilities for the multibody system that are not requires for computation.
Definition: mbs_data.h:250
JsonNode::next
JsonNode * next
Definition: json.h:45
code_dmat_1
int code_dmat_1(FILE *file_out, double **values, const char *name, int n_row, int n_col)
Write C-code to allocate and fill an array of arrays of doubles.
Definition: mbs_matrix.c:1164
mbs_1D_array.h
Declares all operation betweens vectors, vector and scalar.
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:356
mbs_json_set_int
int mbs_json_set_int(JsonNode *node, int value)
Set an integer into a node.
Definition: mbs_json.c:1122
MbsData::SWr
double ** SWr
Array of Swr vector for each external forces.
Definition: mbs_data.h:444
mbs_json_array_3
int mbs_json_array_3(JsonNode *node, double **tab, const char *key, int mission, int allow_missing)
Link an array of size 3 and the specific key of a Json node or the current node.
Definition: mbs_json.c:699
json_mkarray
JsonNode * json_mkarray(void)
Definition: json.c:526
MbsData::q_cos
double * q_cos
Array with the cosine values of the generalized coordinates, if rotational (if translational,...
Definition: mbs_data.h:355
MbsData::hu
int * hu
Array with the indices of independent constraints.
Definition: mbs_data.h:341
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
mbs_json_add_array
JsonNode * mbs_json_add_array(JsonNode *root_node, double *array, int size, const char *key, int *err)
Add or replace the array in the specified children of the root node.
Definition: mbs_json.c:711
MbsData::Nxfrc
int Nxfrc
Number of points where an external force is applied into a body.
Definition: mbs_data.h:442
_MBS_ERR_MOD_SPEC_19
#define _MBS_ERR_MOD_SPEC_19
Generic error number Module specific errors range from -11 to -19 please read the error message a...
Definition: mbs_errors_names.h:220
MbsData::qd0
double * qd0
Array with the initial values of the generalized velocities.
Definition: mbs_data.h:350
same_ivec_0
int same_ivec_0(int *v1, int *v2, int size)
Compare if two vector are the same.
Definition: mbs_1D_array.c:1285
mbs_reset_data
void mbs_reset_data(MbsData *s)
Reset all fields of a MbsData structure to initial values.
Definition: mbs_data.c:510
mbs_json_save_mbs
JsonNode * mbs_json_save_mbs(MbsData *mbs_data, char *filename, int flag_q, int flag_qd, int flag_qdd, int flag_mass, int *err)
Save the speficied status of the mbs in a json configuration node and file.
Definition: mbs_json.c:1162
mbs_json_bool
int mbs_json_bool(JsonNode *node, int *val_ptr, char *key, int mission, int allow_missing)
Link between bool value (int) and the specific key of a Json node or the current node.
Definition: mbs_json.c:855
Functions::mbs_print_user_IO
mbs_print_user_IO_ptr mbs_print_user_IO
Print the current UserIO values.
Definition: mbs_data.h:154
MbsData::Nlink
int Nlink
Number of forces acting between two points of the system (force law implemented in user_LinkForces())...
Definition: mbs_data.h:416
MSG_ERR
#define MSG_ERR
Definition: mbs_data.c:15
json_delete
void json_delete(JsonNode *node)
Definition: json.c:407
Functions::user
struct Functions::@4 user
mbs_json_get_bool
int mbs_json_get_bool(JsonNode *node, int *val_ptr)
Get the node value content a bool as int.
Definition: mbs_json.c:912
mbs_json_get_string
int mbs_json_get_string(JsonNode *node, char **str_ptr)
Get the node value content as a string.
Definition: mbs_json.c:522
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:502
json_check
bool json_check(const JsonNode *node, char errmsg[256])
Definition: json.c:1313
json_find_element
JsonNode * json_find_element(JsonNode *array, int index)
Definition: json.c:448
MbsData::__user_IO_info
UserIoInfo * __user_IO_info
Details of the user IO loaded from multibody file.
Definition: mbs_data.h:469
json_save
int json_save(const char *filepath, JsonNode *node, int verbosity, int *err)
Save the current json node to file.
Definition: mbs_json.c:210
mbs_json_string
int mbs_json_string(JsonNode *node, char **str_ptr, const char *key, int mission, int allow_missing)
Link between string value and the specific key of a Json node.
Definition: mbs_json.c:436
code_dvec_1
int code_dvec_1(FILE *file_out, double *values, const char *name, int size)
Write C-code to allocate and fill an array of double.
Definition: mbs_1D_array.c:1584
MbsData::MAX_NR_ITER
int MAX_NR_ITER
Maximal number of iterations for NR procedure, default 100.
Definition: mbs_data.h:381
MbsData::Nuserc
int Nuserc
Number of user constraints.
Definition: mbs_data.h:379
MbsSensor::R
double ** R
Rotation matrix from the inertial frame to the sensor frame: .
Definition: mbs_sensor_struct.h:21
MbsData::Fl
double * Fl
Array with the current values of the forces on each link (see: user_LinkForces()).
Definition: mbs_data.h:420
MbsData::qu
int * qu
Array with the indices of the independent articulations (free)
Definition: mbs_data.h:332
JsonNode
Definition: json.h:41
JSON_NUMBER
@ JSON_NUMBER
Definition: json.h:34
MbsData::NRerr
double NRerr
Maximal error on constraint allowed in Newton-Raphson algorithm, default 1.0e-9.
Definition: mbs_data.h:380
mbs_new_sensor
MbsSensor * mbs_new_sensor(MbsData *mbs_data)
Create (allocate and initialize) a new MbsSensor structure.
Definition: mbs_sensor.c:79
MbsData::trq
double ** trq
Matrix with the components of the resultant external torques (pure torque and couple produced by forc...
Definition: mbs_data.h:361
print_dvec_1
void print_dvec_1(double *vec)
print a vector (of size specified in vec[0]) of doubles in console, starting with index 1
Definition: mbs_1D_array.c:1644
MbsData::qv
int * qv
Array with the indices of the dependent articulations .
Definition: mbs_data.h:340
MbsData::Qc
double * Qc
Array with the value of joint force introduced in driven joint to respect the user function.
Definition: mbs_data.h:412
MbsData::Nloopc
int Nloopc
Number of loop constraints.
Definition: mbs_data.h:377
mbs_json_add_array
JsonNode * mbs_json_add_array(JsonNode *root_node, double *array, int size, const char *key, int *err)
Add or replace the array in the specified children of the root node.
Definition: mbs_json.c:711
UserIoInfo::ptr_in
double ** ptr_in
List of pointers to each user input values.
Definition: mbs_user_interface.h:54
UserIoInfo::name_out
char ** name_out
Name of each user output port.
Definition: mbs_user_interface.h:66
JsonNode::key
char * key
Definition: json.h:48
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:419
mbs_json_cmp_string
int mbs_json_cmp_string(JsonNode *node, char *string)
Compare a string node content with a string.
Definition: mbs_json.c:509
code_ivec_1
int code_ivec_1(FILE *file_out, int *values, const char *name, int size)
Write C-code to allocate and fill an array of integers.
Definition: mbs_1D_array.c:1019
MbsData::Qq
double * Qq
Array with the values of the joint forces.
Definition: mbs_data.h:362
count_json_elements
int count_json_elements(JsonNode *node)
Counts the number of element in the json node.
Definition: mbs_json.c:32
MbsData::q
double * q
Array with the current values of the generalized coordinates.
Definition: mbs_data.h:345
mbs_json_bool
int mbs_json_bool(JsonNode *node, int *val_ptr, char *key, int mission, int allow_missing)
Link between bool value (int) and the specific key of a Json node or the current node.
Definition: mbs_json.c:855
mbs_print_qx
int mbs_print_qx(MbsDataUtils *data_utils, int nqx, int *qx, const char *prefix, FILE *fs)
Non-exposed function (outside header) to print joints names.
Definition: mbs_data.c:188
mbs_delete_sensor
void mbs_delete_sensor(MbsSensor *psens)
Free the memory of MbsSensor structure and its contents.
Definition: mbs_sensor.c:86
MbsData::In
double ** In
Array containing the inertia tensor component of each body (in the body fixed frame,...
Definition: mbs_data.h:314
MbsData::Nsensor
int Nsensor
< Array of l3DWr vector for each 3D link forces.
Definition: mbs_data.h:439
copy_dvec_0
double * 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:1363
MbsData::project_path
char * project_path
Path to the mbs project folder.
Definition: mbs_data.h:507
mbs_sensor_utilities.h
Declare functions associated to MbsSensor allocation and reset.
mbs_print_qdriven
int mbs_print_qdriven(MbsData *s, FILE *fs)
Print the names of the driven (not locked) joints.
Definition: mbs_data.c:301
MbsSensor::P
double P[4]
Position vector of the sensor expressed in the inertial frame: .
Definition: mbs_sensor_struct.h:20
mbs_json_set_string
int mbs_json_set_string(JsonNode *node, const char *string)
Set a char into a node.
Definition: mbs_json.c:569
MbsData::nqdriven
int nqdriven
Number of driven articulations.
Definition: mbs_data.h:326
mbs_trigo.h
This header defines the functions for trigonometric handling in MBsysC integrator in C.
MbsData::fct
Functions fct
Structure to store the pointer to the project-specific functions.
Definition: mbs_data.h:510
mbs_print_qv
int mbs_print_qv(MbsData *s, FILE *fs)
Print the names of the dependent joints.
Definition: mbs_data.c:235
mbs_json_int
int mbs_json_int(JsonNode *node, int *val_ptr, char *key, int mission, int allow_missing)
Link between integer value and the specific key of a Json node or the current node.
Definition: mbs_json.c:1004
add_dvec_3
double * add_dvec_3(double res[3], double v1[3], double v2[3])
Sums the two vectors (of size 3).
Definition: mbs_1D_array.c:567
JSON_STRING
@ JSON_STRING
Definition: json.h:33
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:360
copy_dvec_1
double * 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:1378
MbsData::nqc
int nqc
Number of driven articulations, it includes qlocked and qdriven.
Definition: mbs_data.h:324
MbsData::l3DWr
double ** l3DWr
Definition: mbs_data.h:422
MbsData::user_model
UserModel * user_model
Structure containing all user models.
Definition: mbs_data.h:459
mbs_message.h
re_copy_ivec_0
int * re_copy_ivec_0(int *src, int s_nx, int *dest, int d_nx)
Copy an array of int into another, reallocate the destination if required.
Definition: mbs_1D_array.c:883
same_dvec_0
int same_dvec_0(double *v1, double *v2, int size)
Compare if two vectors of floats are the same.
Definition: mbs_1D_array.c:1848
Functions::mbs_print_user_model
mbs_print_user_model_ptr mbs_print_user_model
Definition: mbs_data.h:145
json_save
int json_save(const char *filepath, JsonNode *node, int verbosity, int *err)
Save the current json node to file.
Definition: mbs_json.c:210
MbsData::dpt
double ** dpt
Array containing the coordinate of all anchor points (3+1 lines, npt+1 columns).
Definition: mbs_data.h:311
mbs_json_string
int mbs_json_string(JsonNode *node, char **str_ptr, const char *key, int mission, int allow_missing)
Link between string value and the specific key of a Json node.
Definition: mbs_json.c:436
dpt_to_dvec_4
double * dpt_to_dvec_4(MbsData *mbs_data, int point, double coord[4])
Retrieve the anchor point coordinate and set them in an array.
Definition: mbs_data.c:1291
json_find_member
JsonNode * json_find_member(JsonNode *object, const char *name)
Definition: json.c:465
MbsData::mbs_name
char * mbs_name
Name of the mbs project as it is stored in the xml file.
Definition: mbs_data.h:508
UserIoInfo::name_in
char ** name_in
Name of each user input port.
Definition: mbs_user_interface.h:64
MbsData::q0
double * q0
Array with the initial values of the generalized coordinates.
Definition: mbs_data.h:349
mbs_print_data
void mbs_print_data(MbsData *s)
Definition: mbs_data.c:79
zeros_dvec_0
void zeros_dvec_0(double *vec, int l_v)
set all the element of a [l_v sized] vector of doubles to zero, starting with index 0
Definition: mbs_1D_array.c:1793
_MBS_ERR_MOD_SPEC_18
#define _MBS_ERR_MOD_SPEC_18
Genericerror number Module specific errors range from -11 to -19 please read the error message an...
Definition: mbs_errors_names.h:214
MbsData
Definition: mbs_data.h:307
MbsData::n_solid
int n_solid
Number of solid constraint in the system.
Definition: mbs_data.h:373
dpt_to_dvec_3
double * dpt_to_dvec_3(MbsData *mbs_data, int point, double coord[3])
Retrieve the anchor point coordinate and set them in an array.
Definition: mbs_data.c:1259
Functions::mbs_gensensor
mbs_gensensor_ptr mbs_gensensor
Definition: mbs_data.h:79
MbsData::n_rod
int n_rod
Number of rod constraint in the system.
Definition: mbs_data.h:375
MBS_INFO_CMP
#define MBS_INFO_CMP
Definition: mbs_define.h:28
MbsData::qlocked
int * qlocked
Array with the indices of locked articulations.
Definition: mbs_data.h:334
MbsData::Qa
double * Qa
Array of active joint forces (in case of simulink,invdyna,equil,linearization,...)
Definition: mbs_data.h:363
re_copy_dmat_0
double ** re_copy_dmat_0(double **src, int s_nx, int s_ny, double **dest, int d_nx, int d_ny)
Copy a 2D array of double into another, reallocate the destination if required.
Definition: mbs_matrix.c:820
JsonNode::tag
JsonTag tag
Definition: json.h:50
mbs_is_dir_or_file
int mbs_is_dir_or_file(const char *path)
Check if the path is valid and lead to a file or directory.
Definition: mbs_path.c:547
MbsData::Nuser_model
int Nuser_model
Number of declared user models in MBsysPad, retrieved from the multibody file.
Definition: mbs_data.h:455
MbsData::build_path
char * build_path
Path to the build folder.
Definition: mbs_data.h:506
zeros_dvec_1
void zeros_dvec_1(double *vec)
set all the element of a vector of doubles to zero, starting with index 1
Definition: mbs_1D_array.c:1803
mbs_json_get_double
int mbs_json_get_double(JsonNode *node, double *val_ptr)
Get the node value content a double.
Definition: mbs_json.c:346
MbsData::process
int process
Flag that indicate which module is currently running (1=partitioning, 2=equilibrium,...
Definition: mbs_data.h:491
MbsSensor
Definition: mbs_sensor_struct.h:18
json_append_member
void json_append_member(JsonNode *object, const char *key, JsonNode *value)
Definition: json.c:584
MbsData::nbody
int nbody
Number of bodies in the system.
Definition: mbs_data.h:318
MbsData::l
double ** l
Array containing the center of mass coordinates (in the body fixed frame, one column per body includi...
Definition: mbs_data.h:312
mbs_write_data
int mbs_write_data(MbsData *s, char *filename, char *function_name)
Write a source with a function allocating and setting a MbsData copy of the provided.
Definition: mbs_data.c:528
UserIoInfo::ptr_out
double ** ptr_out
List of pointers to each user output values.
Definition: mbs_user_interface.h:62
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:368
JSON_NULL
@ JSON_NULL
Definition: json.h:31
mbs_json_save_mbs
JsonNode * mbs_json_save_mbs(MbsData *mbs_data, char *filename, int flag_q, int flag_qd, int flag_qdd, int flag_mass, int *err)
Save the speficied status of the mbs in a json configuration node and file.
Definition: mbs_json.c:1162
json.h
mbs_basename
char * mbs_basename(const char *path, int verbose)
mbs_basename returns the trailing part of the path (UNIX and MAC).
Definition: mbs_path.c:359
MSG_PRE
#define MSG_PRE
Definition: mbs_data.c:16
mbs_json_set_string
int mbs_json_set_string(JsonNode *node, const char *string)
Set a char into a node.
Definition: mbs_json.c:569
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:418
MbsData::g
double g[3+1]
The 3 gravity components.
Definition: mbs_data.h:316
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:493
mbs_json_double
int mbs_json_double(JsonNode *node, double *val_ptr, char *key, int mission, int allow_missing)
Link between double value and the specific key of a Json node or the current node.
Definition: mbs_json.c:286
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:1334
mbs_path.h
mbs_json_get_bool
int mbs_json_get_bool(JsonNode *node, int *val_ptr)
Get the node value content a bool as int.
Definition: mbs_json.c:912
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:1353
json_stringify
char * json_stringify(const JsonNode *node, const char *space)
Definition: json.c:394
mbs_print_diff_dmat_1_xyz
static void mbs_print_diff_dmat_1_xyz(const char *prefix, double **m1, double **m2, int nc)
Definition: mbs_data.c:34
MBS_INFO_SUCCESS
#define MBS_INFO_SUCCESS
Definition: mbs_define.h:30
MbsData::qdriven
int * qdriven
Array with the indices of driven articulations.
Definition: mbs_data.h:336
MbsData::lambda
double * lambda
Array with the values of the Lagrange Multipliers related to the constraints.
Definition: mbs_data.h:407
MBS_INFO_READER
#define MBS_INFO_READER
Definition: mbs_define.h:23
MbsData::uxd
double * uxd
Array with the values of the time derivatives of the user variables.
Definition: mbs_data.h:475
JsonNode::string_
char * string_
Definition: json.h:56
MbsData::q_sin
double * q_sin
Array with the sine values of the generalized coordinates, if rotational (if translational,...
Definition: mbs_data.h:354
MbsData::qdd0
double * qdd0
Array with the initial values of the generalized acceleration.
Definition: mbs_data.h:351
json_append_element
void json_append_element(JsonNode *array, JsonNode *element)
Definition: json.c:568
JSON_ARRAY
@ JSON_ARRAY
Definition: json.h:35
UserIoInfo::n_out
int n_out
Number of user output port.
Definition: mbs_user_interface.h:37
MSG_PRE
#define MSG_PRE
Definition: mbs_json.c:15
JsonNode::parent
JsonNode * parent
Definition: json.h:44
MbsData::nqa
int nqa
Number of actuated articulations.
Definition: mbs_data.h:327
mbs_json_get_double
int mbs_json_get_double(JsonNode *node, double *val_ptr)
Get the node value content a double.
Definition: mbs_json.c:346
same_dmat_0
int same_dmat_0(double **a, double **b, int x, int y)
Compare if two 2D arrays of floats are the same.
Definition: mbs_matrix.c:1630
JSON_BOOL
@ JSON_BOOL
Definition: json.h:32
MbsData::nqlocked
int nqlocked
Number of locked articulations.
Definition: mbs_data.h:325
MSG_ERR
#define MSG_ERR
Definition: mbs_json.c:14
mbs_print_qlocked
int mbs_print_qlocked(MbsData *s, FILE *fs)
Print the names of the locked (not driven) joints.
Definition: mbs_data.c:335
Functions::mbs_save_user_IO
mbs_save_user_IO_ptr mbs_save_user_IO
Save the current UserIO values into a file stream.
Definition: mbs_data.h:161
MbsData::qdd
double * qdd
Array with the current values of the generalized acceleration.
Definition: mbs_data.h:347
MBS_INFO_WARNING
#define MBS_INFO_WARNING
Definition: mbs_define.h:31
MbsDataUtils::joint_names
char ** joint_names
Pointer to the list of joint names.
Definition: mbs_data.h:256
MbsData::jdqd_user
double * jdqd_user
Vector of jdqd for user constraints [nqv] (starting at 1), only used in symbolic accelred,...
Definition: mbs_data.h:409
JsonNode::number_
double number_
Definition: json.h:59
print_ivec_0
void print_ivec_0(int *vec, int l_v)
print a (l_v sized) vector of integers in console, starting with index 0
Definition: mbs_1D_array.c:932
count_json_elements
int count_json_elements(JsonNode *node)
Counts the number of element in the json node.
Definition: mbs_json.c:32
mbs_json_array
int mbs_json_array(JsonNode *node, double **tab_ptr, int *size, const char *key, int mission, int allow_missing)
Link an array (1D) value and the specific key of a Json node or the current node.
Definition: mbs_json.c:605
MbsData::udd
double * udd
For axelle red: array with the values of the acceleration of independent coordinate.
Definition: mbs_data.h:480
MbsData::ux
double * ux
Array with the values of the user variables.
Definition: mbs_data.h:474
mbs_json_set_double
int mbs_json_set_double(JsonNode *node, double value)
Set a double into a node.
Definition: mbs_json.c:398
count_json_array_elements
int count_json_array_elements(JsonNode *node)
Counts the number of element in the Json array.
Definition: mbs_json.c:18
find_element_with_key
JsonNode * find_element_with_key(JsonNode *list, char *key_name, char *key_value, int *err)
Find the element (JSON_OBJECT) of the list whith the key matching the string.
Definition: mbs_json.c:48
mbs_stricmp
int mbs_stricmp(const char *__s1, const char *__s2)
Compare two char with _stricmp (convert strings to lower case, ignoring case sensitive).
Definition: useful_functions.c:585
mbs_json.h
mbs_data_get_IO
double * mbs_data_get_IO(MbsData *mbs, const char *io_name, int in_out)
Return the adress of the specified User IO.
Definition: mbs_data.c:1104
MbsData::nhu
int nhu
Number of independent constraints.
Definition: mbs_data.h:329
MbsData::lrod
double * lrod
Array with the length of each rod.
Definition: mbs_data.h:376
MBS_VERBOSE_ALL
#define MBS_VERBOSE_ALL
Definition: mbs_define.h:47
json_mknumber
JsonNode * json_mknumber(double n)
Definition: json.c:519
MbsData::n_user_IO
int n_user_IO
Number of declared user IO in MBsysPad, retrieved from the file.
Definition: mbs_data.h:462
json_decode
JsonNode * json_decode(const char *json)
Definition: json.c:361
dvec_4_to_dpt
int dvec_4_to_dpt(MbsData *mbs, int point_id, double coord[4])
Set the coordinate in the mbs anchor point.
Definition: mbs_data.c:1417
mbs_errors_names.h
load_and_create_json
JsonNode * load_and_create_json(const char *mbs_json_filename, int *err)
Definition: mbs_json.c:116