Class VelocityProfileATrap

Inheritance Relationships

Base Type

  • public KDL::VelocityProfile

Class Documentation

class VelocityProfileATrap : public KDL::VelocityProfile

A PTP Trajectory Generator of Asymmetric Trapezoidal Velocity Profile. Differences to VelocityProfile_Trap:

  • Maximal acceleration and deceleration can be different, resulting an asymmetric trapezoid shaped velocity profile.

  • Function to generate full synchronized PTP trajectory is provided.

  • Function to generate trapezoid shaped velocity profile with start velocity.

Public Functions

VelocityProfileATrap(double max_vel = 0, double max_acc = 0, double max_dec = 0)

Constructor.

Parameters:
  • max_vel – maximal velocity (absolute value, always positive)

  • max_acc – maximal acceleration (absolute value, always positive)

  • max_dec – maximal deceleration (absolute value, always positive)

void SetProfile(double pos1, double pos2) override

compute the fastest profile Algorithm:

  • compute the minimal distance which is needed to reach maximal velocity

  • if maximal velocity can be reached

    • compute the coefficients of the trajectory

  • if maximal velocity can not be reached

    • compute the new velocity can be reached

    • compute the coefficients based on this new velocity

Parameters:
  • pos1 – start position

  • pos2 – goal position

void SetProfileDuration(double pos1, double pos2, double duration) override

Profile scaled by the total duration.

Parameters:
  • pos1 – start position

  • pos2 – goal position

  • duration – trajectory duration (must be longer than fastest case, otherwise will be ignored)

bool setProfileAllDurations(double pos1, double pos2, double duration1, double duration2, double duration3)

Profile with given acceleration/constant/deceleration durations. Each duration must obey the maximal velocity/acceleration/deceleration constraints. Otherwise the operation will be ignored. Algorithm:

  • compute the maximal velocity of given durations

  • compute the acceleration and deceleration of given duraitons

  • if limits are fulfilled

    • compute the coefficients

Parameters:
  • pos1 – start position

  • pos2 – goal position

  • acc_duration – time of acceleration phase

  • const_duration – time of constant phase

  • dec_duration – time of deceleration phase

Returns:

true if the combination of three durations is valid

bool setProfileStartVelocity(double pos1, double pos2, double vel1)

Profile with start velocity Note: This function is not general and is currently only used for live control (vel1*(pos2-pos1)>0).

Parameters:
  • pos1 – start position

  • pos2 – goal position

  • vel1 – start velocity

Returns:

inline double firstPhaseDuration() const

get the time of first phase

Returns:

inline double secondPhaseDuration() const

get the time of second phase

Returns:

inline double thirdPhaseDuration() const

get the time of third phase

Returns:

bool operator==(const VelocityProfileATrap &other) const

Compares two Asymmetric Trapezoidal Velocity Profiles.

Returns:

True if equal, false otherwise.

double Duration() const override

Duration.

Returns:

total duration of the trajectory

double Pos(double time) const override

Get position at given time.

Parameters:

time

Returns:

double Vel(double time) const override

Get velocity at given time.

Parameters:

time

Returns:

double Acc(double time) const override

Get given acceleration/deceleration at given time.

Parameters:

time

Returns:

void Write(std::ostream &os) const override

Write basic information.

Parameters:

os

KDL::VelocityProfile *Clone() const override

returns copy of current VelocityProfile object

Returns:

~VelocityProfileATrap() override

Friends

friend std::ostream &operator<<(std::ostream &os, const VelocityProfileATrap &p)