Robotran C Documentation
Functions
mbs_binder_private.h File Reference
#include "mbs_load_json.h"
#include "mbs_load_struct.h"
#include "mbs_binder_public.h"
#include "mbs_user_interface.h"

Go to the source code of this file.

Functions

int mbs_info_loader (MbsLoader *mbs_loader, const char *mbs_filename, int verbose)
 Read the mbs file and store all used file description. More...
 
int mbs_info_updater (MbsInfos *mbs_infos, const char *mbs_filename)
 
MbsInfosmbs_new_infos (void)
 
MbsInfoBodyfind_body_in_bodytree (MbsInfos *mbs_infos, char *bodyname)
 
MbsInfoJointfind_joint_in_bodytree (MbsInfos *mbs_infos, char *jointname)
 
int fill_all_joint_list (MbsInfos *mbs_infos)
 Fill the joints list with children parent... More...
 
MbsInfoJointfind_joint_in_joint_list (MbsInfos *mbs_infos, char *jointname)
 
MbsInfoJointfind_joint_with_parent_in_joint_list (MbsInfos *mbs_infos, char *jointname)
 
int mbs_copy_info_joint (MbsInfoJoint *mbs_info_joint_src, MbsInfoJoint *mbs_info_joint_dest)
 
int mbs_copy_info_body (MbsInfoBody *mbs_info_body_src, MbsInfoBody *mbs_info_body_dest)
 
int mbs_adapt_joint_nature (MbsInfoJoint *joint_info, int verbose)
 Check the symbols definition and changes the nature to locked if compatible. More...
 
MbsInfoDDatambs_new_info_d_data (void)
 
void mbs_delete_info_d_data (MbsInfoDData *mbs_info_d_data)
 
MbsInfoRefPointmbs_new_info_ref_point (void)
 
void * mbs_delete_info_ref_point (MbsInfoRefPoint *mbs_info_ref_point)
 
MbsInfoSensormbs_new_info_sensor (void)
 
void mbs_delete_info_sensor (MbsInfoSensor *mbs_info_sensor)
 
MbsInfoExtforcembs_new_info_extforce (void)
 
void mbs_delete_info_extforce (MbsInfoExtforce *mbs_info_extforce)
 
MbsInfoPointmbs_new_info_point (void)
 
void * mbs_delete_info_point (MbsInfoPoint *mbs_info_point)
 
MbsInfoBasembs_new_info_base (void)
 
void mbs_delete_info_base (MbsInfoBase *mbs_info_base)
 
MbsInfoJointmbs_new_info_joint (void)
 
void * mbs_delete_info_joint (MbsInfoJoint *mbs_info_joint)
 
MbsInfoBodymbs_new_info_body (void)
 
void mbs_delete_info_body (MbsInfoBody *mbs_info_body, void *all_joints_lists)
 
MbsInfoBodytreembs_new_info_bodytree (void)
 
void mbs_delete_info_bodytree (MbsInfoBodytree *mbs_info_bodytree, void *all_joints_list)
 
MbsInfoBallmbs_new_info_ball (void)
 
void mbs_delete_info_ball (MbsInfoBall *mbs_info_ball)
 
MbsInfoRodmbs_new_info_rod (void)
 
void mbs_delete_info_rod (MbsInfoRod *mbs_info_rod)
 
MbsInfoSolidmbs_new_info_solid (void)
 
void mbs_delete_info_solid (MbsInfoSolid *mbs_info_solid)
 
MbsInfoCutsmbs_new_info_cuts (void)
 
void mbs_delete_info_cuts (MbsInfoCuts *mbs_info_cuts)
 
MbsInfoLinkmbs_new_info_link (void)
 
void mbs_delete_info_link (MbsInfoLink *mbs_info_link)
 
MbsInfoLinksmbs_new_info_links (void)
 
void mbs_delete_info_links (MbsInfoLinks *mbs_info_links)
 
MbsInfoParametermbs_new_info_parameter (void)
 
void mbs_delete_info_parameter (MbsInfoParameter *mbs_info_parameter)
 
MbsInfoUserModelmbs_new_info_user_model (void)
 
void mbs_delete_info_user_model (MbsInfoUserModel *mbs_info_user_model)
 
MbsInfoUserModelsmbs_new_info_user_models (void)
 
void mbs_delete_info_user_models (MbsInfoUserModels *mbs_info_user_models)
 
MbsInfoUserIOmbs_new_info_user_IO (void)
 
