Robotran C Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Functions
mbs_load_json.h File Reference

This header includes the functions to bind the JSON information to the MbsInfos structure. More...

#include "mbs_binder_public.h"
#include "json.h"
#include "mbs_load_struct.h"
#include "mbs_saver_struct.h"

Go to the source code of this file.

Functions

int mbs_json_inertia (JsonNode *bdy_node, MbsInfoBody *mbs_info_body, int mission)
 Translate the inertia key of a node from array (3,3) in node to array (6) in info. More...
 
JsonNodeload_and_create_json (const char *mbs_json_filename, int *err)
 
int mbs_info_json_binder (MbsInfos *mbs_infos, JsonNode *root_node, int mission, int verbose)
 Read or update the information from root node to all MbsInfo. More...
 
int mbs_info_body_json_binder (MbsInfoBody *mbs_info_body, JsonNode *node, int mission)
 Read or update the information from body node to its MbsInfo. More...
 
int mbs_info_tree_json_binder (MbsInfos *mbs_infos, JsonNode *node, int mission)
 Read or update the information from tree node to all MbsInfos. More...
 
int mbs_info_bodytree_json_binder (MbsInfos *mbs_infos, JsonNode *node, int mission)
 Read or update the information in tree->bodies node to MbsInfoBase fields. More...
 
int mbs_info_base_json_binder (MbsInfoBase *mbs_info_base, JsonNode *node, int mission)
 Read or update the information in base node to MbsInfoBase. More...
 
int mbs_info_ref_point_json_binder (MbsInfoRefPoint *mbs_info_ref_point, JsonNode *node, int mission)
 
int mbs_info_coordinates_json_binder (double *coordinates_pointer, JsonNode *node, int mission)
 
int mbs_info_point_json_binder (MbsInfoPoint *mbs_info_point, JsonNode *node, int mission)
 
int mbs_info_ball_json_binder (MbsInfoBall *mbs_info_ball, JsonNode *node, int mission)
 Read or update a ball json node with the infos. More...
 
int mbs_info_rod_json_binder (MbsInfoRod *mbs_info_rod, JsonNode *node, int mission)
 Read or update a rod json node with the infos. More...
 
int mbs_info_solid_json_binder (MbsInfoSolid *mbs_info_solid, JsonNode *node, int mission)
 Read or update a solid cut json node with the infos. More...
 
int mbs_info_cuts_json_binder (MbsInfoCuts *mbs_info_cuts, JsonNode *node, int mission)
 Read or update the cuts list json node with the infos. More...
 
int mbs_info_parameter_json_binder (MbsInfoParameter *mbs_info_parameter, JsonNode *node, int mission, int verbose)
 Read or update a user model parameter json node with the infos. More...
 
int mbs_info_user_model_json_binder (MbsInfoUserModel *um_info, JsonNode *um_node, int mission, int verbose)
 Read or update a user model json node with the infos. More...
 
int mbs_info_user_models_json_binder (MbsInfoUserModels *ums_info, JsonNode *ums_node, int mission, int verbose)
 Read or update the user models list json node with the infos. More...
 
int mbs_info_user_IO_json_binder (MbsInfoUserIO *mbs_info_user_IO, JsonNode *node, int mission)
 
int mbs_info_user_IOs_json_binder (MbsInfoUserIOs *mbs_info_user_IOs, JsonNode *node, int mission, int verbose)
 Read the user Input output variables list json node with the infos. More...
 
int mbs_info_user_cstr_json_binder (MbsInfoUserCstr *mbs_info_user_cstr, JsonNode *node, int mission)
 
int mbs_info_link_json_binder (MbsInfoLink *mbs_info_link, JsonNode *node, int mission)
 Read or update a link (point to point or 3D) json node with the infos. More...
 
int mbs_info_links_json_binder (MbsInfoLinks *mbs_info_links, JsonNode *node, int mission)
 Read or update a links list json node with the infos. More...
 
int mbs_info_links3d_json_binder (MbsInfoLinks *mbs_info_links, JsonNode *node, int mission)
 
int mbs_info_sensor_json_binder (MbsInfoSensor *mbs_info_sensor, JsonNode *node, int mission)
 Read or update a sensor json node with the infos. More...
 
