Robotran C Documentation
Functions
mbs_project_interface.h File Reference
#include "mbs_data.h"
#include "mbs_aux.h"
#include "mbs_dirdyn_struct.h"
#include "mbs_equil_struct.h"

Go to the source code of this file.

Functions

void mbs_get_project_functions (MbsData *mbs_data)
 loads the project function into the pointers defined in MbsData::fct More...
 
void user_load_post (MbsData *MBSdata)
 User own initialization operations. More...
 
void user_free (MbsData *MBSdata)
 User own freeing operations. More...
 
void user_dirdyn_init (MbsData *MBSdata, MbsDirdyn *mbs_dd)
 user own initialization functions More...
 
void user_dirdyn_loop (MbsData *MBSdata, MbsDirdyn *mbs_dd)
 user own loop functions More...
 
void user_dirdyn_finish (MbsData *MBSdata, MbsDirdyn *mbs_dd)
 user own finishing functions More...
 
void user_invdyn_init (MbsData *MBSdata, MbsInvdyn *mbs_invd)
 
void user_invdyn_loop (MbsData *MBSdata, MbsInvdyn *mbs_invd)
 
void user_invdyn_finish (MbsData *MBSdata, MbsInvdyn *mbs_invd)
 
void user_equil_init (MbsData *MBSdata, MbsEquil *mbs_equil)
 user own initialization functions More...
 
void user_equil_loop (MbsData *MBSdata, MbsEquil *mbs_equil)
 user own loop functions More...
 
void user_equil_finish (MbsData *MBSdata, MbsEquil *mbs_equil)
 user own finishing functions More...
 
void user_equil_fxe (MbsData *mbs_data, double *f)
 user own implementation of added equilibrium equations Fxe Necessary to express equilibrium f(x)=0 More...
 
void user_cons_hJ (double *h, double **Jac, MbsData *s, double tsim)
 
void user_cons_jdqd (double *jdqd, MbsData *s, double tsim)
 
void user_Derivative (MbsData *s)
 
void user_DrivenJoints (MbsData *s, double tsim)
 Compute the positions, velocities and acceleration of driven joint. More...
 
double * user_ExtForces (double PxF[4], double RxF[4][4], double VxF[4], double OMxF[4], double AxF[4], double OMPxF[4], MbsData *s, double tsim, int ixF)
 Compute an user-specified external force. More...
 
double * user_GenExtForces (double PxF[4], double RxF[4][4], double VxF[4], double OMxF[4], double AxF[4], double OMPxF[4], MbsData *s, double tsim, int iBody)
 
double * user_JointForces (MbsData *s, double tsim)
 Compute the user-specified joint force in all joint. More...
 
double user_LinkForces (double Z, double Zd, MbsData *s, double tsim, int ilnk)
 Compute the value of a link forces. More...
 
double * user_Link3DForces (double PxF[4], double RxF[4][4], double VxF[4], double OMxF[4], double AxF[4], double OMPxF[4], MbsData *s, double tsim, int ixF)
 Compute an user-specified point to point force, with arbitrary line of action. More...
 
int user_cons_J_accelred (MbsData *s, double tsim)
 [Accelred only] Compute the Jac_user matrix nqv x Njoint matrix (starting at one) for custom user constraints in accelred. More...
 
void mbs_cons_hJ (double *h, double **Jac, MbsData *s, double tsim)
 
void mbs_cons_jdqd (double *Jdqd, MbsData *s, double tsim)
 
void mbs_link (double **frc, double **trq, double *Flnk, double *Z, double *Zd, MbsData *s, double tsim)
 
void mbs_link3D (double **frc, double **trq, MbsData *s, double tsim)
 
void mbs_extforces (double **frc, double **trq, MbsData *s, double tsim)
 
int mbs_accelred (MbsData *s, double tsim)
 
void mbs_gensensor (MbsSensor *sens, MbsData *s, int isens)
 
void mbs_sensor (MbsSensor *sens, MbsData *s, int isens)
 Compute all fields of a sensor (force sensor or classic sensor). More...
 
void mbs_invdyna (double *Qq, MbsData *s, double tsim)
 
void mbs_dirdyna (double **M, double *c, MbsData *s, double tsim)
 

Detailed Description

Declaration of functions that are project dependent. It consists in user and symbolic functions.

