Trajectory planning

Two methods of planning trajectories are available

  • point_to_point: Generate a minimum-time point-to-point trajectory with specified start and endpoints, not exceeding specified speed and acceleration limits.
  • traj5: Generate a 5:th order polynomial trajectory with specified start and end points. Additionally allows specification of start and end values for velocity and acceleration.

Components that make use of these trajectory generators is provided:

These both have output connectors of type RealOutput called q, qd, qdd for positions, velocities and accelerations.

See Industrial robot for an example making use of the point_to_point planner.

Example

Point-to-point trajectory

using Multibody, Plots
Ts = 0.001
t = -1:Ts:3

q1 = [1, 1.2]           # Final point (2 DOF)
qd_max = [0.7, 1.2]     # Max velocity (2 DOF)
qdd_max = [0.9, 1.1]    # Max acceleration (2 DOF)
q, qd, qdd = point_to_point(t; q1, qd_max, qdd_max)

plot(t, [q qd qdd], ylabel=["\$q\$" "\$\\dot{q}\$" "\$\\ddot{q}\$"], layout=(3,1), l=2, sp=[1 1 2 2 3 3], legend=false)
hline!([qd_max' qdd_max'], l=(2, :dash), sp=[2 2 3 3], c=[1 2 1 2], legend=false)
Example block output

5:th order polynomial trajectory

t = 0:Ts:3
q1 = 1
q, qd, qdd = traj5(t; q1)

plot(t, [q qd qdd], ylabel=["\$q\$" "\$\\dot{q}\$" "\$\\ddot{q}\$"], layout=(3,1), l=2, legend=false)
Example block output

Docstrings

Multibody.Kinematic5Method
Kinematic5(; time, name, q0 = 0, q1 = 1, qd0 = 0, qd1 = 0, qdd0 = 0, qdd1 = 0)

A component emitting a 5:th order polynomial trajectory created using traj5. traj5 is a simple trajectory planner that plans a 5:th order polynomial trajectory between two points, subject to specified boundary conditions on the position, velocity and acceleration.

Arguments

  • time: Time vector, e.g., 0:0.01:10
  • name: Name of the component

Outputs

  • q: Position
  • qd: Velocity
  • qdd: Acceleration
source
Multibody.KinematicPTPMethod
KinematicPTP(; time, name, q0 = 0, q1 = 1, qd_max=1, qdd_max=1)

A component emitting a trajectory created by the point_to_point trajectory generator.

Arguments

  • time: Time vector, e.g., 0:0.01:10
  • name: Name of the component
  • q0: Initial position
  • q1: Final position
  • qd_max: Maximum velocity
  • qdd_max: Maximum acceleration

Outputs

  • q: Position
  • qd: Velocity
  • qdd: Acceleration

See also Kinematic5.

source
Multibody.traj5Method
q, qd, qdd = traj5(t; q0, q1, q̇0 = zero(q0), q̇1 = zero(q0), q̈0 = zero(q0), q̈1 = zero(q0))

Generate a 5:th order polynomial trajectory with specified end points, vels and accs.

See also point_to_point and Kinematic5.

source
Multibody.point_to_pointMethod
q,qd,qdd,t_end = point_to_point(time; q0 = 0.0, q1 = 1.0, t0 = 0, qd_max = 1, qdd_max = 1)

Generate a minimum-time point-to-point trajectory with specified start and endpoints, not exceeding specified speed and acceleration limits.

The trajectory produced by this function will typically exhibit piecewise constant accleration, piecewise linear velocity and piecewise quadratic position curves.

If a vector of time points is provided, the function returns matrices q,qd,qdd of size (length(time), n_dims). If a scalar time point is provided, the function returns q,qd,qdd as vectors with the specified dimension (same dimension as q0). t_end is the time at which the trajectory will reach the specified end position.

Arguments:

  • time: A scalar or a vector of time points.
  • q0: Initial coordinate, may be a scalar or a vector.
  • q1: End coordinate
  • t0: Tiem at which the motion starts. If time contains time points before t0, the trajectory will stand still at q0 until time reaches t0.
  • qd_max: Maximum allowed speed.
  • qdd_max: Maximum allowed acceleration.

See also KinematicPTP and traj5.

source