int mbs_info_sensors_json_binder (MbsInfos *mbs_info, JsonNode *node, int mission)
 Read or update a sensors list json node with the infos. More...
 
int mbs_info_extforce_json_binder (MbsInfoExtforce *mbs_info_extf, JsonNode *node, int mission)
 Read or update a external force json node with the infos. More...
 
int mbs_info_extforces_json_binder (MbsInfos *mbs_info, JsonNode *node, int mission)
 Read or update a external forces list json node with the infos. More...
 
int mbs_info_point_list_json_binder (MbsInfoPoint ***point_list, JsonNode *node, int mission, char *body_name, int *n_point)
 Link between points array value and all "points" key of a Json object node. More...
 
int mbs_info_joint_json_binder (MbsInfoJoint *mbs_info_joint, JsonNode *node, int mission, int verbose)
 Read or update the information in joints node to MbsInfoBase, MbsInfoJoints. More...
 
int mbs_info_joints_list_json_binder (MbsInfos *mbs_infos, JsonNode *joints_node, int mission)
 To Be Defined. More...
 
int mbs_body_joint_recursive_linker (MbsInfos *mbs_info, int *ind_body_joint, int mission, int body_index)
 
int mbs_tree_cleaner (MbsInfos *mbs_info, int mission)
 Correct the parents of joints. More...
 
int mbs_info_json_linker (MbsInfos *mbs_info, int mission)
 
int mbs_json_axis (JsonNode *axis_node, int *axis_int, int mission)
 Read or update the information in an axis node with an integer. More...
 
int mbs_json_joint_nature (JsonNode *nature_node, int *nature_int, int mission)
 Read or update the information in an joint nature node with an integer. More...
 
int mbs_info_init_and_binderJSON (MbsInfos *mbs_infos, const char *mbs_json_name, int mission, int verbose)
 Init and bind the MBS information contained in the .json file. More...
 
int mbs_json_info_to_loader (MbsLoader *mbs_loader, const char *filename)
 Load and store the specified json file into the MbsLoader. More...
 
JsonNodembs_info_init_and_binderJSON_rtn (MbsInfos *mbs_infos, const char *mbs_json_name, int *err, int mission, int verbose)
 Init and bind the MBS information contained in the .json file. More...
 
int mbs_json_parent (JsonNode *node, MbsInfoRefPoint **point_parent, char **joint_parent, int mission, const char *key)
 Link between a parent infomation and a parent node. More...
 
int json_is_on_base (JsonNode *parent)
 Check if a parent node (of body or joint) is the base. More...
 
JsonNodejson_get_basebody (JsonNode *bodies_node, int create, int *err)
 Find the first body linked to the base inside the bodies list. More...
 
JsonNodejson_get_body (JsonNode *bodies_node, char *body_name, int create, int *err)
 Find the first body with matching name inside the bodies list. More...
 
JsonNodejson_get_body_3Dshapes (JsonNode *body_node, int create, int *err)
 Return the shapes array on the provided body node. More...
 
JsonNodejson_get_shape (JsonNode *shapes_node, char *shape_name, char *geometry, int allow_new, int *err)
 Return the shape matching the name and geometry from the given list. More...
 
int mbs_info_synch_shape (JsonNode *shape, UpdateInline *up_in, UpdateShape *up_sh)
 Synchronize, or fill with default value, a shape Json object node. More...
 
int mbs_info_update_shapes_json (MbsLoader *mbs_loader, UpdateInline *up_in, UpdateShape *up_sh, int allow_new)
 Update, or create this shape/inline and all next in the linked list. More...
 

Detailed Description

This header includes the functions to bind the JSON information to the MbsInfos structure.

Declaration of mbs utilities function for json manipulations.

Date
Nov 2022 (modification)
Author
Robotran Team
Date
January 2023
Author
Robotran Team

Function Documentation

◆ json_get_basebody()

JsonNode* json_get_basebody ( JsonNode bodies_node,
int  create,
int *  err 
)

Find the first body linked to the base inside the bodies list.

NOT IMPLEMENTED: Creation of missing base body.

