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.3363894234110396 0.5989230438906966 … 0.0639847843796787 0.6741089925061265; 0.775123179159866 0.9389116391946377 … 0.1191554891386537 0.17446804571268548; 0.25553297472268577 0.45700081066931764 … 0.39377616444809016 0.06179744581905511], u = [0.7021601250209064 0.8069837037419588 … 0.9960748325703018 0.16300286421301102; 0.9827121594110695 0.3555906961675287 … 0.626996633115217 0.07655678290474854], Δ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.