Robotran C Documentation
Macros | Functions
mbs_infos_helper.c File Reference
#include <errno.h>
#include <string.h>
#include "mbs_infos_helper.h"
#include "mbs_message.h"
#include "mbs_define.h"
#include "useful_functions.h"

Macros

#define MSG_ERR   ">> HELPER>> "
 
#define MSG_TAB   " >> "
 

Functions

MbsInfoUserIOmbs_get_info_user_io (MbsInfos *mbs_infos, const char *name, int verbose, int *err)
 
MbsInfoUserModelmbs_get_info_user_model (MbsInfos *mbs_infos, const char *name, int verbose, int *err)
 Retrieve a user model matching a name in the User Models list of MbsInfos. More...
 
MbsInfoParametermbs_get_info_parameter (MbsInfoUserModel *um, const char *name, int verbose, int *err)
 Retrieve a user model parameter matching a name in a provided User Model. More...
 
MbsInfoParametermbs_get_um_info_parameter (MbsInfos *mbs_infos, const char *um_name, const char *param_name, int verbose, int *err)
 Retrieve a parameter in a user model matching the names in the User Models list of MbsInfos. More...
 
MbsInfoBodymbs_get_info_body (MbsInfos *mbs_infos, const char *name, int verbose, int *err)
 Retrieve the body matching the given name. More...
 
MbsInfoJointmbs_get_info_joint (MbsInfos *mbs_infos, const char *name, int verbose, int *err)
 Retrieve the joint matching the given name. More...
 
MbsInfoPointmbs_get_info_point (MbsInfoBody *mbs_body, const char *name, int verbose, int *err)
 Retrieve the point matching the given name on a body. More...
 
int mbs_info_get_joint_id (MbsInfos *mbs_infos, const char *name, int verbose)
 Retrieve a joint indice from its name. More...
 
int mbs_info_get_body_id (MbsInfos *mbs_infos, const char *name, int verbose)
 Retrieve a body indice from its name. More...
 
int mbs_info_get_point_id (MbsInfos *mbs_infos, const char *body_name, const char *point_name, int verbose)
 Retrieve a point indice from its names (body and point name). More...
 

Detailed Description

Define utilities to get and set values in an existing MbsInfos structure.

Creation date: 31-01-2023

Author
Robotran team

(c) Universite catholique de Louvain

Macro Definition Documentation

◆ MSG_ERR

#define MSG_ERR   ">> HELPER>> "

◆ MSG_TAB

#define MSG_TAB   " >> "

Function Documentation

◆ mbs_get_info_body()

MbsInfoBody* mbs_get_info_body ( MbsInfos mbs_infos,
const char *  name,
int  verbose,
int *  err 
)

Retrieve the body matching the given name.

Parameters
[in]mbs_infosThe multibody system informations structure.
[in]nameThe body name.
[in]verboseFlag, set to false to disable verbosity.
[out]errPointer to the error code memory place. Values are:
  • 0: normal output, no error
  • -1: Invalid arguments (NULL pointer, empty char...)
  • -2: No body defined in the mbs infos
  • -3: Invalid body in the body list (not allocated, not named...)
  • -4: No body matching the given name
Returns
The pointer to the structure of the body, or NULL in case of error.

◆ mbs_get_info_joint()

MbsInfoJoint* mbs_get_info_joint ( MbsInfos mbs_infos,
const char *  name,
int  verbose,
int *  err 
)

Retrieve the joint matching the given name.

Parameters
[in]mbs_infosThe multibody system informations structure.
[in]nameThe joint name.
[in]verboseFlag, set to false to disable verbosity.
[out]errPointer to the error code memory place. Values are:
  • 0: normal output, no error
  • -1: Invalid arguments (NULL pointer, empty char...)
  • -2: No joint defined in the mbs infos
  • -3: Invalid joint in the joint list (not allocated, not named...)
  • -4: No joint matching the given name
Returns
The pointer to the structure of the joint, or NULL in case of error.

◆ mbs_get_info_parameter()

MbsInfoParameter* mbs_get_info_parameter ( MbsInfoUserModel um,
const char *  name,
int  verbose,
int *  err 
)

Retrieve a user model parameter matching a name in a provided User Model.

Parameters
[in]umThe user model containing the parameter.
[in]nameThe parameter name.
[in]verboseFlag, set to false to disable verbosity.
[out]errPointer to the error code memory place. Values are:
  • 0: normal output, no error
  • -1: NULL pointer in arguments
  • -2: No parameter defined in the user model.
  • -3: Invalid parameter in the list (not allocated, missing name).
  • -4: No parameter with the specified name in the user model.
