Modify the MbsInfo contents according to the configuration file.
The json file must have the following structure:
{
"user_model": {
"model_1_name": {
"param_1_name": value,
"param_2_name": value,
},
"model_3_name": {
"param_7_name": value
},
},
"mass":
{
"body_3_name": value,
"body_1_name": value
},
"inertia":
{
"body_3_name": [valueIxx, valueIyy, valueIzz],
"body_1_name":
{
"Ixx": valueIxx,
"Iyy": valueIyy,
"Izz": valueIzz,
"Ixz": valueIxy
},
"body_2_name": [valueIxx, valueIxy, valueIxz, valueIyy, valueIyz, valueIzz]
},
"com":
{
"body_3_name": [valueCoMx, valueCoMy, valueCoMz],
"body_1_name":
{
"x": valueCoMx,
"y": valueCoMy,
"z": valueCoMz
}
},
"q": [q0[1], q0[2]... q0[njoint]],
"qd": [qd0[1], qd0[2]... qd0[njoint]],
"qdd": [qdd0[1], qdd0[2]... qdd0[njoint]],
"joints":
{
"joint7_name": q0_value,
"joint2_name":
{
"q": q0_value,
"qd": qd0_value,
"qdd": qdd0_value,
},
"joint1_name":
{
"qd": qd0_value
}
},
"points":
{
"body7_name":
{
"point2_name": [x_value, y_value, z_value],
"point7_name": [x_value, y_value, z_value]
},
"body3_name":
{
"point1_name": [x_value, y_value, z_value]
}
}
}
Joints initial value are first set by the "q", "qd", "qdd" list, then by the joints list. This allows to save MbsData::q as it, and then modify a specific joint.
The "mass" field can be an array, in such a case it contains the mass of all bodies of the system.
The "inertia" field can be: a JSON_OBJECT: Considered keys are: {"Ixx", "Ixy", "Ixz", "Iyy", "Iyz", "Izz"}; Additional keys are disregarded without raising any warning. a JSON_ARRAY of : 3 elements: [Ixx, Iyy, Izz] 6 elements: [Ixx, Ixy, Ixz, Iyy, Iyz, Izz]
- The "com" (center of mass) field can be: a JSON_OBJECT: Considered keys are: {"x", "y", "z"}; Additional keys are disregarded without raising any warning. a JSON_ARRAY of : 3 elements: [x, y, z]
The points are defined in an object of objects. The key of each object is the bodyname. Each object on the body is an array whose key is the bodyname and the array containing the 3 coordinates (X, Y, Z, in body local frame).
If the default file does not exists, or is not loadable, the function exits normally. If a file is specified and does not exists, or was not loadable, an error is raised.
In both cases if the file encounter errors during setting the configuration, an error is raised.
- Parameters
-
[in,out] | mbs_infos | The Info structure of the multibody file. |
[in] | config_file | A json-formatted file containing the configuration to be assigned. If NULL is provided an optional file with ".conf" extension and the same path and name as the loaded file will attempt to be loaded. |
[out] | err | Pointer to store the status code. MBS_INFO_SUCCESS in case of success. |
- Returns
- The loaded configuration file JsonNode, or NULL if no file to be loaded or if an error is encountered..
< If a file is specified optional configuration is FALSE. Otherwhise missing file does not generate an error, failing to parse it generate a warning.
< Internal pointer to file path to keep the "const" in the argument.
< Root Json node of the configuration file.