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.48953261143880045 0.3548005676155379 … 0.4924094462544032 0.5202883130318843; 0.12274861538493953 0.9351927583909835 … 0.2561152311908387 0.559269498568679; 0.31825992501479394 0.8587135476017547 … 0.12466425691540539 0.19558676352022997], u = [0.8241908769332149 0.7759099805547254 … 0.7101872920768759 0.7188730333247761; 0.8794774900120647 0.9630531815918765 … 0.5266114684869128 0.03610654092275911], Δ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.