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.7331585996977291 0.25264334069164784 … 0.8546250537087615 0.8493509118971442; 0.2558833928677068 0.643594717670771 … 0.30257669813341237 0.2574672507067697; 0.8127752706617807 0.013540925275848048 … 0.5759429742621268 0.7625359507693029], u = [0.853487658467565 0.9549488406289672 … 0.13219076419257636 0.37768902535546556; 0.40436982613201844 0.13784636142779572 … 0.35041481292971166 0.030411237341782638], Δ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.