Robotran C Documentation
mbs_solvekin.h
Go to the documentation of this file.
1 
15 #ifndef MBS_SOLVEKIN_h
16 #define MBS_SOLVEKIN_h
17 
18 #include "mbs_data.h"
19 #include "mbs_solvekin_struct.h"
20 
21 
22 #ifdef __cplusplus
23 extern "C" {
24 #endif
25 
35 
47 MbsSolvekin* mbs_new_solvekin_aux(MbsAux* mbs_aux);
48 
59 int mbs_run_solvekin(MbsSolvekin* solvekin, MbsData* mbs_data);
60 
61 
70 int mbs_solvekin_init(MbsSolvekin* solvekin, MbsData* mbs_data);
71 
72 
84 int mbs_solvekin_loop(MbsSolvekin* solvekin, MbsData* mbs_data);
85 
86 
95 int mbs_solvekin_finish(MbsSolvekin* solvekin);
96 
97 
102 void mbs_delete_solvekin(MbsSolvekin* solvekin, MbsData* mbs_data);
103 
114 
123 
124 #ifdef __cplusplus
125 }
126 #endif
127 
128 #endif
MbsSolvekin::options
MbsInvOptions * options
Structure defining the option of a inverse kinematic analysis.
Definition: mbs_solvekin_struct.h:153
MbsLutRes::tq
double ** tq
2D array containing the time (first column) and the corresponding coordinates value
Definition: lut.h:44
mbs_solvekin_struct.h
free_sensor
void free_sensor(MbsSensor *psens)
Deprecated: Free the memory inside MbsSensor structure. i.e. free the space allocated for the jacobia...
Definition: mbs_sensor_utilities.c:44
mbs_lut_res_free
void mbs_lut_res_free(MbsLutRes *lut)
Release memory used by 2D LUT structure.
Definition: lut.c:105
MbsInvOptions::resfilename
char * resfilename
The keyword used for determining the name of result files.
Definition: mbs_solvekin_struct.h:94
mbs_solvekin_save
int mbs_solvekin_save(MbsSolvekin *sk, double t)
Save the values of solvekin analysis in the buffers.
Definition: mbs_solvekin.c:148
BUFFER_OTHER
@ BUFFER_OTHER
Definition: mbs_buffer.h:23
MbsSolvekin::savedArrays
double ** savedArrays
Pointer to the array that must be saved to buffers.
Definition: mbs_solvekin_struct.h:177
mbs_lut_res_interp
int mbs_lut_res_interp(MbsLutRes *lut, double t, double *coord)
Interpolate the coordinates from a Results Look Up Table for a specific time value.
Definition: lut.c:287
get_char_cpy
char * get_char_cpy(const char *fmt,...)
Copy the provided formatted string into a newly allocated memory.
Definition: useful_functions.c:191
MbsData::Ncons
int Ncons
Number of algebraic constraints.
Definition: mbs_data.h:218
MbsData::qd
double * qd
Array with the current values of the generalized velocities.
Definition: mbs_data.h:188
MbsData::dt0
double dt0
Initial value of the integration step size [s]. For dirdyn and invdyn only. This parameter is set fro...
Definition: mbs_data.h:212
MbsInvOptions::buffer_format
char * buffer_format
The format of the results in the res file.
Definition: mbs_solvekin_struct.h:137
MbsSolvekin::buffers
MbsBuffer ** buffers
Buffer to store generalized coordinates, velocities, acceleration.
Definition: mbs_solvekin_struct.h:167
MbsInvOptions::saveperiod
int saveperiod
The number of time steps between two buffer records.
Definition: mbs_solvekin_struct.h:118
allocate_sensor
void allocate_sensor(MbsSensor *psens, int njoint)
Allocate the Jacobian matrix of the MbsSensor according to the number of joints in the multibody syst...
Definition: mbs_sensor_utilities.c:17
MbsInvOptions::buffersize
int buffersize
The number of time step that can be recorded in the buffer.
Definition: mbs_solvekin_struct.h:130
MbsSolvekin::tindex
int tindex
Current time index.
Definition: mbs_solvekin_struct.h:163
mbs_solvekin_finish
int mbs_solvekin_finish(MbsSolvekin *sk)
Run the finalization operations of the run_solvekin function.
Definition: mbs_solvekin.c:655
MbsData::tsim
double tsim
The time value.
Definition: mbs_data.h:208
MbsSensor::OM
double OM[4]
Angular velocity vector of the sensor expressed in the inertial frame: .
Definition: mbs_sensor_struct.h:23
MbsData::nqrot
int nqrot
Number of rotational joint (R1, R2 or R3)
Definition: mbs_data.h:172
mbs_delete_sensor
void mbs_delete_sensor(MbsSensor *psens)
Free the memory of MbsSensor structure. and its contents.
Definition: mbs_sensor_utilities.c:57
mbs_error_msg
void mbs_error_msg(char *msg,...)
Send an error message.
Definition: mbs_message.c:102
MbsData::nqv
int nqv
Number of dependent articulations.
Definition: mbs_data.h:170
MbsInvOptions::max_save_user
int max_save_user
The maximal number of user variables saved.
Definition: mbs_solvekin_struct.h:123
mbs_fct_solvekin
int mbs_fct_solvekin(MbsData *s, MbsSolvekin *sk)
inverse kinematics computation of q, qd and qdd
Definition: mbs_solvekin.c:743
mbs_data.h
MbsData::qc
int * qc
Array with the indices of driven (locked and driven) articulations.
Definition: mbs_data.h:175
MbsData::nqu
int nqu
Number of independent articulations.
Definition: mbs_data.h:165
_MBS_ERR_LOW_FILES
#define _MBS_ERR_LOW_FILES
Low Level error number Error during opening/writing files = -9.
Definition: mbs_errors_names.h:147
MbsData::njoint
int njoint
Number of joints in the system.
Definition: mbs_data.h:162
mbs_project_interface.h
mbs_buffer_write
int mbs_buffer_write(MbsBuffer *b)
Write the content of the buffer to disk.
Definition: mbs_buffer.c:347
MbsData::tf
double tf
Final time of the simulation [s]. For dirdyn and invdyn only. This parameter is set from dirdyn/invyn...
Definition: mbs_data.h:211
MbsInvOptions::trajectoryqddname
char * trajectoryqddname
Give the path and filename (with extention) to the file containing the input trajectory in accelerati...
Definition: mbs_solvekin_struct.h:73
MbsSolvekin::qdd
MbsLutRes * qdd
Definition: mbs_solvekin_struct.h:192
MbsLutRes::nt
int nt
number of time steps
Definition: lut.h:43
mbs_comp_gen_sensor
void mbs_comp_gen_sensor(MbsSensor *psens, MbsData *mbs_data, int joint_id)
Compute all fields of a sensor located on the specified joint.
Definition: mbs_sensor_utilities.c:76
closeloop
@ closeloop
Definition: mbs_solvekin_struct.h:25
mbs_delete_solvekin
void mbs_delete_solvekin(MbsSolvekin *solvekin, MbsData *mbs_data)
Free memory of the inverse kinematic structure The options (MbsInvOptions) and MbsAux structures are ...
Definition: mbs_solvekin.c:85
mbs_solvekin_loop
int mbs_solvekin_loop(MbsSolvekin *sk, MbsData *mbs_data)
Time loop of the run_solvekin function:
Definition: mbs_solvekin.c:498
MbsSolvekin::q
MbsLutRes * q
Pointer to save the input trajectories.
Definition: mbs_solvekin_struct.h:192
free_set_output
void free_set_output()
release memory of auto_output
Definition: set_output.c:56
mbs_solvekin_loop
int mbs_solvekin_loop(MbsSolvekin *solvekin, MbsData *mbs_data)
Time loop of the run_solvekin function:
Definition: mbs_solvekin.c:498
MbsSolvekin
General structure of the inverse kinematics module.
Definition: mbs_solvekin_struct.h:149
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.
Definition: mbs_buffer.c:212
MbsInvOptions::dt
double dt
Time step, default = 0.001.
Definition: mbs_solvekin_struct.h:86
MbsSensor::V
double V[4]
Velocity vector of the sensor expressed in the inertial frame: .
Definition: mbs_sensor_struct.h:22
mbs_growing_buffer_write
int mbs_growing_buffer_write(MbsGrowingBuffer *b)
write the content of the growing buffer to disk
Definition: mbs_buffer.c:557
_MBS_ERR_MOD_SPEC_15
#define _MBS_ERR_MOD_SPEC_15
Generic error number Module specific errors range from -11 to -19 please read the error message a...
Definition: mbs_errors_names.h:186
BUFFER_Q
@ BUFFER_Q
Definition: mbs_buffer.h:21
_MBS_ERR_LOW_NAN
#define _MBS_ERR_LOW_NAN
Low Level error number Number is NaN (not a number) = -7.
Definition: mbs_errors_names.h:142
MbsInvOptions::motion
int motion
Determines how the evolution of q, qd qdd are provided.
Definition: mbs_solvekin_struct.h:40
MbsInvOptions::framerate
int framerate
Number of frame per second for the .anim file, default = 1000.
Definition: mbs_solvekin_struct.h:113
MbsData::flag_optim_symb_sin_cos
int flag_optim_symb_sin_cos
allow the "optimisation" of the computation of the sine/cosine in the symbolic files....
Definition: mbs_data.h:198
_MBS_ERR_INIT
#define _MBS_ERR_INIT
Generic error number Check user options at initialization = -10.
Definition: mbs_errors_names.h:156
MBSfun.h
mbs_close_kin
void mbs_close_kin(MbsData *s, MbsAux *mbs_aux)
compute the dependent velocities that solves the constraints.
Definition: mbs_close_loops.c:140
mbs_check_nhu_nqv
int mbs_check_nhu_nqv(MbsData *mbs_data)
Check the coherence between the number of (independant) constraints and the number of dependant varia...
Definition: mbs_check.c:19
MbsInvOptions::t0
double t0
Initial time of the simulation, default = 0.0.
Definition: mbs_solvekin_struct.h:76
_MBS_ERR_MOD_INV_KIN
#define _MBS_ERR_MOD_INV_KIN
Module error number module: Inverse Kinematics = -500.
Definition: mbs_errors_names.h:63
MbsLutRes::nq
int nq
number coordinates
Definition: lut.h:42
MbsSensor::J
double ** J
Jacobian matrix of the sensor: .
Definition: mbs_sensor_struct.h:26
mbs_new_solvekin
MbsSolvekin * mbs_new_solvekin(MbsData *mbs_data)
Create a new inverse kinematic structure.
Definition: mbs_solvekin.c:29
MbsInvOptions::animpath
const char * animpath
Path in which anim file is saved.
Definition: mbs_solvekin_struct.h:104
mbs_solvekin.h
MbsInvOptions::trajectoryqname
char * trajectoryqname
Give the path and filename (with extention) to the file containing the input trajectory in position o...
Definition: mbs_solvekin_struct.h:51
MbsData::flag_safety_checks
int flag_safety_checks
Flag to activate safety checks everywhere in mbsysc core. Faster computation if this flag is put to 0...
Definition: mbs_data.h:307
mbs_msg
void mbs_msg(char *msg,...)
Send a message.
Definition: mbs_message.c:76
MbsBuffer
Definition: mbs_buffer.h:46
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.
Definition: mbs_buffer.c:253
mbs_gensensor
void mbs_gensensor(MbsSensor *sens, MbsData *s, int isens)
Definition: mbs_project_fct_ptr.c:60
mbs_delete_buffer
void mbs_delete_buffer(MbsBuffer *b)
Free memory of the specified MbsBuffer.
Definition: mbs_buffer.c:164
MbsSensor::R
double ** R
Rotation matrix from the inertial frame to the sensor frame: .
Definition: mbs_sensor_struct.h:21
mbs_delete_growing_buffer
void mbs_delete_growing_buffer(MbsGrowingBuffer *b)
release memory for growing buffer
Definition: mbs_buffer.c:188
MbsData::qu
int * qu
Array with the indices of the independent articulations (free)
Definition: mbs_data.h:174
mbs_fct_solvekin
int mbs_fct_solvekin(MbsData *s, MbsSolvekin *sk)
inverse kinematics computation of q, qd and qdd
Definition: mbs_solvekin.c:743
MbsData::qv
int * qv
Array with the indices of the dependent articulations .
Definition: mbs_data.h:182
init_sensor
void init_sensor(MbsSensor *psens, int njoint)
Initialize all fields of MbsSensor structure to 0.
Definition: mbs_sensor_utilities.c:22
freeMbsAux
void freeMbsAux(MbsAux *mbs_aux, MbsData *s)
Definition: mbs_aux.c:174
MbsSolvekin::bufferNb
int bufferNb
Number of buffers.
Definition: mbs_solvekin_struct.h:174
mbs_solvekin_finish
int mbs_solvekin_finish(MbsSolvekin *solvekin)
Run the finalization operations of the run_solvekin function.
Definition: mbs_solvekin.c:655
MbsData::q
double * q
Array with the current values of the generalized coordinates.
Definition: mbs_data.h:187
MbsInvOptions::verbose
int verbose
Gives informations during the process.
Definition: mbs_solvekin_struct.h:143
free_dvec_1
void free_dvec_1(double *vec)
release memory for a vector of doubles, starting at index 1
Definition: mbs_1D_array.c:901
BUFFER_QD
@ BUFFER_QD
Definition: mbs_buffer.h:21
MbsData::Nsensor
int Nsensor
< Array of l3DWr vector for each 3D link forces.
Definition: mbs_data.h:260
mbs_new_sensor
MbsSensor * mbs_new_sensor(MbsData *mbs_data)
Create a new MbsSensor structure, allocate and initialize the memory for all fields.
Definition: mbs_sensor_utilities.c:50
trajectory
@ trajectory
Definition: mbs_solvekin_struct.h:25
MbsData::project_path
char * project_path
Path to the mbs project folder.
Definition: mbs_data.h:312
MbsSensor::P
double P[4]
Position vector of the sensor expressed in the inertial frame: .
Definition: mbs_sensor_struct.h:20
_MBS_ERR_MOD_SPEC_12
#define _MBS_ERR_MOD_SPEC_12
Generic error number Module specific errors range from -11 to -19 please read the error message a...
Definition: mbs_errors_names.h:168
mbs_init_sin_cos_q_vecs
int mbs_init_sin_cos_q_vecs(MbsData *s, int *qrot_qu_indvec, int *qrot_qc_indvec, int *qrot_qv_indvec)
Initialize the three vectors of indices (they are usually contained in the mbs_aux structure)
Definition: mbs_trigo.c:23
MbsInvOptions::trajectoryqdname
char * trajectoryqdname
Give the path and filename (with extention) to the file containing the input trajectory in velocity o...
Definition: mbs_solvekin_struct.h:62
mbs_check_mbs_data_values
int mbs_check_mbs_data_values(MbsAux *module_mbs_aux, MbsData *mbs_data)
Check the coherence between the mbs_data used before module initialization and module run.
Definition: mbs_check.c:87
mbs_trigo.h
This header defines the functions for trigonometric handling in MBsysC integrator in C.
mbs_sensor.h
mbs_new_solvekin_aux
MbsSolvekin * mbs_new_solvekin_aux(MbsAux *mbs_aux)
Fills a new inverse kinematic structure.
Definition: mbs_solvekin.c:39
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
Definition: mbs_buffer.c:120
MbsInvOptions::tf
double tf
Final time of the simulation, default = 5.0.
Definition: mbs_solvekin_struct.h:79
MbsInvOptions
Structure defining the option of both inverse kinematics and inverse dynamic analysis.
Definition: mbs_solvekin_struct.h:31
mbs_lut_res_load_file
MbsLutRes * mbs_lut_res_load_file(char *fileName)
Load a file and return a new allocated results LUT structure.
Definition: lut.c:827
lut.h
Interpolation of value from array (Look Up Table) main header.
MbsData::nqc
int nqc
Number of driven articulations, it includes qlocked and qdriven.
Definition: mbs_data.h:166
set_output.h
set_output function called by the user to output his own variables
mbs_message.h
_MBS_ERR_MOD_SPEC_14
#define _MBS_ERR_MOD_SPEC_14
Generic error number Module specific errors range from -11 to -19 please read the error message a...
Definition: mbs_errors_names.h:180
mbs_close_geo
int mbs_close_geo(MbsData *s, MbsAux *mbs_aux)
compute a position of the multibody system which solves the constraints
Definition: mbs_close_loops.c:43
mbs_run_solvekin
int mbs_run_solvekin(MbsSolvekin *solvekin, MbsData *mbs_data)
Run the inverse kinematic analysis.
Definition: mbs_solvekin.c:101
MbsInvOptions::respath
const char * respath
Path in which result file are saved.
Definition: mbs_solvekin_struct.h:99
mbs_calc_jdqd
void mbs_calc_jdqd(MbsData *s, MbsAux *mbs_aux)
compute the quadratic term of the constraints at acceleration level:
Definition: mbs_close_loops.c:216
initMbsAux
MbsAux * initMbsAux(MbsData *s)
Definition: mbs_aux.c:18
mbs_comp_S_sensor
void mbs_comp_S_sensor(MbsSensor *psens, MbsData *mbs_data, int isens)
Compute all fields of the specified sensor.
Definition: mbs_sensor_utilities.c:66
MbsSolvekin::tsim
double tsim
Current simulation time.
Definition: mbs_solvekin_struct.h:160
MbsData
Definition: mbs_data.h:149
MbsSensor::OMP
double OMP[4]
Angular acceleration vector of the sensor expressed in the inertial frame: .
Definition: mbs_sensor_struct.h:25
oneshot
@ oneshot
Definition: mbs_solvekin_struct.h:25
mbs_run_solvekin
int mbs_run_solvekin(MbsSolvekin *sk, MbsData *mbs_data)
Run the inverse kinematic analysis.
Definition: mbs_solvekin.c:101
_MBS_ERR_MOD_SPEC_11
#define _MBS_ERR_MOD_SPEC_11
Mid Level error number Module specific errors range from -11 to -19 please read the error message...
Definition: mbs_errors_names.h:162
mbs_new_solvekin_aux
MbsSolvekin * mbs_new_solvekin_aux(MbsAux *mbs_aux)
Fills a new inverse kinematic structure.
Definition: mbs_solvekin.c:39
mbs_compute_sin_cos_quc
void mbs_compute_sin_cos_quc(MbsData *s, int *qrot_qu_indvec, int *qrot_qc_indvec)
Compute the sine and cosine of the q_sin and q_cos, only for the rotational joints that are independe...
Definition: mbs_trigo.c:65
MbsSensor
Definition: mbs_sensor_struct.h:18
get_output_vector_size
int get_output_vector_size(int index)
get the output vector size corresponding to the requested index
Definition: set_output.c:222
mbs_sensor
void mbs_sensor(MbsSensor *sens, MbsData *s, int isens)
Compute all fields of a sensor (force sensor or classic sensor).
Definition: mbs_project_fct_ptr.c:56
MbsData::t0
double t0
Initial time of the simulation [s]. For dirdyn and invdyn only. This parameter is set from dirdyn/inv...
Definition: mbs_data.h:210
get_output_vector_nb
int get_output_vector_nb()
get the number of user vector inputs
Definition: set_output.c:240
init_set_output
void init_set_output(int max_nb_curves)
initialize the static auto_output structure
Definition: set_output.c:23
mbs_solvekin_write_buffers
int mbs_solvekin_write_buffers(MbsSolvekin *sk)
Write the content of buffer associated to the given MbsSolvekin to disk.
Definition: mbs_solvekin.c:726
MbsData::flag_stop
int flag_stop
stop the simulation. For dirdyn, equil, invdyn and solvekin only.
Definition: mbs_data.h:298
get_dvec_1
double * get_dvec_1(int l_v)
create (with memory allocation) a vector (length l_v) of doubles, starting at index 1
Definition: mbs_1D_array.c:885
MbsInvOptions::save2file
int save2file
Determine whether results are written to files on disk (in MbsSolvekinOptions::respath folder):
Definition: mbs_solvekin_struct.h:91
BUFFER_QDD
@ BUFFER_QDD
Definition: mbs_buffer.h:21
free_dmat_1
void free_dmat_1(double **mat)
release memory for a matrix of doubles, starting at index 1
Definition: mbs_matrix.c:301
mbs_comp_F_sensor
void mbs_comp_F_sensor(MbsSensor *psens, MbsData *mbs_data, int isens)
Compute all fields of the specified force sensor.
Definition: mbs_sensor_utilities.c:71
mbs_solvekin_write_buffers
int mbs_solvekin_write_buffers(MbsSolvekin *sk)
Write the content of buffer associated to the given MbsSolvekin to disk.
Definition: mbs_solvekin.c:726
get_dmat_1
double ** get_dmat_1(int nb_r, int nb_c)
create (with memory allocation) a [nb_r times nb_c] matrix of doubles, starting at index 1
Definition: mbs_matrix.c:255
reset_flag_output
void reset_flag_output()
reset the flag_output to 0. Useful when running several simulation in a row with different save2file ...
Definition: set_output.c:15
MbsSensor::A
double A[4]
Acceleration vector of the sensor expressed in the inertial frame: .
Definition: mbs_sensor_struct.h:24
mbs_new_solvekin
MbsSolvekin * mbs_new_solvekin(MbsData *mbs_data)
Create a new inverse kinematic structure.
Definition: mbs_solvekin.c:29
MbsSolvekin::user_buffer
MbsGrowingBuffer * user_buffer
Growing buffer to store user values.
Definition: mbs_solvekin_struct.h:171
MbsInvOptions::save_anim
int save_anim
Determine whether animation file is generated (only valid if MbsSolvekinOptions::save2file is set to ...
Definition: mbs_solvekin_struct.h:110
mbs_step_close_geo
int mbs_step_close_geo(MbsData *s, MbsAux *mbs_aux)
compute an iteration of the position of the multibody system to solve the constraints
Definition: mbs_close_loops.c:81
MbsSolvekin::trajectorytype
int trajectorytype
Value to store the type of trajectory provided by the user, automatically set.
Definition: mbs_solvekin_struct.h:189
MbsData::qdd
double * qdd
Array with the current values of the generalized acceleration.
Definition: mbs_data.h:189
get_output_vector_label
char * get_output_vector_label(int index)
get the output vector label corresponding to the requested index
Definition: set_output.c:211
mbs_delete_solvekin
void mbs_delete_solvekin(MbsSolvekin *solvekin, MbsData *mbs_data)
Free memory of the inverse kinematic structure The options (MbsInvOptions) and MbsAux structures are ...
Definition: mbs_solvekin.c:85
mbs_check.h
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.
Definition: mbs_buffer.c:27
MbsSolvekin::qd
MbsLutRes * qd
Definition: mbs_solvekin_struct.h:192
mbs_solvekin_init
int mbs_solvekin_init(MbsSolvekin *sk, MbsData *mbs_data)
Run the startup operations of the run_solvekin function.
Definition: mbs_solvekin.c:183
MbsSolvekin::mbs_aux
MbsAux * mbs_aux
Structure to store auxiliary value needed during computation.
Definition: mbs_solvekin_struct.h:156
mbs_solvekin_init
int mbs_solvekin_init(MbsSolvekin *solvekin, MbsData *mbs_data)
Run the startup operations of the run_solvekin function.
Definition: mbs_solvekin.c:183
MbsData::nhu
int nhu
Number of independent constraints.
Definition: mbs_data.h:171
get_output_vector_ptr
double * get_output_vector_ptr(int index)
get the pointer to the output vector at the requested index
Definition: set_output.c:259
user_DrivenJoints
void user_DrivenJoints(MbsData *mbs_data, double tsim)
Compute the positions, velocities and acceleration of driven joint.
Definition: user_DrivenJoints.c:15
mbs_errors_names.h