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 5th order polynomial trajectory with specified start and end points. Additionally allows specification of start and end values for velocity and acceleration.TrajectoryLimiters.JerkLimiterfrom TrajectoryLimiters.jl: Generate time-optimal trajectories with bounded jerk, acceleration and velocity using the Ruckig algorithm.
Components that make use of these trajectory generators is provided:
These all have output connectors of type RealOutput called q, qd, qdd for positions, velocities and accelerations.
Example
Point-to-point trajectory with bounded acceleration
using MultibodyComponents, Plots
Ts = 0.001
t = -0.5: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 = MultibodyComponents.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)Point-to-point trajectory with bounded jerk
This kind of trajectory generator is implemented in TrajectoryLimiters.jl, it may be used as a component in a multibody model through KinematicPTPBoundedJerk.
using MultibodyComponents, Plots
Ts = 0.001
t = -0.5: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)
qddd_max = [4.0, 4.0] # Max jerk (2 DOF)
lims = [MultibodyComponents.JerkLimiter(; vmax=qd_max[i], amax=qdd_max[i], jmax=qddd_max[i]) for i in 1:length(q1)] # One limiter per DOF
profiles = MultibodyComponents.calculate_trajectory(lims; pf=q1)
q, qd, qdd, qddd = profiles(t)
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)5th order polynomial trajectory
t = 0:Ts:3
q1 = 1
q, qd, qdd = MultibodyComponents.traj5(t; q1)
plot(t, [q qd qdd], ylabel=["\$q\$" "\$\\dot{q}\$" "\$\\ddot{q}\$"], layout=(3,1), l=2, legend=false)Docstrings
Missing docstring.
Missing docstring for Modules = [MultibodyComponents]. Check Documenter's build log for details.
Missing docstring.
Missing docstring for Pages = ["dyad/path_planning.jl"]. Check Documenter's build log for details.