Robotran C Documentation
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Macros | Functions
mbs_data.c File Reference
#include <float.h>
#include <string.h>
#include <errno.h>
#include "mbs_data.h"
#include "mbs_define.h"
#include "mbs_path.h"
#include "mbs_trigo.h"
#include "mbs_matrix.h"
#include "mbs_message.h"
#include "mbs_1D_array.h"
#include "useful_functions.h"

Macros

#define MSG_ERR   ">> MBSDATA>> "
 
#define MSG_PRE   ">> MBSDATA>> "
 

Functions

static void mbs_print_diff_dvec_1 (const char *prefix, double *v1, double *v2, int size)
 
static void mbs_print_diff_dmat_1_xyz (const char *prefix, double **m1, double **m2, int nc)
 
static void mbs_print_diff_dmat_1_inertia (const char *prefix, double **m1, double **m2, int nc)
 
void mbs_print_data (MbsData *s)
 
void mbs_copy_data (MbsData *s, MbsData *s_copy)
 Copy all fields between two MBSdata structures. More...
 
void mbs_reset_joints_kine (MbsData *s)
 Reset joints kinematics (q, qd, qdd) of a MbsData structure to initial values. More...
 
void mbs_reset_data (MbsData *s)
 Reset all fields of a MbsData structure to initial values. More...
 
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. More...
 
int mbs_compare_data (MbsData *s1, MbsData *s2, int accelred)
 Compare two MbsData. More...
 
double * mbs_data_get_IO (MbsData *mbs, const char *io_name, int in_out)
 Return the adress of the specified User IO. More...
 

Macro Definition Documentation

◆ MSG_ERR

#define MSG_ERR   ">> MBSDATA>> "

◆ MSG_PRE

#define MSG_PRE   ">> MBSDATA>> "

Function Documentation

◆ mbs_compare_data()

int mbs_compare_data ( MbsData s1,
MbsData s2,
int  accelred 
)

Compare two MbsData.

The following fields are not compared:

Other fields may be ommited.

The user model parameters are not compared.

If using "accelred" activate the flag accelred (non-null value). Otherwhise deactivate it (null value). The field specifiec to accelered (MbsData::jac_user and MbsData::jdqd_user) are allocated with size MbsData::nqv at file loading. When not using "accelred" this value can be changed without reallocating the fields.

Parameters
[in]s1The first multibody system.
[in]s2The second multibody system
[in]accelredFlag to compare specified field for accelred usage (user jacobian and jdqd fields). Should be set to False by default.
Returns
0 if same system, -1 otherwhise

◆ mbs_copy_data()

void mbs_copy_data ( MbsData s,
MbsData s_copy 
)

Copy all fields between two MBSdata structures.

WARNING: This function is not updated daily with new functionnalities of MbsData. Use with care.

The function does not modify the followings:

  • user models
  • user IOs
  • multibody filename
  • build path
  • project path
  • project name
  • pointers to project functions
  • pointer to realtime structure
Parameters
[in]sPointer to the multibody source.
[out]s_copyPointer to the multibody output.
Returns

◆ 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.

The function set errno in case of error. No matches is not considered as an error.

Parameters
[in]mbsPointer to the multibody structure.
[in]io_nameName of the user input or output to find.
[in]in_outFlag to determine if the requested user IO is an input, or or output:
  • +1: user Input only;
  • -1: user Output only;
  • 0: Not specified, seach in inputs then output.
Returns
The adress of the double containing the user IO. NULL in case of error or if not found.

◆ mbs_print_data()

void mbs_print_data ( MbsData s)

◆ mbs_print_diff_dmat_1_inertia()

static void mbs_print_diff_dmat_1_inertia ( const char *  prefix,
double **  m1,
double **  m2,
int  nc 
)
static

◆ mbs_print_diff_dmat_1_xyz()

static void mbs_print_diff_dmat_1_xyz ( const char *  prefix,
double **  m1,
double **  m2,
int  nc 
)
static

◆ mbs_print_diff_dvec_1()

static void mbs_print_diff_dvec_1 ( const char *  prefix,
double *  v1,
double *  v2,
int  size 
)
static

◆ mbs_reset_data()

void mbs_reset_data ( MbsData s)

Reset all fields of a MbsData structure to initial values.

Parameters
[in,out]sthe MbsData structure to reset

◆ mbs_reset_joints_kine()

void mbs_reset_joints_kine ( MbsData s)

Reset joints kinematics (q, qd, qdd) of a MbsData structure to initial values.

Parameters
[in,out]sthe MbsData structure to reset

◆ mbs_write_data()

int mbs_write_data ( MbsData mbs,
char *  filename,
char *  function_name 
)

Write a source with a function allocating and setting a MbsData copy of the provided.

Parameters
[in]mbsThe MbsData structure to be set in the function.
[in]filenameThe name of the source file to be created.
[in]function_nameThe name of the function creating the new MbsData. NULL can be provided, in such a case the name will be "get_mbs_data".
Returns
Negative number in case of error, 0 otherwhise.