Invalid members (not a body json node) in the list will be ignored (will not cause error).

Parameters
[in]bodies_nodeThe JSON_ARRAY node containing the list of bodies.
[in]createNOT IMPLEMENTED, a new body linked to the base can be created if none is existing.
[out]errPointer to error code, NULL can be provided. The error code is MBS_INFO_FAILURE, the success code is MBS_INFO_SUCCESS (macro in mbs_define.h).
Returns
Pointer to the JsonNode containing the base body or NULL.

◆ json_get_body()

JsonNode* json_get_body ( JsonNode bodies_node,
char *  body_name,
int  create,
int *  err 
)

Find the first body with matching name inside the bodies list.

NOT IMPLEMENTED: Creation of missing body.

Invalid members (not a body json node) in the list will be ignored (will not cause error).

Parameters
[in]bodies_nodeThe JSON_ARRAY node containing the list of bodies.
[in]body_nameThe name of the body.
[in]createNOT IMPLEMENTED, a new body can be created if none is existing. The body mandatory fields (parent...) must be added by the caller as they are not provided as argument of this function.
[out]errPointer to error code, NULL can be provided. The error code is MBS_INFO_FAILURE, the success code is MBS_INFO_SUCCESS (macro in mbs_define.h).
Returns
Pointer to the JsonNode containing the requested body or NULL.

◆ json_get_body_3Dshapes()

JsonNode* json_get_body_3Dshapes ( JsonNode body_node,
int  create,
int *  err 
)

Return the shapes array on the provided body node.

Parameters
[in,out]body_nodeThe JSON_OBJECT node containing the body.
[in]createAllow to create missing node(s) in the body.
[out]errPointer to error code, NULL can be provided. The error code is MBS_INFO_FAILURE, the success code is MBS_INFO_SUCCESS (macro in mbs_define.h).
Returns
Pointer to the JsonNode containing the shapes array or NULL.

◆ json_get_shape()

JsonNode* json_get_shape ( JsonNode shapes_node,
char *  shape_name,
char *  geometry,
int  allow_new,
int *  err 
)

Return the shape matching the name and geometry from the given list.

Invalid members (not a shape json node) in the list will be ignored (will not cause error).

Parameters
[in,out]shapes_nodeThe JSON_ARRAY node containing the list of shape.
[in]shape_nameThe name of the shape
[in]geometryThe name of the geometry, any contents (except NULL) will be considered as valid (no check from a pre-defined set of names).
[in]allow_newAllow to create a new shape in the list if none is matching. Only the shape name and geometry are created, the caller must create other mandatory fields (position...). The function mbs_info_synch_shape() can be used by provinding NULL in both update parameters. The error code is set to MBS_INFO_WARNING.
[in,out]errPointer to error code (macro in mbs_define.h). NULL can be provided. The values are:
  • MBS_INFO_FAILURE: error or shape not found;
  • MBS_INFO_WARNING: New shape created WITHOUT some fields (position...);
  • MBS_INFO_SUCCESS: Existing shape found;
Returns
Pointer to the JsonNode containing the shape or NULL.

◆ json_is_on_base()

int json_is_on_base ( JsonNode parent)

Check if a parent node (of body or joint) is the base.

A parent is the base if it is a JSON_STRING node whose content is MBS_BASENAME (macro in mbs_define.h).

Parameters
[in]parentThe node defining a parent. Invalid node (ie: not a JSON_STRING) will just generate the return associated to "not the base".
Returns
1 if the parent refer the base, 0 otherwhise.

◆ load_and_create_json()

JsonNode* load_and_create_json ( const char *  mbs_json_filename,
int *  err 
)

◆ mbs_body_joint_recursive_linker()

int mbs_body_joint_recursive_linker ( MbsInfos mbs_info,
int *  ind_body_joint,
int  mission,
int  body_index 
)

◆ mbs_info_ball_json_binder()

int mbs_info_ball_json_binder ( MbsInfoBall mbs_info_ball,
JsonNode node,
int  mission 
)

Read or update a ball json node with the infos.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
ball_infoThe info of the ball.
ball_nodeThe json node of the ball (a JSON_OBJECT).
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_base_json_binder()