void mbs_delete_info_user_IO (MbsInfoUserIO *mbs_info_user_IO)
 
MbsInfoUserIOsmbs_new_info_user_IOs (void)
 
void mbs_delete_info_user_IOs (MbsInfoUserIOs *mbs_info_user_IOs)
 
MbsInfoUserCstrmbs_new_info_user_cstr (void)
 
void mbs_delete_info_user_cstr (MbsInfoUserCstr *mbs_info_user_cstr)
 
MbsInfoOptimbs_new_info_opti (void)
 
void mbs_delete_info_opti (MbsInfoOpti *mbs_info_opti)
 
void mbs_delete_user_IO_info (UserIoInfo *ioInfo)
 
JsonNodembs_info_configuration (MbsInfos *mbs_infos, const char *config_file, int *err)
 Modify the MbsInfo contents according to the configuration file. More...
 

Function Documentation

◆ fill_all_joint_list()

int fill_all_joint_list ( MbsInfos mbs_infos)

Fill the joints list with children parent...

Parameters
[in,out]mbs_infosThe system description
Returns
MBS_INFO_SUCCESS, MBS_INFO_WARNING if no joints in the system or MBS_INFO_FAILURE for invalid system (ie: body without parent joint).

◆ find_body_in_bodytree()

MbsInfoBody* find_body_in_bodytree ( MbsInfos mbs_infos,
char *  bodyname 
)

◆ find_joint_in_bodytree()

MbsInfoJoint* find_joint_in_bodytree ( MbsInfos mbs_infos,
char *  jointname 
)

◆ find_joint_in_joint_list()

MbsInfoJoint* find_joint_in_joint_list ( MbsInfos mbs_infos,
char *  jointname 
)

◆ find_joint_with_parent_in_joint_list()

MbsInfoJoint* find_joint_with_parent_in_joint_list ( MbsInfos mbs_infos,
char *  jointname 
)

◆ mbs_adapt_joint_nature()

int mbs_adapt_joint_nature ( MbsInfoJoint joint_info,
int  verbose 
)

Check the symbols definition and changes the nature to locked if compatible.

Parameters
[in,out]joint_infoThe joint to be checked.
[in]verboseVerbosity level, from only errors (0) to full verbose (2), debug verbose is 3.
Returns
MBS_INFO_SUCCESS if nature is correct, MBS_INFO_WARNING if the joint nature has changed.

◆ mbs_copy_info_body()

int mbs_copy_info_body ( MbsInfoBody mbs_info_body_src,
MbsInfoBody mbs_info_body_dest 
)

◆ mbs_copy_info_joint()

int mbs_copy_info_joint ( MbsInfoJoint mbs_info_joint_src,
MbsInfoJoint mbs_info_joint_dest 
)

◆ mbs_delete_info_ball()

void mbs_delete_info_ball ( MbsInfoBall mbs_info_ball)

◆ mbs_delete_info_base()

void mbs_delete_info_base ( MbsInfoBase mbs_info_base)

◆ mbs_delete_info_body()

void mbs_delete_info_body ( MbsInfoBody mbs_info_body,
void *  all_joints_lists 
)

◆ mbs_delete_info_bodytree()

void mbs_delete_info_bodytree ( MbsInfoBodytree mbs_info_bodytree,
void *  all_joints_list 
)

◆ mbs_delete_info_cuts()

void mbs_delete_info_cuts ( MbsInfoCuts mbs_info_cuts)

◆ mbs_delete_info_d_data()

void mbs_delete_info_d_data ( MbsInfoDData mbs_info_d_data)

◆ mbs_delete_info_extforce()

void mbs_delete_info_extforce ( MbsInfoExtforce mbs_info_extforce)

◆ mbs_delete_info_joint()

void* mbs_delete_info_joint ( MbsInfoJoint mbs_info_joint)

◆ mbs_delete_info_link()

void mbs_delete_info_link ( MbsInfoLink mbs_info_link)

◆ mbs_delete_info_links()

void mbs_delete_info_links ( MbsInfoLinks mbs_info_links)

◆ mbs_delete_info_opti()

void mbs_delete_info_opti ( MbsInfoOpti mbs_info_opti)

◆ mbs_delete_info_parameter()

void mbs_delete_info_parameter ( MbsInfoParameter mbs_info_parameter)

◆ mbs_delete_info_point()

void* mbs_delete_info_point ( MbsInfoPoint mbs_info_point)

◆ mbs_delete_info_ref_point()

void* mbs_delete_info_ref_point ( MbsInfoRefPoint mbs_info_ref_point)

