Robotran C Documentation
Classes | Enumerations | Functions
mbs_buffer.h File Reference

Go to the source code of this file.

Classes

struct  AnimInfo
 animationR .anim file info More...
 
struct  MbsBuffer
 
struct  MbsGrowingBuffer
 buffer used to store the user variables to output More...
 

Enumerations

enum  {
  BUFFER_Q, BUFFER_QD, BUFFER_QDD, BUFFER_QQ,
  BUFFER_UX, BUFFER_UXD, BUFFER_LINK_Z, BUFFER_LINK_ZD,
  BUFFER_LINK_F, BUFFER_VISU, BUFFER_QC, BUFFER_QA,
  BUFFER_LAMBDA, BUFFER_X, BUFFER_F, BUFFER_R,
  BUFFER_OTHER, BUFFER_LINK3D
}
 IDs for the buffers Be careful, if a new buffer is created, add it at the end of this enum Meanwhile, do not forget to update the results loading in other interfaces (MBsysPy for instance, in mbs_results.py) More...
 

Functions

MbsBuffermbs_new_buffer (char *filename, char *anim_name, int nx, int size, int id, char *buf_format, int save_anim, int save_visu, double anim_period)
 Allocate and initialize a MbsBuffer structure. More...
 
MbsGrowingBuffermbs_new_growing_buffer (int max_nx, int size, const char *respath)
 create a new growing buffer for the user inputs to save More...
 
void mbs_delete_buffer (MbsBuffer *b)
 Free memory of the specified MbsBuffer. More...
 
void mbs_delete_growing_buffer (MbsGrowingBuffer *b)
 release memory for growing buffer More...
 
int mbs_buffer_save (MbsBuffer *b, double t, double *x)
 Save the given array to the specified buffer with the specified time. More...
 
int mbs_growing_buffer_save (MbsGrowingBuffer *b, double t)
 Save the given values of auto_output to the specified buffer with the specified time. More...
 
int mbs_buffer_write (MbsBuffer *b)
 Write the content of the buffer to disk. More...
 
int mbs_anim_write (MbsBuffer *b)
 Write the content of the q buffer as anim file to the disk. More...
 
int mbs_growing_buffer_write (MbsGrowingBuffer *b)
 write the content of the growing buffer to disk More...
 

Detailed Description

Define structures and function for storing results during simulation and writing them to disk.

Author
Nicolas Docquier

(c) Universite catholique de Louvain

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

IDs for the buffers Be careful, if a new buffer is created, add it at the end of this enum Meanwhile, do not forget to update the results loading in other interfaces (MBsysPy for instance, in mbs_results.py)

Enumerator
BUFFER_Q 
BUFFER_QD 
BUFFER_QDD 
BUFFER_QQ 
BUFFER_UX 
BUFFER_UXD 
BUFFER_LINK_Z 
BUFFER_LINK_ZD 
BUFFER_LINK_F 
BUFFER_VISU 
BUFFER_QC 
BUFFER_QA 
BUFFER_LAMBDA 
BUFFER_X 
BUFFER_F 
BUFFER_R 
BUFFER_OTHER 
BUFFER_LINK3D 

Function Documentation

◆ mbs_anim_write()

int mbs_anim_write ( MbsBuffer b)

Write the content of the q buffer as anim file to the disk.

Returns
error (0 if no error)

◆ mbs_buffer_save()

int mbs_buffer_save ( MbsBuffer b,
double  t,
double *  x 
)

Save the given array to the specified buffer with the specified time.

The content of the buffer is automatically written to the associated file when the buffer is full. The buffer index is then reset to 0.

Parameters
bthe buffer in which to store
tthe corresponding time [s]
xthe array to save (value are copied)
Returns
error (0 if no error)

◆ mbs_buffer_write()

int mbs_buffer_write ( MbsBuffer b)

Write the content of the buffer to disk.

Values contained in the buffer for line 0 to line index-1 are appended to the file associated with this buffer.

Returns
error (0 if no error)

◆ mbs_delete_buffer()

void mbs_delete_buffer ( MbsBuffer b)

Free memory of the specified MbsBuffer.

◆ mbs_delete_growing_buffer()

void mbs_delete_growing_buffer ( MbsGrowingBuffer b)

release memory for growing buffer

Parameters
[out]bgrowing buffer to release

◆ mbs_growing_buffer_save()

int mbs_growing_buffer_save ( MbsGrowingBuffer b,
double  t 
)

Save the given values of auto_output to the specified buffer with the specified time.

Parameters
[in,out]bthe growing buffer in which to store
[in]tthe corresponding time [s]

The content of the buffer is automatically written to the associated file when the buffer is full. The buffer index is then reset to 0.

Returns
error (0 if no error)

◆ mbs_growing_buffer_write()

int mbs_growing_buffer_write ( MbsGrowingBuffer b)

write the content of the growing buffer to disk

Parameters
[in]bgrowing buffer
Returns
error (0 if no error)

◆ mbs_new_buffer()

MbsBuffer* mbs_new_buffer ( char *  filename,
char *  anim_name,
int  nx,
int  size,
int  id,
char *  buf_format,
int  save_anim,
int  save_visu,
double  anim_period 
)

Allocate and initialize a MbsBuffer structure.

The associated text file defined by filename is (re-)initialized

Parameters
[in]filenamethe name of the file associated to this buffer
[in]anim_namethe name of the file associated to the animation file (only used for BUFFER_Q)
[in]nxthe size of the array to be tracked by this buffer
[in]sizethe size of the buffer
[in]idthe buffer ID, see BUFFER_Q, BUFFER_QD ...
[in]formatof the buffer (if NULL, "%e" is used)
[in]save_anim1 to save the anim file, 0 otherwise
[in]save_visu1 to save the visualization file (as it appears in 'user_realtime_visu.c'), 0 otherwise (for real-time simulation)
[in]anim_periodtime interval between two recorded values in the animation file

◆ mbs_new_growing_buffer()

MbsGrowingBuffer* mbs_new_growing_buffer ( int  max_nx,
int  size,
const char *  respath 
)

create a new growing buffer for the user inputs to save

Parameters
[in]max_nxmaximum number of user inputs to save
[in]sizesize of the buffer
[in]respathpath to the file for the results
Returns
new growing buffer initialized