Function Documentation

◆ mbs_accelred()

int mbs_accelred ( MbsData s,
double  tsim 
)

◆ mbs_cons_hJ()

void mbs_cons_hJ ( double *  h,
double **  Jac,
MbsData s,
double  tsim 
)

◆ mbs_cons_jdqd()

void mbs_cons_jdqd ( double *  Jdqd,
MbsData s,
double  tsim 
)

◆ mbs_dirdyna()

void mbs_dirdyna ( double **  M,
double *  c,
MbsData s,
double  tsim 
)

◆ mbs_extforces()

void mbs_extforces ( double **  frc,
double **  trq,
MbsData s,
double  tsim 
)

◆ mbs_gensensor()

void mbs_gensensor ( MbsSensor sens,
MbsData s,
int  isens 
)

◆ mbs_get_project_functions()

void mbs_get_project_functions ( MbsData mbs_data)

loads the project function into the pointers defined in MbsData::fct

Parameters
[in,out]mbs_datathe MbsData structure of the model

◆ mbs_invdyna()

void mbs_invdyna ( double *  Qq,
MbsData s,
double  tsim 
)

◆ mbs_link()

void mbs_link ( double **  frc,
double **  trq,
double *  Flnk,
double *  Z,
double *  Zd,
MbsData s,
double  tsim 
)

◆ mbs_link3D()

void mbs_link3D ( double **  frc,
double **  trq,
MbsData s,
double  tsim 
)

◆ mbs_sensor()

void mbs_sensor ( MbsSensor sens,
MbsData s,
int  isens 
)

Compute all fields of a sensor (force sensor or classic sensor).

Parameters
[in,out]sensPointer to the MbsSensor structure to compute.
[in]spointer to the MbsData structure of the model related to the sensor.
[in]isensthe ID of the sensor, for Force sensor the id has to be incremented by MbsData::Nsensor.

◆ user_cons_hJ()

void user_cons_hJ ( double *  h,
double **  Jac,
MbsData s,
double  tsim 
)

◆ user_cons_J_accelred()

int user_cons_J_accelred ( MbsData s,
double  tsim 
)

[Accelred only] Compute the Jac_user matrix nqv x Njoint matrix (starting at one) for custom user constraints in accelred.

The constraints are assumed to be solved by the user, inside this function. Thus, only the Jacobian of the constraints is needed (in the configuration of solved constraints ! )

Parameters
[in,out]sthe MbsData structure of the model on which the user constraints are computed.
[in]tsimthe current time of the simulation
Returns
error status, zero if ok, negative in case of failure

The only field that should be modified is the MbsData::jac_user matrix

◆ user_cons_jdqd()

void user_cons_jdqd ( double *  jdqd,
MbsData s,
double  tsim 
)

◆ user_Derivative()

void user_Derivative ( MbsData s)

◆ user_dirdyn_finish()

void user_dirdyn_finish ( MbsData mbs_data,
MbsDirdyn mbs_dd 
)

user own finishing functions

Parameters
[in,out]mbs_datadata structure of the model
[in,out]mbs_ddgeneral structure of the direct dynamic module (for advanced users)

For beginners, it is advised to only use the MbsData structure. The field MbsDirdyn is provided for more advanced users.

◆ user_dirdyn_init()

void user_dirdyn_init ( MbsData mbs_data,
MbsDirdyn mbs_dd 
)

user own initialization functions

Parameters
[in,out]mbs_datadata structure of the model
[in,out]mbs_ddgeneral structure of the direct dynamic module (for advanced users)

For beginners, it is advised to only use the MbsData structure. The field MbsDirdyn is provided for more advanced users.

◆ user_dirdyn_loop()

void user_dirdyn_loop ( MbsData mbs_data,
MbsDirdyn mbs_dd 
)

user own loop functions

This function is called a every time step. Warning: if the used integrator is multi-steps, user_dirdyn_loop is only called once: i.e. at the real time step (and not internal time steps)

Parameters
[in,out]mbs_datadata structure of the model
[in,out]mbs_ddgeneral structure of the direct dynamic module (for advanced users)

For beginners, it is advised to only use the MbsData structure. The field MbsDirdyn is provided for more advanced users.

◆ user_DrivenJoints()

void user_DrivenJoints ( MbsData s,
double  tsim 
)

