Robotran C Documentation
Functions
mbs_sensor.c File Reference

Define functions associated to MbsSensor allocation and reset. More...

#include <stdlib.h>
#include "mbs_data.h"
#include "mbs_matrix.h"
#include "mbs_define.h"
#include "mbs_sensor_utilities.h"

Functions

int allocate_sensor (MbsSensor *psens, int njoint)
 Allocate the Jacobian matrix of the MbsSensor. More...
 
int init_sensor (MbsSensor *psens, int njoint)
 Initialize all fields of MbsSensor structure to 0 and identity rotation matrix. More...
 
void free_sensor (MbsSensor *psens)
 Deprecated: Free the memory INSIDE MbsSensor structure. More...
 
MbsSensormbs_new_sensor (MbsData *mbs_data)
 Create (allocate and initialize) a new MbsSensor structure. More...
 
void mbs_delete_sensor (MbsSensor *psens)
 Free the memory of MbsSensor structure and its contents. More...
 

Detailed Description

Define functions associated to MbsSensor allocation and reset.

Author
Robotran team

(c) Universite catholique de Louvain

Function Documentation

◆ allocate_sensor()

int allocate_sensor ( MbsSensor psens,
int  njoint 
)

Allocate the Jacobian matrix of the MbsSensor.

User shoudl call direclty the function mbs_new_sensor().

The size of the matrix depends on the number of joints in the multibody system.

Parameters
[in,out]psensPointer to the MbsSensor structure to modify.
[in]njointNumber of joint in the MBS, see MbsData::njoint.
Returns
MBS_INFO_SUCCESS or MBS_INFO_FAILURES (macro in mbs_define.h)

◆ free_sensor()

void free_sensor ( MbsSensor psens)

Deprecated: Free the memory INSIDE MbsSensor structure.

The function mbs_delete_sensor() must be used.

It frees the space allocated for the jacobian matrix and the rotation matrix of the sensor.

It does not free the MbsSensor memory itself.

Parameters
[in,out]psensPointer to the MbsSensor structure to be freed.

◆ init_sensor()

int init_sensor ( MbsSensor psens,
int  njoint 
)

Initialize all fields of MbsSensor structure to 0 and identity rotation matrix.

Parameters
[in,out]psensPointer to the MbsSensor structure to initialize.
[in]njointNumber of joint in the MBS, see MbsData::njoint.
Returns
MBS_INFO_SUCCESS or MBS_INFO_FAILURES (macro in mbs_define.h)

◆ mbs_delete_sensor()

void mbs_delete_sensor ( MbsSensor psens)

Free the memory of MbsSensor structure and its contents.

Parameters
[in,out]psensPointer to the MbsSensor structure to be freed.

◆ mbs_new_sensor()

MbsSensor* mbs_new_sensor ( struct MbsData mbs_data)

Create (allocate and initialize) a new MbsSensor structure.

This function calls allocate_sensor and init_sensor.

Parameters
[in]mbs_dataThe MbsData structure, used to get the number of joints.
Returns
The adress of the allocated and initialized sensor.