Constructors

To construct a NamedTrajectory using NamedTrajectories.jl, we simply need to utilize the NamedTrajectory constructor.

using NamedTrajectories

# define number of timesteps and timestep
T = 10
dt = 0.1
0.1

build named tuple of components and data matrices.

components = (
    x = rand(3, T),
    u = rand(2, T),
    Δt = fill(dt, 1, T),
)
(x = [0.6833139237588857 0.5719109972076637 … 0.3242866367803212 0.031381745680549966; 0.5675217500011558 0.40338561042357424 … 0.5277674083291226 0.3070115523710586; 0.22906811194851573 0.730262962498964 … 0.8706510918172047 0.4595551860602888], u = [0.8830178011022493 0.3960663679818619 … 0.5483698291334973 0.010107789533647549; 0.6256018349589786 0.1508125279998379 … 0.7039832706472265 0.06156148114364712], Δt = [0.1 0.1 … 0.1 0.1])

we must specify a timestep and control variable for the trajectory.

timestep = :Δt
control = :u
:u

we can now create a NamedTrajectory object.

traj = NamedTrajectory(components; timestep=timestep, controls=control)
T = 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))
T = 10, (x = 1:3, u = 4:5, → Δt = 6:6)

This page was generated using Literate.jl.