Returns
The pointer to the structure of the parameter, or NULL in case of error.

◆ mbs_get_info_point()

MbsInfoPoint* mbs_get_info_point ( MbsInfoBody mbs_body,
const char *  name,
int  verbose,
int *  err 
)

Retrieve the point matching the given name on a body.

Parameters
[in]mbs_bodyThe body to be parsed for the point.
[in]nameThe point name.
[in]verboseFlag, set to false to disable verbosity.
[out]errPointer to the error code memory place. Values are:
  • 0: normal output, no error
  • -1: Invalid arguments (NULL pointer, empty char...)
  • -2: No point defined in the mbs body
  • -3: Invalid point in the point list (not allocated, not named...)
  • -4: No point matching the given name
Returns
The pointer to the structure of the point, or NULL in case of error.

◆ mbs_get_info_user_io()

MbsInfoUserIO* mbs_get_info_user_io ( MbsInfos mbs_infos,
const char *  name,
int  verbose,
int *  err 
)

◆ mbs_get_info_user_model()

MbsInfoUserModel* mbs_get_info_user_model ( MbsInfos mbs_infos,
const char *  name,
int  verbose,
int *  err 
)

Retrieve a user model matching a name in the User Models list of MbsInfos.

Parameters
[in]mbs_infosThe multibody system informations structure.
[in]nameThe user model name.
[in]verboseFlag, set to false to disable verbosity.
[out]errPointer to the error code memory place. Values are:
  • 0: normal output, no error
  • -1: NULL pointer in arguments
  • -2: No user model defined in the mbs_infos.
  • -3: Invalid user model in the list (not allocated, missing name).
  • -4: No user model with the specified name.
Returns
The pointer to the structure of the user model, or NULL in case of error.

◆ mbs_get_um_info_parameter()

MbsInfoParameter* mbs_get_um_info_parameter ( MbsInfos mbs_infos,
const char *  um_name,
const char *  param_name,
int  verbose,
int *  err 
)

Retrieve a parameter in a user model matching the names in the User Models list of MbsInfos.

This function is a redirection to multiple subfunctions, the checking of the parameters is done by the subfunctions.

Parameters
[in]mbs_infosThe multibody system informations structure.
[in]um_nameThe user model name.
[in]param_nameThe parameter name.
[in]verboseFlag, set to false to disable verbosity.
[out]errPointer to the error code memory place. Values are:
Returns
The pointer to the structure of the parameter, or NULL in case of error.

◆ mbs_info_get_body_id()

int mbs_info_get_body_id ( MbsInfos mbs_infos,
const char *  name,
int  verbose 
)

Retrieve a body indice from its name.

A specific warning is printed (if verbosity is activated) if the exact body is not located, but can be found in non-sensitive name comparison.

Parameters
[in]mbs_infosThe multibody system informations structure.
[in]nameThe body name, the base body can be referenced by the keyword "base", "baseBodyName" or the name set on the base body in the file.
[in]verboseFlag, set to false to disable verbosity (errors included).
Returns
- MBS_INFO_FAILURE: Body not found
  • 0: base body
  • >= 0: The body indice

◆ mbs_info_get_joint_id()

int mbs_info_get_joint_id ( MbsInfos mbs_infos,
const char *  name,
int  verbose 
)

Retrieve a joint indice from its name.

A specific warning is printed (if verbosity is activated) if the exact joint is not located, but can be found in non-sensitive name comparison.

Set errno if joint is not located.

Parameters
[in]mbs_infosThe multibody system informations structure.
[in]nameThe joint name.
[in]verboseFlag, set to false to disable verbosity (errors included).
Returns
- MBS_INFO_FAILURE: Joint not found
  • > 0: The joint indice

◆ mbs_info_get_point_id()

int mbs_info_get_point_id ( MbsInfos mbs_infos,
const char *  body_name,
const char *  point_name,
int  verbose 
)

Retrieve a point indice from its names (body and point name).

A specific warning is printed (if verbosity is activated) if the exact body/point is not located, but can be found in non-sensitive names comparison.

Parameters
[in]mbs_infosThe multibody system informations structure.
[in]nameThe body name, the base body can be referenced by the keyword "base", "baseBodyName" or the name set on the base body in the file.
[in]point_nameThe point name (on the body).
[in]verboseFlag, set to false to disable verbosity (errors included).
Returns
- MBS_INFO_FAILURE: Point on body not found
  • >= 0: The point indice on the whole system.