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.6182306359162136 0.43566057997108 … 0.0765650392670979 0.8156601515353111; 0.3312649337748297 0.13064383381015265 … 0.064149980703751 0.3917114446066817; 0.05940641390453205 0.7028796830311742 … 0.9025811326161465 0.14197375107231258], u = [0.5031533996031818 0.9247123792506821 … 0.7434213380673541 0.7217997176447287; 0.26610000341126816 0.5291309124387925 … 0.5561469431368609 0.868856275444589], Δ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.