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.19727684762307163 0.9998212660984139 … 0.0059950469250953375 0.005347516576740818; 0.048671221896511296 0.6582901242413582 … 0.7632154505100868 0.6819253227994352; 0.7527485734975166 0.7915573087413303 … 0.5635760502429348 0.542019737437737], u = [0.8174322209705693 0.8259338101112614 … 0.3985341379946701 0.46839842974478374; 0.4978721816733864 0.10424537101858589 … 0.6111288211679142 0.007675019048729248], Δ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.