Constructors
To construct a NamedTrajectory using NamedTrajectories.jl, we simply need to utilize the NamedTrajectory constructor.
using NamedTrajectories
# define number of timesteps and timestep
N = 10
dt = 0.10.1build named tuple of components and data matrices.
components = (
x = rand(3, N),
u = rand(2, N),
Δt = fill(dt, 1, N),
)(x = [0.9742102423203767 0.752129358521105 … 0.6677776061159594 0.5183148363233587; 0.37137099870990453 0.552163679291897 … 0.3532928102460512 0.04085626599566583; 0.7351563267689722 0.8736159824118779 … 0.7340702144983549 0.21166322575805951], u = [0.16297248416442833 0.4810891988050753 … 0.4757670764591092 0.9640389259973718; 0.940151640683868 0.885114159801855 … 0.6987709866630216 0.04988444210478826], Δt = [0.1 0.1 … 0.1 0.1])we must specify a timestep and control variable for the trajectory.
timestep = :Δt
control = :u:uwe can now create a NamedTrajectory object.
traj = NamedTrajectory(components; timestep=timestep, controls=control)N = 10, (x = 1:3, u = 4:5, → Δt = 6:6)Construct NamedTrajectory from previous constructed one.
traj = NamedTrajectory(components, traj) # TODO: should this constructor be reimplemented for v0.4.0?
traj = NamedTrajectory(traj; components=(x=1:3, u=4:5, Δt=6:6))N = 10, (x = 1:3, u = 4:5, → Δt = 6:6)This page was generated using Literate.jl.