control.flatsys.point_to_point
- control.flatsys.point_to_point(sys, timepts, initial_state=0, initial_input=0, final_state=0, final_input=0, initial_time=0, integral_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
- sys
FlatSystem
object Description of the differentially flat system. This object must define a function
forward
that takes the system state and produces the flag of flat outputs and a functionreverse
that takes the flag of the flat output and produces the state and input.- timeptsfloat 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)
- initial_state (or x0)1D array_like
Initial state for the system. Defaults to zero.
- initial_input (or u0)1D array_like
Initial input for the system. Defaults to zero.
- final_state (or xf)1D array_like
Final state for the system. Defaults to zero.
- final_input (or uf)1D array_like
Final input for the system. Defaults to zero.
- initial_time (or 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, the
PolyFamily
basis family will be used, with the minimal number of elements required to find a feasible trajectory (twice the number of system states)- integral_cost (or cost)callable
Function that returns the integral cost given the current state and input. Called as
integral_cost(x, u)
.- trajectory_constraints (or 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.
- initial_guess2D array_like, optional
Initial guess for the trajectory coefficients (not implemented).
- paramsdict, optional
Parameter values for the system. Passed to the evaluation functions for the system as default values, overriding internal defaults.
- sys
- Returns
- traj
SystemTrajectory
object 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.
- traj
- Other Parameters
- minimize_methodstr, optional
Set the method used by
scipy.optimize.minimize
.- minimize_optionsstr, optional
Set the options keyword used by
scipy.optimize.minimize
.- minimize_kwargsstr, optional
Pass additional keywords to
scipy.optimize.minimize
.
Notes
Additional keyword parameters can be used to fine tune the behavior of the underlying optimization function. See
minimize_*
keywords inOptimalControlProblem
for more information.