int mbs_info_base_json_binder ( MbsInfoBase mbs_info_base,
JsonNode base_node,
int  mission 
)

Read or update the information in base node to MbsInfoBase.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
mbs_info_baseThe MbsInfo structure.
base_nodeThe Json node of the base.
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

Read or update the information in base node to MbsInfoBase.

◆ mbs_info_body_json_binder()

int mbs_info_body_json_binder ( MbsInfoBody mbs_info_body,
JsonNode node,
int  mission 
)

Read or update the information from body node to its MbsInfo.

A wanring message is printed if the inertia matrix in Json node is not symmetric.

Parameters
mbs_info_bodyThe MbsInfo structure of the body.
body_nodeThe Json node of the body (a JSON_OBJECT).
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns

◆ mbs_info_bodytree_json_binder()

int mbs_info_bodytree_json_binder ( MbsInfos mbs_infos,
JsonNode node,
int  mission 
)

Read or update the information in tree->bodies node to MbsInfoBase fields.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
mbs_infosThe MbsInfo structure.
bdies_nodeThe Json node of the bodies in the tree.
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_coordinates_json_binder()

int mbs_info_coordinates_json_binder ( double *  coordinates_pointer,
JsonNode node,
int  mission 
)

◆ mbs_info_cuts_json_binder()

int mbs_info_cuts_json_binder ( MbsInfoCuts mbs_info_cuts,
JsonNode node,
int  mission 
)

Read or update the cuts list json node with the infos.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
mbs_info_cutsThe Info for the cuts
nodeThe cuts json node (an array).
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_extforce_json_binder()

int mbs_info_extforce_json_binder ( MbsInfoExtforce mbs_info_extf,
JsonNode node,
int  mission 
)

Read or update a external force json node with the infos.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
force_infoThe Info for the sensor.
force_nodeThe sensor json node (a JSON_OBJECT).
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_extforces_json_binder()

int mbs_info_extforces_json_binder ( MbsInfos mbs_info,
JsonNode node,
int  mission 
)

Read or update a external forces list json node with the infos.

Parameters
mbs_infoThe Info for the project.
forces_nodeThe sensors json node (a JSON_ARRAY).
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_init_and_binderJSON()

int mbs_info_init_and_binderJSON ( MbsInfos mbs_infos,
const char *  mbs_json_name,
int  mission,
int  verbose 
)

Init and bind the MBS information contained in the .json file.

It calls mbs_info_init_and_binderJSON_rtn

Parameters
[in,out]mbs_infosThe MbsInfos structure, already allocated.
[in]mbs_json_nameThe filename of the json to be opened.
[in]missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
[in]verboseVerbosity level, from only errors (MBS_VERBOSE_ERROR) to full verbose (MBS_VERBOSE_DEBUG).
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE.

◆ mbs_info_init_and_binderJSON_rtn()

JsonNode* mbs_info_init_and_binderJSON_rtn ( MbsInfos mbs_infos,
const char *  mbs_json_name,
int *  err,
int  mission,
int  verbose 
)

Init and bind the MBS information contained in the .json file.

Returns a newly allocated JsonNode that must be freed by the caller.

Parameters
[in,out]mbs_infosThe MbsInfos structure, already allocated.
[in]mbs_json_nameThe filename of the json to be opened.
[in,out]errThe error, MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE.
[in]missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
[in]verboseVerbosity level, from only errors (MBS_VERBOSE_ERROR) to full verbose (MBS_VERBOSE_DEBUG).
Returns
the pointer to the newly allocated JsonNode, NULL in case of failure

◆ mbs_info_joint_json_binder()

int mbs_info_joint_json_binder ( MbsInfoJoint mbs_info_joint,
JsonNode node,
int  mission,
int  verbose 
)

Read or update the information in joints node to MbsInfoBase, MbsInfoJoints.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
mbs_infosThe MbsInfo structure.
joints_nodeThe Json joints node.
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
[in]verboseVerbosity level, from only errors (0) to full verbose (2).
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_joints_list_json_binder()

int mbs_info_joints_list_json_binder ( MbsInfos mbs_infos,
JsonNode joints_node,
int  mission 
)

