API

NamedTrajectory methods

Base.mergeMethod
merge(traj1::NamedTrajectory, traj2::NamedTrajectory)
merge(trajs::AbstractVector{<:NamedTrajectory})

Returns a new NamedTrajectory object by merging NamedTrajectory objects.

Merge names are used to specify which components to merge by index. If no merge names are provided, all components are merged and name collisions are not allowed. If merge names are provided, the names are merged using the data from the index provided in the merge names.

Keyword Arguments

  • timestep::Symbol: The timestep symbol to use for free time problems. Default to the last trajectory.
  • merge_names::Union{Nothing, NamedTuple{<:Any, <:Tuple{Vararg{Int}}}}=nothing: The names to merge by index.
source
NamedTrajectories.MethodsNamedTrajectory.get_component_namesMethod
get_component_names(traj::NamedTrajectory, comps::AbstractVector{<:Int})

Returns the name of the component with the given indices. If only one component is found, the name is returned as a single symbol. Else, the names are returned as a vector of symbols.

The filter requires that the components are a complete subset of the given indices, so that a partial match is excluded from the returned names.

source
Base.getpropertyMethod
getproperty(slice::KnotPoint, symb::Symbol)

Returns the component of the knot point with name symb (as a view) or the property of the knot point with name symb.

source
Base.setproperty!Method
setproperty!(slice::KnotPoint, symb::Symbol, val::Any)

Dispatches setting properties of knot points as either setting a component or a property via update! or setfield!, respectively.

source

Random trajectory methods

Base.randMethod
rand(
    ::Type{NamedTrajectory},
    T::Int;
    timestep_value::Float64=1.0,
    timestep_name::Symbol=:Δt,
    timestep::Union{Float64,Symbol}=free_time ? timestep_name : timestep_value,
    state_dim::Int=3,
    control_dim::Int=2
)

Create a random NamedTrajectory with T time steps, a state variable x of dimension state_dim, and a control variable u of dimension control_dim. The time step is a symbol timestep_name and the time step value is timestep_value.

source

Struct Methods

NamedTrajectories.StructNamedTrajectory.NamedTrajectoryType
NamedTrajectory{R <: Real}

Container for trajectory optimization problems, which includes the trajectory data, bounds dimensions, initial and final conditions, goal states, and components.

This struct is designed to hold trajectory data in a named format, allowing for easy access to knot points by Symbol.

NamedTrajectory is designed to make allocation-free access easy to write. The data can be updated after construction, but the fields cannot.

source

Trajectory Utilities