control.flatsys.point_to_point¶
- control.flatsys.point_to_point(sys, timepts, x0=0, u0=0, xf=0, uf=0, T0=0, cost=None, basis=None, trajectory_constraints=None, initial_guess=None, params=None, **kwargs)[source]¶
Compute trajectory between an initial and final conditions.
Compute a feasible trajectory for a differentially flat system between an initial condition and a final condition.
- Parameters
flatsys (FlatSystem object) – Description of the differentially flat system. This object must define a function flatsys.forward() that takes the system state and produceds the flag of flat outputs and a system flatsys.reverse() that takes the flag of the flat output and prodes the state and input.
timepts (float or 1D array_like) – The list of points for evaluating cost and constraints, as well as the time horizon. If given as a float, indicates the final time for the trajectory (corresponding to xf)
x0 (1D arrays) – Define the desired initial and final conditions for the system. If any of the values are given as None, they are replaced by a vector of zeros of the appropriate dimension.
u0 (1D arrays) – Define the desired initial and final conditions for the system. If any of the values are given as None, they are replaced by a vector of zeros of the appropriate dimension.
xf (1D arrays) – Define the desired initial and final conditions for the system. If any of the values are given as None, they are replaced by a vector of zeros of the appropriate dimension.
uf (1D arrays) – Define the desired initial and final conditions for the system. If any of the values are given as None, they are replaced by a vector of zeros of the appropriate dimension.
T0 (float, optional) – The initial time for the trajectory (corresponding to x0). If not specified, its value is taken to be zero.
basis (
BasisFamily
object, optional) – The basis functions to use for generating the trajectory. If not specified, thePolyFamily
basis family will be used, with the minimal number of elements required to find a feasible trajectory (twice the number of system states)cost (callable) – Function that returns the integral cost given the current state and input. Called as cost(x, u).
trajectory_constraints (list of tuples, optional) –
List of constraints that should hold at each point in the time vector. Each element of the list should consist of a tuple with first element given by
scipy.optimize.LinearConstraint
orscipy.optimize.NonlinearConstraint
and the remaining elements of the tuple are the arguments that would be passed to those functions. The following tuples are supported:(LinearConstraint, A, lb, ub): The matrix A is multiplied by stacked vector of the state and input at each point on the trajectory for comparison against the upper and lower bounds.
(NonlinearConstraint, fun, lb, ub): a user-specific constraint function fun(x, u) is called at each point along the trajectory and compared against the upper and lower bounds.
The constraints are applied at each time point along the trajectory.
minimize_kwargs (str, optional) – Pass additional keywords to
scipy.optimize.minimize()
.
- Returns
traj – The system trajectory is returned as an object that implements the eval() function, we can be used to compute the value of the state and input and a given time t.
- Return type
SystemTrajectory
object
Notes
Additional keyword parameters can be used to fine tune the behavior of the underlying optimization function. See minimize_* keywords in
OptimalControlProblem()
for more information.