To Be Defined.

Parameters
mbs_infosThe MbsInfos structure.
joints_nodeThe Json joints node.
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE. WARNING is raised if the mission is not implemented or if some joint natures have been updated by the process.

◆ mbs_info_json_binder()

int mbs_info_json_binder ( MbsInfos mbs_infos,
JsonNode root_node,
int  mission,
int  verbose 
)

Read or update the information from root node to all MbsInfo.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
[in,out]mbs_infosThe MbsInfo structure.
[in,out]root_nodeThe Json node of the base.
[in]missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
[in]verboseVerbosity level, from only errors (MBS_VERBOSE_ERROR) to full verbose (MBS_VERBOSE_DEBUG).
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_json_linker()

int mbs_info_json_linker ( MbsInfos mbs_info,
int  mission 
)

◆ mbs_info_link_json_binder()

int mbs_info_link_json_binder ( MbsInfoLink mbs_info_link,
JsonNode node,
int  mission 
)

Read or update a link (point to point or 3D) json node with the infos.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
link_infoThe Info for the link.
link_nodeThe link json node (an object).
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_links3d_json_binder()

int mbs_info_links3d_json_binder ( MbsInfoLinks mbs_info_links,
JsonNode node,
int  mission 
)

◆ mbs_info_links_json_binder()

int mbs_info_links_json_binder ( MbsInfoLinks mbs_info_links,
JsonNode node,
int  mission 
)

Read or update a links list json node with the infos.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
link_infoThe Info for the links.
link_nodeThe links json node (an array).
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_parameter_json_binder()

int mbs_info_parameter_json_binder ( MbsInfoParameter mbs_info_parameter,
JsonNode node,
int  mission,
int  verbose 
)

Read or update a user model parameter json node with the infos.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
[in,out]param_infoThe Info for the parameter.
[in,out]param_nodeThe node of parameter (a JSON_OBJECT).
[in]missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
[in]verboseVerbosity level, from only errors (MBS_VERBOSE_ERROR) to full verbose (MBS_VERBOSE_DEBUG).
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_point_json_binder()

int mbs_info_point_json_binder ( MbsInfoPoint mbs_info_point,
JsonNode node,
int  mission 
)

◆ mbs_info_point_list_json_binder()

int mbs_info_point_list_json_binder ( MbsInfoPoint ***  point_list,
JsonNode node,
int  mission,
char *  body_name,
int *  n_point 
)

Link between points array value and all "points" key of a Json object node.

Support READER, UPDATER and COUNTER mission.

