Robotran C Documentation
Functions
mbs_trajectories.c File Reference
#include "mbs_trajectories.h"
#include "mbs_message.h"

Functions

int mbs_get_ramp_time (double *t1, double *t2, double *t3, double delta_q, double v12, double a01, double a23, double t0)
 Compute the time related to a ramp trajectory. More...
 
int mbs_ramp_3_order (double *q, double *qd, double *qdd, double tsim, double t0, double t1, double qmax)
 Compute a 3-order ramp trajectory. More...
 
int mbs_ramp_5_order (double *q, double *qd, double *qdd, double tsim, double t0, double t1, double qmax)
 Compute a 5-order ramp trajectory. More...
 
int mbs_ramp_2_order_3_piece_from_acc_vel (double *q, double *qd, double *qdd, double tsim, double v12, double a01, double a23, double t0, double qmax)
 Compute a 3-piece 2-order ramp trajectory. More...
 
int mbs_ramp_2_order_3_piece (double *q, double *qd, double *qdd, double tsim, double t0, double t1, double t2, double t3, double qmax)
 Compute a 3-piece 2-order ramp trajectory. More...
 
int mbs_ramp_3_order_3_piece (double *q, double *qd, double *qdd, double tsim, double t0, double t1, double t2, double t3, double qmax)
 Compute a 3-piece 3-order ramp trajectory. More...
 
int mbs_ramp_4_order_3_piece (double *q, double *qd, double *qdd, double tsim, double t0, double t1, double t2, double t3, double qmax)
 Compute a 3-piece 4-order ramp trajectory. More...
 
void sweep (double tsim, double t0, double f0, double t1, double f1, double zmax, double *z, double *zd, double *zdd)
 Compute a frequency sweep on a sine signal. More...
 
void mbs_sine_signal (double tsim, double ampl, double phi, double f, double off, double *q, double *qd, double *qdd)
 Compute a sine trajectory. More...
 
void mbs_cosine_signal (double tsim, double ampl, double phi, double f, double off, double *q, double *qd, double *qdd)
 Compute a cosine trajectory. More...
 
void mbs_sigmoid (double tsim, double lambda, double t0, double *q, double *qd, double *qdd)
 Compute a sigmoid signal. More...
 
void mbs_add_signal (double q1, double qd1, double qdd1, double q2, double qd2, double qdd2, double *q3, double *qd3, double *qdd3)
 Compute the sum of 2 signals. More...
 
void mbs_sub_signal (double q1, double qd1, double qdd1, double q2, double qd2, double qdd2, double *q3, double *qd3, double *qdd3)
 Compute the substraction of 2 signals. More...
 
void mbs_mult_signal (double q1, double qd1, double qdd1, double q2, double qd2, double qdd2, double *q3, double *qd3, double *qdd3)
 Compute the multiplication of 2 signals. More...
 
int mbs_div_signal (double q1, double qd1, double qdd1, double q2, double qd2, double qdd2, double *q3, double *qd3, double *qdd3)
 Compute the division of 2 signals. More...
 

Function Documentation

◆ mbs_add_signal()

void mbs_add_signal ( double  q1,
double  qd1,
double  qdd1,
double  q2,
double  qd2,
double  qdd2,
double *  q3,
double *  qd3,
double *  qdd3 
)

Compute the sum of 2 signals.

Compute the position, velocity and acceleration of the sum of 2 signals.

Parameters
[in]q1position of the first signal.
[in]qd1velocity of the first signal.
[in]qdd1acceleration of the first signal.
[in]q2position of the second signal.
[in]qd2velocity of the fsecond signal.
[in]qdd2acceleration of the second signal.
[out]q3position of the sum.
[out]qd3velocity of the sum.
[out]qdd3acceleration of the sum.

◆ mbs_cosine_signal()

void mbs_cosine_signal ( double  tsim,
double  ampl,
double  phi,
double  f,
double  off,
double *  q,
double *  qd,
double *  qdd 
)

Compute a cosine trajectory.

Compute the position, velocity and acceleration of a cosine trajectory q = ampl * cos(2 * pi * f * t + phi) + off

Parameters
[in]tsimtime of the simulation.
[in]amplamplitude of the cosine function.
[in]phiphase angle of the cosine function.
[in]ffrequency of the cosine function.
[in]offoffset of the cosine function.
[out]qposition.
[out]qdvelocity.
[out]qddacceleration.

◆ mbs_div_signal()

int mbs_div_signal ( double  q1,
double  qd1,
double  qdd1,
double  q2,
double  qd2,
double  qdd2,
double *  q3,
double *  qd3,
double *  qdd3 
)

Compute the division of 2 signals.

Compute the position, velocity and acceleration of the division of 2 signals.