Compute the positions, velocities and acceleration of driven joint.

Parameters
[in,out]sthe MbsData structure of the model on which the driven joint are computed.
[in]tsimthe current time of the simulation

The only fields that should be updated are MbsData::q, MbsData::qd and MbsData::qdd at the indexes MbsData::qc

◆ user_equil_finish()

void user_equil_finish ( MbsData mbs_data,
MbsEquil mbs_equil 
)

user own finishing functions

Parameters
[in,out]mbs_datadata structure of the model
[in,out]mbs_equilgeneral structure of the equilibrium module (for advance users)

For beginners, it is advised to only use the MbsData structure. The field MbsEquil is provided for more advance users.

◆ user_equil_fxe()

void user_equil_fxe ( MbsData mbs_data,
double *  f 
)

user own implementation of added equilibrium equations Fxe Necessary to express equilibrium f(x)=0

Parameters
[in]mbs_datadata structure of the model
[out]fvectors which contains the added equibrium functions : =f(xe, ... )

◆ user_equil_init()

void user_equil_init ( MbsData mbs_data,
MbsEquil mbs_equil 
)

user own initialization functions


Robotran - MBsysC

Template file for equilibrium module

This files enable the user to call custom at specific places in the time simulation. It is a template file that can be edited by the user.

(c) Universite catholique de Louvain

Parameters
[in,out]mbs_datadata structure of the model
[in,out]mbs_equilgeneral structure of the equilibrium module (for advance users)

For beginners, it is advised to only use the MbsData structure. The field MbsEquil is provided for more advance users.

◆ user_equil_loop()

void user_equil_loop ( MbsData mbs_data,
MbsEquil mbs_equil 
)

user own loop functions

Parameters
[in,out]mbs_datadata structure of the model
[in,out]mbs_equilgeneral structure of the equilibrium module (for advance users)

For beginners, it is advised to only use the MbsData structure. The field MbsEquil is provided for more advance users.

◆ user_ExtForces()

double* user_ExtForces ( double  PxF[4],
double  RxF[4][4],
double  VxF[4],
double  OMxF[4],
double  AxF[4],
double  OMPxF[4],
MbsData s,
double  tsim,
int  ixF 
)

Compute an user-specified external force.

Parameters
[in]PxFposition vector (index starting at 1) of the force sensor expressed in the inertial frame: $PxF(1:3)=[P_x; P_y; P_z]$.
[in]RxFrotation matrix (index starting at 1) from the inertial frame to the force sensor frame: $[\hat{\mathbf{X}}^S]=RxF(1:3,1:3).[\hat{\mathbf{X}}^0]$
[in]VxFvelocity vector (index starting at 1) of the force sensor expressed in the inertial frame: $VxF(1:3)=[V_x; V_y; V_z]$.
[in]OMxFangular velocity vector (index starting at 1) of the force sensor expressed in the inertial frame: $OMxF(1:3)=[\omega_x; \omega_y; \omega_z]$.
[in]AxFacceleration vector (index starting at 1) of the force sensor expressed in the inertial frame: $AxF(1:3)=[A_x; A_y; A_z]$.
[in]OMPxFangular acceleration vector (index starting at 1) of the force sensor expressed in the inertial frame: $OMPxF(1:3)=[\dot\omega_x; \dot\omega_y; \dot\omega_z]$.
[in,out]sthe MbsData structure of the model on which the force is computed.
[in]tsimthe current time of the simulation
[in]ixFthe ID identifying the computed force sensor.
Returns
A vector (of size 9, index starting at 1) with the content described for MbsData::SWr

The content of the returned vector Swr is [Fx; Fy; Fz; Mx; My; Mz; dxF]:

  • Force components (expressed in the inertial frame) : Fx, Fy, Fz
  • Pure torque components (expressed in the inertial frame) : Mx, My, Mz
  • Application point local coordinates vector (expressed in the body-fixed frame): dxF(1:3,1)

◆ user_free()

void user_free ( MbsData mbs_data)

User own freeing operations.

This function will automatically be called at the project freeing by mbs_delete_data() function. All memory allocated by the user (in the user model)ie. in a user model) should be properly freed. Such memory may have been allocated in the user_load_post() function.

Parameters
[in,out]mbs_datadata structure of the model

◆ user_GenExtForces()