Parameters
[in,out]point_listpointer to the point list array, the array (point_list[0] can be NULL for READER and COUNTER missions. In case of READER mission, the array is allocated, a warning is printed if the pointer was not NULL;
[in,out]nodeThe Json node being a JSON_OBJECT containing a "points" key.
[in]missionThe mission, not-implemented mission print a warning but returns success code.
[in]body_nameThe name of the body.
[in,out]n_pointThe current size of the point list array. It is set during COUNTER and READER mission. It must matche the node "points" JSON_ARRAY size for UPDATER mision
Returns
MBS_INFO_SUCCESS or MBS_INFO_FAILURE.

◆ mbs_info_ref_point_json_binder()

int mbs_info_ref_point_json_binder ( MbsInfoRefPoint mbs_info_ref_point,
JsonNode node,
int  mission 
)

◆ mbs_info_rod_json_binder()

int mbs_info_rod_json_binder ( MbsInfoRod mbs_info_rod,
JsonNode node,
int  mission 
)

Read or update a rod json node with the infos.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
rod_infoThe info of the rod.
rod_nodeThe json node of the rod (a JSON_OBJECT).
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_sensor_json_binder()

int mbs_info_sensor_json_binder ( MbsInfoSensor mbs_info_sensor,
JsonNode node,
int  mission 
)

Read or update a sensor json node with the infos.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
sensor_infoThe Info for the sensor.
sensor_nodeThe sensor json node (a JSON_OBJECT).
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_sensors_json_binder()

int mbs_info_sensors_json_binder ( MbsInfos mbs_info,
JsonNode node,
int  mission 
)

Read or update a sensors list json node with the infos.

Parameters
mbs_infoThe Info for the project.
sensors_nodeThe sensors json node (a JSON_ARRAY).
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_solid_json_binder()

int mbs_info_solid_json_binder ( MbsInfoSolid mbs_info_solid,
JsonNode node,
int  mission 
)

Read or update a solid cut json node with the infos.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
solid_infoThe info of the solid cut.
solid_nodeThe json node of the solid cut (a JSON_OBJECT).
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_synch_shape()

int mbs_info_synch_shape ( JsonNode shape,
UpdateInline up_in,
UpdateShape up_sh 
)

Synchronize, or fill with default value, a shape Json object node.

Only one of up_in and up_sh can be non-NULL. Both up_in and up_sh can be NULL, then the shape missing keys are completed.

Parameters
[in,out]shapeThe shape JSON_OBJECT node.
[in]up_inProvide the INLINE shape modifications to be applied on the Json node. It must be NULL when up_sh is provided.
[in]up_shProvide the BOX/CYLINDER/SPHERE/CONE shape modifications to be applied on the Json node. It must be NULL when up_in is provided.
Returns
MBS_INFO_SUCCESS or MBS_INFO_FAILURE (macro in mbs_define.h).

◆ mbs_info_tree_json_binder()

int mbs_info_tree_json_binder ( MbsInfos mbs_infos,
JsonNode node,
int  mission 
)

Read or update the information from tree node to all MbsInfos.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
mbs_infosThe MbsInfo structure.
tree_nodeThe Json node of the tree.
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_update_shapes_json()

int mbs_info_update_shapes_json ( MbsLoader mbs_loader,
UpdateInline up_in,
UpdateShape up_sh,
int  allow_new 
)

Update, or create this shape/inline and all next in the linked list.

The UpdateInline or UpdateShape is a linked list, the function will parse all the UpdateInline::next / UpdateShape::next items for updates until reaching the end of the list.

Only the shape or inline can be provided at one call.

Parameters
[in,out]mbs_loaderThe MbsLoader that contains all informations.
[in]up_inThe descriptions of the modification to set on the inline(s). If non-NULL, up_sh must be NULL;
[in]up_shThe descriptions of the modification to set on the shape(s). If non-NULL, up_in must be NULL;
[in]allow_newAllow to create the shape/inline.
Returns
MBS_INFO_SUCCESS or MBS_INFO_FAILURE (macro in mbs_define.h).

◆ mbs_info_user_cstr_json_binder()

int mbs_info_user_cstr_json_binder ( MbsInfoUserCstr mbs_info_user_cstr,
JsonNode node,
int  mission 
)

◆ mbs_info_user_IO_json_binder()

int mbs_info_user_IO_json_binder ( MbsInfoUserIO mbs_info_user_IO,
JsonNode node,
int  mission 
)

◆ mbs_info_user_IOs_json_binder()

int mbs_info_user_IOs_json_binder ( MbsInfoUserIOs mbs_info_user_IOs,
JsonNode node,
int  mission,
int  verbose 
)

Read the user Input output variables list json node with the infos.

Non-implemented missions raise a message and return a MBS_INFO_WARNING. The UPDATER mission does nothing, but raises a message if the verbosity level is at least set to MBS_VERBOSE_WARNING.

Parameters
[out]mbs_info_user_IOsThe Infos for the user IO variables listing.
[in]nodeThe node named "user_ios" in the multibody node.
[in]missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
[in]verboseThe verbosity option.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

mbs_strcmp((const char*)cur_node->key, "user_variable"))

◆ mbs_info_user_model_json_binder()

int mbs_info_user_model_json_binder ( MbsInfoUserModel um_info,
JsonNode um_node,
int  mission,
int  verbose 
)

Read or update a user model json node with the infos.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
[in,out]um_infoThe Info for the user model.
[in,out]um_nodeThe node of user model (a JSON_OBJECT).
[in]missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
[in]verboseVerbosity level, from only errors (MBS_VERBOSE_ERROR) to full verbose (MBS_VERBOSE_DEBUG).
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_info_user_models_json_binder()

