DirectCollocation implements the approach to trajectory optimization as described in C.
R. Hargraves and S. W. Paris. Direct trajectory optimization using nonlinear programming and collocation. J Guidance, 10(4):338-342, July-August 1987. It assumes a first-order hold on the input trajectory and a cubic spline representation of the state trajectory, and adds dynamic constraints (and running costs) to the midpoints as well as the breakpoints in order to achieve a 3rd order integration accuracy.
Note: This algorithm only works with the continuous states of a system.
|
| DirectCollocation (const systems::System< double > *system, const systems::Context< double > &context, int num_time_samples, double minimum_time_step, double maximum_time_step, std::variant< systems::InputPortSelection, systems::InputPortIndex > input_port_index=systems::InputPortSelection::kUseFirstInputIfItExists, bool assume_non_continuous_states_are_fixed=false, solvers::MathematicalProgram *prog=nullptr) |
| Constructs the MathematicalProgram% and adds the collocation constraints. More...
|
|
| ~DirectCollocation () override |
|
trajectories::PiecewisePolynomial< double > | ReconstructInputTrajectory (const solvers::MathematicalProgramResult &result) const override |
| Get the input trajectory at the solution as a PiecewisePolynomial. More...
|
|
trajectories::PiecewisePolynomial< double > | ReconstructStateTrajectory (const solvers::MathematicalProgramResult &result) const override |
| Get the state trajectory at the solution as a PiecewisePolynomial. More...
|
|
|
| DirectCollocation (const DirectCollocation &)=delete |
|
DirectCollocation & | operator= (const DirectCollocation &)=delete |
|
| DirectCollocation (DirectCollocation &&)=delete |
|
DirectCollocation & | operator= (DirectCollocation &&)=delete |
|
virtual | ~MultipleShooting () |
|
solvers::MathematicalProgram & | prog () |
| Returns a reference to the MathematicalProgram associated with the trajectory optimization problem. More...
|
|
const solvers::MathematicalProgram & | prog () const |
| Returns a const reference to the MathematicalProgram associated with the trajectory optimization problem. More...
|
|
const solvers::VectorDecisionVariable< 1 > | time_step (int index) const |
| Returns the decision variable associated with the time step, h, at time index index . More...
|
|
const solvers::VectorDecisionVariable< 1 > & | time () const |
| Returns a placeholder decision variable (not actually declared as a decision variable in the MathematicalProgram) associated with the time, t. More...
|
|
const solvers::VectorXDecisionVariable & | state () const |
| Returns placeholder decision variables (not actually declared as decision variables in the MathematicalProgram) associated with the state, x, but with the time-index undetermined. More...
|
|
const solvers::VectorXDecisionVariable & | input () const |
| Returns placeholder decision variables (not actually declared as decision variables in the MathematicalProgram) associated with the input, u, but with the time-index undetermined. More...
|
|
Eigen::VectorBlock< const solvers::VectorXDecisionVariable > | state (int index) const |
| Returns the decision variables associated with the state, x, at time index index . More...
|
|
Eigen::VectorBlock< const solvers::VectorXDecisionVariable > | initial_state () const |
| Returns the decision variables associated with the state, x, at the initial time index. More...
|
|
Eigen::VectorBlock< const solvers::VectorXDecisionVariable > | final_state () const |
| Returns the decision variables associated with the state, x, at the final time index. More...
|
|
Eigen::VectorBlock< const solvers::VectorXDecisionVariable > | input (int index) const |
| Returns the decision variables associated with the input, u, at time index index . More...
|
|
solvers::VectorXDecisionVariable | NewSequentialVariable (int rows, const std::string &name) |
| Adds a sequential variable (a variable that has associated decision variables for each time index) to the optimization problem and returns a placeholder variable (not actually declared as a decision variable in the MathematicalProgram). More...
|
|
solvers::VectorXDecisionVariable | GetSequentialVariableAtIndex (const std::string &name, int index) const |
| Returns the decision variables associated with the sequential variable name at time index index . More...
|
|
void | AddRunningCost (const symbolic::Expression &g) |
| Adds an integrated cost to all time steps, of the form
\[ cost = \int_0^T g(t,x,u) dt, \]
where any instances of time(), state(), and/or input() placeholder variables, as well as placeholder variables returned by calls to NewSequentialVariable(), are substituted with the relevant variables for each time index. More...
|
|
template<typename Derived > |
void | AddRunningCost (const Eigen::MatrixBase< Derived > &g) |
| Adds support for passing in a (scalar) matrix Expression, which is a common output of most symbolic linear algebra operations. More...
|
|
template<typename C > |
std::vector< solvers::Binding< C > > | AddConstraintToAllKnotPoints (std::shared_ptr< C > constraint, const Eigen::Ref< const VectorX< symbolic::Variable >> &vars) |
| Adds a constraint to all breakpoints, where any instances in vars of time(), state(), and/or input() placeholder variables, as well as placeholder variables returned by calls to NewSequentialVariable(), are substituted with the relevant variables for each time index. More...
|
|
std::vector< solvers::Binding< solvers::Constraint > > | AddConstraintToAllKnotPoints (const symbolic::Formula &f) |
| Adds a constraint to all breakpoints, where any instances of time(), state(), and/or input() placeholder variables, as well as placeholder variables returned by calls to NewSequentialVariable(), are substituted with the relevant variables for each time index. More...
|
|
std::vector< solvers::Binding< solvers::Constraint > > | AddConstraintToAllKnotPoints (const Eigen::Ref< const VectorX< symbolic::Formula >> &f) |
| Variant of AddConstraintToAllKnotPoints that accepts a vector of formulas. More...
|
|
solvers::Binding< solvers::BoundingBoxConstraint > | AddTimeIntervalBounds (double lower_bound, double upper_bound) |
| Adds bounds on all time intervals. More...
|
|
std::vector< solvers::Binding< solvers::LinearConstraint > > | AddEqualTimeIntervalsConstraints () |
| Adds constraints to enforce that all time steps have equal duration. More...
|
|
solvers::Binding< solvers::LinearConstraint > | AddDurationBounds (double lower_bound, double upper_bound) |
| Adds a constraint on the total duration of the trajectory. More...
|
|
solvers::Binding< solvers::Cost > | AddFinalCost (const symbolic::Expression &e) |
| Adds a cost to the final time, of the form
\[ cost = e(t,x,u), \]
where any instances of time(), state(), and/or input() placeholder variables, as well as placeholder variables returned by calls to NewSequentialVariable(), are substituted with the relevant variables for the final time index. More...
|
|
solvers::Binding< solvers::Cost > | AddFinalCost (const Eigen::Ref< const MatrixX< symbolic::Expression >> &matrix) |
| Adds support for passing in a (scalar) matrix Expression, which is a common output of most symbolic linear algebra operations. More...
|
|
solvers::Binding< solvers::VisualizationCallback > | AddInputTrajectoryCallback (const TrajectoryCallback &callback) |
| Adds a callback method to visualize intermediate results of input variables used in the trajectory optimization. More...
|
|
solvers::Binding< solvers::VisualizationCallback > | AddStateTrajectoryCallback (const TrajectoryCallback &callback) |
| Adds a callback method to visualize intermediate results of state variables used in the trajectory optimization. More...
|
|
solvers::Binding< solvers::VisualizationCallback > | AddCompleteTrajectoryCallback (const CompleteTrajectoryCallback &callback, const std::vector< std::string > &names) |
| Adds a callback method to visualize intermediate results of all variables used in the trajectory optimization. More...
|
|
void | SetInitialTrajectory (const trajectories::PiecewisePolynomial< double > &traj_init_u, const trajectories::PiecewisePolynomial< double > &traj_init_x) |
| Set the initial guess for the trajectory decision variables. More...
|
|
Eigen::VectorXd | GetSampleTimes (const Eigen::Ref< const Eigen::VectorXd > &h_var_values) const |
| Returns a vector containing the elapsed time at each breakpoint. More...
|
|
Eigen::VectorXd | GetSampleTimes (const solvers::MathematicalProgramResult &result) const |
| Returns a vector containing the elapsed time at each breakpoint at the solution. More...
|
|
Eigen::MatrixXd | GetInputSamples (const solvers::MathematicalProgramResult &result) const |
| Returns a matrix containing the input values (arranged in columns) at each breakpoint at the solution. More...
|
|
Eigen::MatrixXd | GetStateSamples (const solvers::MathematicalProgramResult &result) const |
| Returns a matrix containing the state values (arranged in columns) at each breakpoint at the solution. More...
|
|
Eigen::MatrixXd | GetSequentialVariableSamples (const solvers::MathematicalProgramResult &result, const std::string &name) const |
| Returns a matrix containing the sequential variable values (arranged in columns) at each breakpoint at the solution. More...
|
|
double | fixed_time_step () const |
|
| MultipleShooting (const MultipleShooting &)=delete |
|
MultipleShooting & | operator= (const MultipleShooting &)=delete |
|
| MultipleShooting (MultipleShooting &&)=delete |
|
MultipleShooting & | operator= (MultipleShooting &&)=delete |
|
|
typedef std::function< void(const Eigen::Ref< const Eigen::VectorXd > &sample_times, const Eigen::Ref< const Eigen::MatrixXd > &values)> | TrajectoryCallback |
|
typedef std::function< void(const Eigen::Ref< const Eigen::VectorXd > &sample_times, const Eigen::Ref< const Eigen::MatrixXd > &states, const Eigen::Ref< const Eigen::MatrixXd > &inputs, const std::vector< Eigen::Ref< const Eigen::MatrixXd >> &values)> | CompleteTrajectoryCallback |
|
| MultipleShooting (int num_inputs, int num_states, int num_time_samples, double fixed_time_step, solvers::MathematicalProgram *prog=nullptr) |
| Constructs a MultipleShooting instance with fixed sample times. More...
|
|
| MultipleShooting (const solvers::VectorXDecisionVariable &input, const solvers::VectorXDecisionVariable &state, int num_time_samples, double fixed_time_step, solvers::MathematicalProgram *prog=nullptr) |
| Constructs a MultipleShooting instance with fixed sample times. More...
|
|
| MultipleShooting (int num_inputs, int num_states, int num_time_samples, double minimum_time_step, double maximum_time_step, solvers::MathematicalProgram *prog=nullptr) |
| Constructs a MultipleShooting instance with sample times as decision variables. More...
|
|
| MultipleShooting (const solvers::VectorXDecisionVariable &input, const solvers::VectorXDecisionVariable &state, const solvers::DecisionVariable &time, int num_time_samples, double minimum_time_step, double maximum_time_step, solvers::MathematicalProgram *prog=nullptr) |
| Constructs a MultipleShooting instance with sample times as decision variables. More...
|
|
symbolic::Expression | SubstitutePlaceholderVariables (const symbolic::Expression &e, int interval_index) const |
| Replaces e.g. More...
|
|
symbolic::Formula | SubstitutePlaceholderVariables (const symbolic::Formula &f, int interval_index) const |
| Replaces e.g. More...
|
|
int | num_inputs () const |
|
int | num_states () const |
|
int | N () const |
|
bool | time_steps_are_decision_variables () const |
|
const solvers::VectorXDecisionVariable & | h_vars () const |
|
const solvers::VectorXDecisionVariable & | u_vars () const |
|
const solvers::VectorXDecisionVariable & | x_vars () const |
|
const solvers::VectorXDecisionVariable | GetSequentialVariable (const std::string &name) const |
| Returns the decision variables associated with the sequential variable name . More...
|
|