Parameters
[in]q1position of the first signal.
[in]qd1velocity of the first signal.
[in]qdd1acceleration of the first signal.
[in]q2position of the second signal.
[in]qd2velocity of the fsecond signal.
[in]qdd2acceleration of the second signal.
[out]q3position of the division q1/q2.
[out]qd3velocity of the division.
[out]qdd3acceleration of the division.
Returns
Error status, <0 in case of failure.

◆ mbs_get_ramp_time()

int mbs_get_ramp_time ( double *  t1,
double *  t2,
double *  t3,
double  delta_q,
double  v12,
double  a01,
double  a23,
double  t0 
)

Compute the time related to a ramp trajectory.

Compute the time instant for a ramp when position, constant speed and acceleration/deceleration are given

Parameters
[out]t1stop time of the acceleration.
[out]t2stop time of the constant speed.
[out]t3stop time.
[in]t0start time.
[in]delta_qdifference between start and end position.
[in]v12constant speed (>0).
[in]a01acceleration (>0).
[in]a23deceleration (<0).
Returns
Error status, <0 in case of failure.

◆ mbs_mult_signal()

void mbs_mult_signal ( double  q1,
double  qd1,
double  qdd1,
double  q2,
double  qd2,
double  qdd2,
double *  q3,
double *  qd3,
double *  qdd3 
)

Compute the multiplication of 2 signals.

Compute the position, velocity and acceleration of the multiplication of 2 signals.

Parameters
[in]q1position of the first signal.
[in]qd1velocity of the first signal.
[in]qdd1acceleration of the first signal.
[in]q2position of the second signal.
[in]qd2velocity of the fsecond signal.
[in]qdd2acceleration of the second signal.
[out]q3position of the multiplication.
[out]qd3velocity of the multiplication.
[out]qdd3acceleration of the multiplication.

◆ mbs_ramp_2_order_3_piece()

int mbs_ramp_2_order_3_piece ( double *  q,
double *  qd,
double *  qdd,
double  tsim,
double  t0,
double  t1,
double  t2,
double  t3,
double  qmax 
)

Compute a 3-piece 2-order ramp trajectory.

Compute the position, velocity and acceleration of a 3-piece 2-order ramp trajectory. Position at start time and velocity at start and stop time are equal to zero. Position at end time is equal to qmax. Postion and velocity are continuous at intermediate times.

Parameters
[in]t0start time.
[in]t1first intermediate time.
[in]t2second intermediate time.
[in]t3stop time.
[in]tsimsimulation time.
[in]qmaxamplitude of the ramp.
[out]qposition.
[out]qdvelocity.
[out]qddacceleration.
Returns
Error status, <0 in case of failure.

◆ mbs_ramp_2_order_3_piece_from_acc_vel()

int mbs_ramp_2_order_3_piece_from_acc_vel ( double *  q,
double *  qd,
double *  qdd,
double  tsim,
double  v12,
double  a01,
double  a23,
double  t0,
double  qmax 
)

Compute a 3-piece 2-order ramp trajectory.

Compute the position, velocity and acceleration of a 3-piece 2-order ramp trajectory from the constant acceleration in the first and third piece and the constant velocity in the second piece. Position at start time and velocity at start and stop time are equal to zero. Position at end time is equal to qmax. Postion and velocity are continuous at intermediate time.

Parameters
[in]v12velocity in the second piece (>0).
[in]a01acceleration in the first piece (>0).
[in]a23acceleration in the third piece (<=0).
[in]tsimsimulation time.
[in]qmaxamplitude of the ramp
[out]qposition.
[out]qdvelocity.
[out]qddacceleration.
Returns
Error status, <0 in case of failure.

◆ mbs_ramp_3_order()

int mbs_ramp_3_order ( double *  q,
double *  qd,
double *  qdd,
double  tsim,
double  t0,
double  t1,
double  qmax 
)

Compute a 3-order ramp trajectory.

Compute the position, velocity and acceleration of a 3-order ramp trajectory. Position at start time and velocity at start and stop time are equal to zero. Position at end time is equal to qmax.

Parameters
[in]t0start time.
[in]t1stop time.
[in]tsimsimulation time.
[in]qmaxamplitude of the ramp.
[out]qposition.
[out]qdvelocity.
[out]qddacceleration.
Returns
Error status, <0 in case of failure.

◆ mbs_ramp_3_order_3_piece()

int mbs_ramp_3_order_3_piece ( double *  q,
double *  qd,
double *  qdd,
double  tsim,
double  t0,
double  t1,
double  t2,
double  t3,
double  qmax 
)

Compute a 3-piece 3-order ramp trajectory.

