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.4388870333124213 0.6955746984733158 … 0.033506089114221815 0.8968678820878917; 0.16441654481749768 0.8634256136827109 … 0.7974822694566512 0.08165041257592753; 0.9638887204792574 0.12773033140250312 … 0.21348313878205682 0.16553579069835145], u = [0.30355647190543733 0.057746283435008094 … 0.037923688976173375 0.047483958135813076; 0.5377441037305568 0.8370730297246392 … 0.10890117460109883 0.7454674109513368], Δ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.