int mbs_info_user_models_json_binder ( MbsInfoUserModels ums_info,
JsonNode ums_node,
int  mission,
int  verbose 
)

Read or update the user models list json node with the infos.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Parameters
[in,out]ums_infoThe Info for the user models.
[in,out]ums_nodeThe node of users models (a JSON_ARRAY).
[in]missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
[in]verboseVerbosity level, from only errors (MBS_VERBOSE_ERROR) to full verbose (MBS_VERBOSE_DEBUG).
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_json_axis()

int mbs_json_axis ( JsonNode axis_node,
int *  axis_int,
int  mission 
)

Read or update the information in an axis node with an integer.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Reading an unknow axis return a MBS_INFO_WARNING (with default value 0). Setting an unknow axis return a MBS_INFO_FAILURE (as no corresponding string is defined).

Parameters
axis_nodeThe Json axis node.
axis_intThe pointer to the integer corresponding to the axis.
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_json_inertia()

int mbs_json_inertia ( JsonNode bdy_node,
MbsInfoBody mbs_info_body,
int  mission 
)

Translate the inertia key of a node from array (3,3) in node to array (6) in info.

Fore READER mission the upper triangle of the inertia matrix is considered. If the matrix was not symmetric warnings are raised.

Parameters
bdy_nodeThe Json node containing the body.
mbs_info_bodyThe mbs informations body structure. If its intertia pointer is NULL, it will be allocated for READER mission only.
keyThe key of the json node to be used (to be read or set), if NULL the node is the array.
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_json_info_to_loader()

int mbs_json_info_to_loader ( MbsLoader mbs_loader,
const char *  filename 
)

Load and store the specified json file into the MbsLoader.

Parameters
[in,out]mbs_loaderThe MbsLoader that contains all informations.
[in]filenameThe filepath to the mbs to be loaded.
Returns
MBS_INFO_SUCCESS for succes, other is error code.

◆ mbs_json_joint_nature()

int mbs_json_joint_nature ( JsonNode nature_node,
int *  nature_int,
int  mission 
)

Read or update the information in an joint nature node with an integer.

Non-implemented missions raise a message and return a MBS_INFO_WARNING.

Reading an unknow joint nature return a MBS_INFO_WARNING (with default value 0). Setting an unknow joint nature return a MBS_INFO_FAILURE (as no corresponding string is defined).

Parameters
nature_nodeThe Json nature node.
nature_intThe pointer to the integer corresponding to the nature.
missionThe mission, implemented are MBS_INFO_READER and MBS_INFO_UPDATER.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_json_parent()

int mbs_json_parent ( JsonNode node,
MbsInfoRefPoint **  point_parent,
char **  joint_parent,
int  mission,
const char *  key 
)

Link between a parent infomation and a parent node.

Support READER and UPDATER.

Parameters
[in,out]nodeThe Json node describing a parent. The nature of the node is a JSON_STRING for a joint parent, or a JSON_OBJECT for a point (on a body) parent :
  • During READER mission, only point_parent and joint_parent is set according to the node nature.
  • During UPDATER mission, the node nature determine if informations are retrieved from point_parent or joint_parent. There is one exception, if the parent is the base origin point, is was specified in an JSON_STRING "base" but saved in a point "base/origin".
[in,out]point_parentThe description of the parent point.
[in,out]joint_parentThe name of the parent joint (or NULL).
[in]missionThe mission id.
[in]keyThe key name of the parent description in the node.
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING or MBS_INFO_FAILURE

◆ mbs_tree_cleaner()

int mbs_tree_cleaner ( MbsInfos mbs_info,
int  mission 
)

Correct the parents of joints.

If a joint (called P) is the parent of a body and at the same time the parent of one (or more) joints (called C) the tree is modified. All joints "C" will have as parent the body origin point.

A failure occurs either if at least one of the followong:

  • A body has no parent or if multiples bodies have the same joint parent.
  • A joint is the parent of multiple joint.
Parameters
[in,out]mbs_infoThe multibody system.
[in]missionThe function only do something with the MBS_INFO_READER value.
Returns
MBS_INFO_SUCCESS or MBS_INFO_FAILURE.