liba 0.1.15
An algorithm library based on C/C++
 
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
Loading...
Searching...
No Matches
trapezoidal velocity trajectory
Collaboration diagram for trapezoidal velocity trajectory:

Data Structures

struct  a_trajtrap
 instance structure for trapezoidal velocity trajectory More...
 

Typedefs

typedef struct a_trajtrap a_trajtrap
 

Functions

a_real a_trajtrap_gen (a_trajtrap *ctx, a_real vm, a_real ac, a_real de, a_real p0, a_real p1, a_real v0, a_real v1)
 generate for trapezoidal velocity trajectory
 
a_real a_trajtrap_pos (a_trajtrap const *ctx, a_real x)
 compute position for trapezoidal velocity trajectory
 
a_real a_trajtrap_vel (a_trajtrap const *ctx, a_real x)
 compute velocity for trapezoidal velocity trajectory
 
a_real a_trajtrap_acc (a_trajtrap const *ctx, a_real x)
 compute acceleration for trapezoidal velocity trajectory
 

Detailed Description

Function Documentation

◆ a_trajtrap_acc()

a_real a_trajtrap_acc ( a_trajtrap const * ctx,
a_real x )

compute acceleration for trapezoidal velocity trajectory

p¨(t)={a,t[0,ta)0,t[ta,td)d,t[td,T]

Parameters
[in]ctxpoints to an instance of trapezoidal velocity trajectory
[in]xdifference between current time and initial time
Returns
acceleration output

◆ a_trajtrap_gen()

a_real a_trajtrap_gen ( a_trajtrap * ctx,
a_real vm,
a_real ac,
a_real de,
a_real p0,
a_real p1,
a_real v0,
a_real v1 )

generate for trapezoidal velocity trajectory

Assuming that there is no constant velocity phase, but only acceleration and deceleration phases, the maximum velocity in the motion is v, then we have

v2v022a+v12v22d=p1p0

Solving for the maximum velocity is

|v|=av12dv022ad(p1p0)ad

  1. If |v|>|vm|, then there is a constant velocity phase.

    pa=p0+v0Ta+12aTa2

    ad=p1vcTd12dTd2

    {Ta=vmv0aTc=pdpavcTd=v1vmd

  2. Otherwise there is no constant velocity phase.
    a. If |v0|<|v||v1|, there is only an acceleration phase.

    |v1|=v02+2a(p1p0)

    {Ta=v1v0aTc=0Td=0

    b. If |v0||v|>|v1|, there is only a deceleration phase.

    |v1|=v02+2d(p1p0)

    {Ta=0Tc=0Td=v1v0d

    c. If |v|>|v0|, |v|>|v1|, then there are acceleration and deceleration phases.

    {Ta=vv0aTc=0Td=v1vd

  3. Finally, the position and velocity are computed using the formula.
    Parameters
    [in,out]ctxpoints to an instance of trapezoidal velocity trajectory
    [in]vmdefines the maximum velocity during system operation
    [in]acdefines the acceleration before constant velocity
    [in]dedefines the acceleration after constant velocity
    [in]p0defines the initial position
    [in]p1defines the final position
    [in]v0defines the initial velocity
    [in]v1defines the final velocity
    Returns
    total duration

◆ a_trajtrap_pos()

a_real a_trajtrap_pos ( a_trajtrap const * ctx,
a_real x )

compute position for trapezoidal velocity trajectory

p(t)={v0+12at2,t[0,ta)pa+vc(tta),t[ta,td)pd+vc(ttd)+12d(ttd)2,t[td,T]

Parameters
[in]ctxpoints to an instance of trapezoidal velocity trajectory
[in]xdifference between current time and initial time
Returns
position output

◆ a_trajtrap_vel()

a_real a_trajtrap_vel ( a_trajtrap const * ctx,
a_real x )

compute velocity for trapezoidal velocity trajectory

p˙(t)={v0+at,t[0,ta)vc,t[ta,td)vc+d(ttd),t[td,T]

Parameters
[in]ctxpoints to an instance of trapezoidal velocity trajectory
[in]xdifference between current time and initial time
Returns
velocity output