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.9628175240473713 0.3487349603966 … 0.6097651084688113 0.1624714001595805; 0.013306912633498591 0.6774438750446986 … 0.33347149967314493 0.5859441609043685; 0.8384223337590788 0.6700460098253304 … 0.564242121436599 0.3919177145913163], u = [0.41559161226644303 0.42038825033973015 … 0.8580970018915984 0.0665648417742346; 0.9889923080767276 0.9192976054727785 … 0.024770610926479586 0.5692319902643868], Δ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.