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.1
0.1

build named tuple of components and data matrices.

components = (
    x = rand(3, N),
    u = rand(2, N),
    Δt = fill(dt, 1, N),
)
(x = [0.08591878432683142 0.526441939458081 … 0.006709747844371727 0.5163332505586483; 0.5314962585816347 0.9968683294817317 … 0.8008948408876798 0.9972660786004185; 0.9057171965067623 0.9167770559018902 … 0.8541976923181265 0.20127312071008185], u = [0.04127729445585049 0.635686840181281 … 0.0012276678404242736 0.6453591449444319; 0.576456283795216 0.38616936979389505 … 0.13915942165717632 0.04291398906515176], Δ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)
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.