Compute the position, velocity and acceleration of a 3-piece 3-order ramp trajectory. Position at start time, velocity and acceleration at start and stop time are equal to zero. Position at end time is equal to qmax. Postion and velocity and acceleration are continuous at intermediate times. Position is cubic in the intermediate time interval.

Parameters
[in]t0start time.
[in]t1first intermediate time.
[in]t2second intermediate time.
[in]t3stop time.
[in]tsimsimulation time.
[in]qmaxamplitude of the ramp.
[out]qposition.
[out]qdvelocity.
[out]qddacceleration.
Returns
Error status, <0 in case of failure.

◆ mbs_ramp_4_order_3_piece()

int mbs_ramp_4_order_3_piece ( double *  q,
double *  qd,
double *  qdd,
double  tsim,
double  t0,
double  t1,
double  t2,
double  t3,
double  qmax 
)

Compute a 3-piece 4-order ramp trajectory.

Compute the position, velocity and acceleration of a 3-piece 4-order ramp trajectory. Position at start time and velocity at start and stop time are equal to zero. Position at end time is equal to qmax. Postion and velocity are continuous at intermediate time. Postion and velocity and acceleration are continuous at intermediate times. Position is linear in the intermediate time interval.

Parameters
[in]t0start time.
[in]t1first intermediate time.
[in]t2second intermediate time.
[in]t3stop time.
[in]tsimsimulation time.
[in]qmaxamplitude of the ramp.
[out]qposition.
[out]qdvelocity.
[out]qddacceleration.
Returns
Error status, <0 in case of failure.

◆ mbs_ramp_5_order()

int mbs_ramp_5_order ( double *  q,
double *  qd,
double *  qdd,
double  tsim,
double  t0,
double  t1,
double  qmax 
)

Compute a 5-order ramp trajectory.

Compute the position, velocity and acceleration of a 3-order ramp trajectory. Position at start time and velocity at start and stop time are equal to zero. Position at end time is equal to qmax.

Parameters
[in]t0start time.
[in]t1stop time.
[in]tsimsimulation time.
[in]qmaxamplitude of the ramp.
[out]qposition.
[out]qdvelocity.
[out]qddacceleration.
Returns
Error status, <0 in case of failure.

◆ mbs_sigmoid()

void mbs_sigmoid ( double  tsim,
double  lambda,
double  t0,
double *  q,
double *  qd,
double *  qdd 
)

Compute a sigmoid signal.

Compute the position, velocity and acceleration of a sigmoid signal. See https://fr.wikipedia.org/wiki/Sigmoïde_(mathématiques)

Parameters
[in]tsimtime of the simulation.
[in]t0inflection point of the sigmoid.
[in]lambdalinked to the curvature. It is equal to four times the derivative at the inflection point.
[out]qposition.
[out]qdvelocity.
[out]qddacceleration.

◆ mbs_sine_signal()

void mbs_sine_signal ( double  tsim,
double  ampl,
double  phi,
double  f,
double  off,
double *  q,
double *  qd,
double *  qdd 
)

Compute a sine trajectory.

Compute the position, velocity and acceleration of a sine trajectory. q = ampl * sin(2 * pi * f * t + phi) + off

Parameters
[in]tsimtime of the simulation.
[in]amplamplitude of the sine function.
[in]phiphase angle of the sine function.
[in]ffrequency of the sine function.
[in]offposition offset of the sine function.
[out]qposition.
[out]qdvelocity.
[out]qddacceleration.

◆ mbs_sub_signal()

void mbs_sub_signal ( double  q1,
double  qd1,
double  qdd1,
double  q2,
double  qd2,
double  qdd2,
double *  q3,
double *  qd3,
double *  qdd3 
)

Compute the substraction of 2 signals.

Compute the position, velocity and acceleration of the substraction of 2 signals.

Parameters
[in]q1position of the first signal.
[in]qd1velocity of the first signal.
[in]qdd1acceleration of the first signal.
[in]q2position of the second signal.
[in]qd2velocity of the fsecond signal.
[in]qdd2acceleration of the second signal.
[out]q3position of the substraction q1-q2.
[out]qd3velocity of the substraction.
[out]qdd3acceleration of the substraction.

◆ sweep()

void sweep ( double  tsim,
double  t0,
double  f0,
double  t1,
double  f1,
double  zmax,
double *  z,
double *  zd,
double *  zdd 
)

Compute a frequency sweep on a sine signal.

Compute the position, velocity and acceleration of a sine signal with a frequency sweep. Frequency increases linearly with time.

Parameters
[in]tsimtime of the simulation.
[in]t0start time.
[in]t1stop time.
[in]f0start frequency.
[in]f1stop frequency.
[in]zmaxamplitude of oscillation.
[out]zposition.
[out]zdvelocity.
[out]zddacceleration.