◆ mbs_delete_info_rod()

void mbs_delete_info_rod ( MbsInfoRod mbs_info_rod)

◆ mbs_delete_info_sensor()

void mbs_delete_info_sensor ( MbsInfoSensor mbs_info_sensor)

◆ mbs_delete_info_solid()

void mbs_delete_info_solid ( MbsInfoSolid mbs_info_solid)

◆ mbs_delete_info_user_cstr()

void mbs_delete_info_user_cstr ( MbsInfoUserCstr mbs_info_user_cstr)

◆ mbs_delete_info_user_IO()

void mbs_delete_info_user_IO ( MbsInfoUserIO mbs_info_user_IO)

◆ mbs_delete_info_user_IOs()

void mbs_delete_info_user_IOs ( MbsInfoUserIOs mbs_info_user_IOs)

◆ mbs_delete_info_user_model()

void mbs_delete_info_user_model ( MbsInfoUserModel mbs_info_user_model)

◆ mbs_delete_info_user_models()

void mbs_delete_info_user_models ( MbsInfoUserModels mbs_info_user_models)

◆ mbs_delete_user_IO_info()

void mbs_delete_user_IO_info ( UserIoInfo ioInfo)

◆ mbs_info_configuration()

JsonNode* mbs_info_configuration ( MbsInfos mbs_infos,
const char *  config_file,
int *  err 
)

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_infosThe Info structure of the multibody file.
[in]config_fileA 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]errPointer 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.

◆ mbs_info_loader()

int mbs_info_loader ( MbsLoader mbs_loader,
const char *  mbs_filename,
int  verbose 
)

Read the mbs file and store all used file description.

Parameters
[in,out]mbs_loader
[in]mbs_filename
[in]verboseVerbosity level, from only errors (0) to full verbose (2) (debug verbose = 3).
Returns
MBS_INFO_SUCCESS for succes, other is error code.

◆ mbs_info_updater()

int mbs_info_updater ( MbsInfos mbs_infos,
const char *  mbs_filename 
)

◆ mbs_new_info_ball()

MbsInfoBall* mbs_new_info_ball ( void  )

◆ mbs_new_info_base()

MbsInfoBase* mbs_new_info_base ( void  )

◆ mbs_new_info_body()

MbsInfoBody* mbs_new_info_body ( void  )

◆ mbs_new_info_bodytree()

MbsInfoBodytree* mbs_new_info_bodytree ( void  )

◆ mbs_new_info_cuts()

MbsInfoCuts* mbs_new_info_cuts ( void  )

◆ mbs_new_info_d_data()

MbsInfoDData* mbs_new_info_d_data ( void  )

◆ mbs_new_info_extforce()

MbsInfoExtforce* mbs_new_info_extforce ( void  )

◆ mbs_new_info_joint()

MbsInfoJoint* mbs_new_info_joint ( void  )

◆ mbs_new_info_link()

MbsInfoLink* mbs_new_info_link ( void  )

◆ mbs_new_info_links()

MbsInfoLinks* mbs_new_info_links ( void  )

◆ mbs_new_info_opti()

MbsInfoOpti* mbs_new_info_opti ( void  )

◆ mbs_new_info_parameter()

MbsInfoParameter* mbs_new_info_parameter ( void  )

◆ mbs_new_info_point()

MbsInfoPoint* mbs_new_info_point ( void  )

◆ mbs_new_info_ref_point()

MbsInfoRefPoint* mbs_new_info_ref_point ( void  )

◆ mbs_new_info_rod()

MbsInfoRod* mbs_new_info_rod ( void  )

◆ mbs_new_info_sensor()

MbsInfoSensor* mbs_new_info_sensor ( void  )

◆ mbs_new_info_solid()

MbsInfoSolid* mbs_new_info_solid ( void  )

◆ mbs_new_info_user_cstr()

MbsInfoUserCstr* mbs_new_info_user_cstr ( void  )

◆ mbs_new_info_user_IO()

MbsInfoUserIO* mbs_new_info_user_IO ( void  )

◆ mbs_new_info_user_IOs()

MbsInfoUserIOs* mbs_new_info_user_IOs ( void  )

◆ mbs_new_info_user_model()

MbsInfoUserModel* mbs_new_info_user_model ( void  )

◆ mbs_new_info_user_models()

MbsInfoUserModels* mbs_new_info_user_models ( void  )

◆ mbs_new_infos()

MbsInfos* mbs_new_infos ( void  )