Robotran C Documentation

Loop and Inverse Kinematics

Computation of the inverse kinematics of system containing constraints (kinematics constraints or user-specified).
For more information, see Robotran theoritical framework.

Code sample

For running the kinematics, insert the following code in your main script and adapt it to your need :

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/* INVERSE KINEMATICS *
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
MbsSolvekin *mbs_solvekin;
mbs_data->process = 5;
mbs_solvekin = mbs_new_solvekin(mbs_data);
// solvekin options, to interpolate part of the previous motion
mbs_solvekin->options->t0 = 1.33333;
mbs_solvekin->options->tf = 1.4;
mbs_solvekin->options->dt = 1e-4;
mbs_solvekin->options->framerate = 10000;
mbs_solvekin->options->motion = trajectory;
mbs_solvekin->options->trajectoryqname = "../../resultsR/dirdyn_q.res";
mbs_solvekin->options->trajectoryqdname = "../../resultsR/dirdyn_qd.res";
mbs_solvekin->options->trajectoryqddname = "../../resultsR/dirdyn_qdd.res";
mbs_run_solvekin(mbs_solvekin, mbs_data);
mbs_delete_solvekin(mbs_solvekin, mbs_data);

Use

The inverse kinematics is performed by the function mbs_run_solvekin().

The user specifies the desired options of the inverse kinematics in MbsInvOptions structure. The results are provided in the MbsBuffer structure (par of the MbsSolvekin structure) and written to files at the end of computation. The results is provided in the MBS_solvekin structure.

You should calls succesively

MbsSolvekin::options
MbsInvOptions * options
Structure defining the option of a inverse kinematic analysis.
Definition: mbs_solvekin_struct.h:153
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
General structure of the inverse kinematics module.
Definition: mbs_solvekin_struct.h:149
MbsInvOptions::dt
double dt
Time step, default = 0.001.
Definition: mbs_solvekin_struct.h:86
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
MbsInvOptions::t0
double t0
Initial time of the simulation, default = 0.0.
Definition: mbs_solvekin_struct.h:76
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
trajectory
@ trajectory
Definition: mbs_solvekin_struct.h:25
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
MbsInvOptions::tf
double tf
Final time of the simulation, default = 5.0.
Definition: mbs_solvekin_struct.h:79
mbs_run_solvekin
int mbs_run_solvekin(MbsSolvekin *sk, MbsData *mbs_data)
Run the inverse kinematic analysis.
Definition: mbs_solvekin.c:101
MbsData::process
int process
Flag that indicate which module is currently running (1=partitioning, 2=equilibrium,...
Definition: mbs_data.h:297
mbs_new_solvekin
MbsSolvekin * mbs_new_solvekin(MbsData *mbs_data)
Create a new inverse kinematic structure.
Definition: mbs_solvekin.c:29
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