double* user_GenExtForces ( double  PxF[4],
double  RxF[4][4],
double  VxF[4],
double  OMxF[4],
double  AxF[4],
double  OMPxF[4],
MbsData s,
double  tsim,
int  iBody 
)

◆ user_invdyn_finish()

void user_invdyn_finish ( MbsData MBSdata,
MbsInvdyn mbs_invd 
)

◆ user_invdyn_init()

void user_invdyn_init ( MbsData MBSdata,
MbsInvdyn mbs_invd 
)

◆ user_invdyn_loop()

void user_invdyn_loop ( MbsData MBSdata,
MbsInvdyn mbs_invd 
)

◆ user_JointForces()

double* user_JointForces ( MbsData s,
double  tsim 
)

Compute the user-specified joint force in all joint.

Parameters
[in,out]sthe MbsData structure of the model on which the joint forces are computed.
[in]tsimthe current time of the simulation

The only field that should be incremented is the MbsData::Qq at the indexes of MbsData::qc

◆ user_Link3DForces()

double* user_Link3DForces ( double  PxF[4],
double  RxF[4][4],
double  VxF[4],
double  OMxF[4],
double  AxF[4],
double  OMPxF[4],
MbsData s,
double  tsim,
int  ixF 
)

Compute an user-specified point to point force, with arbitrary line of action.

A 3D link force is attached from a body (called the parent body) to a second body (called children body). The parent and children bodies cannot be inverted as it change the definition of both the inputs arguments and outputs results.

For the documentation below, let:

  • point "A" be the anchor point on the parent body;
  • point "B" the anchor point on the children body;
  • point "M" the mid-point between "A" and "B";
  • frame [P], the frame attached to the parent body
  • frame [C], the frame attached to the children body

The returned force/torque component are expressed in the frame [P] and applied on both parent and children body at the location of point "B".

Parameters
[in]PxFThe vector "AB" (index starting at 1) with components expressed in frame [P].
[in]RxFThe rotation matrix (index starting at 1) such as [C] = Rxf*[P].
[in]VxFThe differential velocity vector (index starting at 1) with components expressed in frame [P]. The velocities are computed at the coordinates of point "M" linked to parent (Md_p), then linked to children (Md_c) body. The differential velocity vector is : Md_c - Md_p.
[in]OMxFThe differential angular velocity vector (index starting at 1) with components expressed in frame [P]. It is the difference between the parent angular velocity and the children angular velocity.
[in]AxFThe differential acceleration vector (index starting at 1) with components expressed in frame [P]. The accelerations are computed at the coordinates of point "M" linked to parent (Mdd_p), then linked to children (Mdd_c) body. The differential acceleration vector is : Mdd_c - Mdd_p.
[in]OMPxFThe differential angular acceleration vector (index starting at 1) with components expressed in frame [P]. It is the difference between the parent angular acceleration and the children angular acceleration.
[in,out]sThe MbsData structure of the model on which the force is computed.
[in]tsimThe current time of the simulation
[in]ixFThe ID identifying the computed link3D force.
Returns
A vector (of size 6, index starting at 1) with the content described for MbsData::l3DW The content of the returned vector Swr is [Fx; Fy; Fz; Mx; My; Mz]:
  • Force components (expressed in frame [P]) : Fx, Fy, Fz
  • Pure torque components (expressed in frame [P]) : Mx, My, Mz

◆ user_LinkForces()

double user_LinkForces ( double  Z,
double  Zd,
MbsData s,
double  tsim,
int  ilnk 
)

Compute the value of a link forces.

Parameters
[in]Zthe distance (>0) between the extremities of the link force.
[in]Zdthe relative velocity between the extremities of the link force, negative if the points get closer.
[in]sthe MbsData structure of the model on which the driven joint are computed.
[in]tsimthe current time of the simulation.
[in]ilnkthe ID identifying the computed link force.
Returns
The value of the link force. A positive value is a repelling force. A negative force value is an attractive effect.

◆ user_load_post()

void user_load_post ( MbsData mbs_data)

User own initialization operations.

This function will automatically be called at the project loading by mbs_load() function. The user can define in this function various initialization, allocation or configuration steps required by the project (ie. allocating and configuring user model of type being structure).

Parameters
[in,out]mbs_dataData structure of the model.