Exotica
|
#include <abstract_time_indexed_problem.h>
Public Member Functions | |
AbstractTimeIndexedProblem () | |
virtual | ~AbstractTimeIndexedProblem () |
void | Update (Eigen::VectorXdRefConst x_trajectory_in) |
Updates the entire problem from a given trajectory (e.g., used in an optimization solver) More... | |
virtual void | Update (Eigen::VectorXdRefConst x_in, int t) |
Updates an individual timestep from a given state vector. More... | |
double | GetDuration () const |
Returns the duration of the trajectory (T * tau). More... | |
std::vector< Eigen::VectorXd > | GetInitialTrajectory () const |
Returns the initial trajectory/seed. More... | |
void | SetInitialTrajectory (const std::vector< Eigen::VectorXd > &q_init_in) |
Sets the initial trajectory/seed. More... | |
virtual void | PreUpdate () |
Updates internal variables before solving, e.g., after setting new values for Rho. More... | |
void | SetGoal (const std::string &task_name, Eigen::VectorXdRefConst goal, int t=0) |
Sets goal for a given task at a given timestep (cost task). More... | |
Eigen::VectorXd | GetGoal (const std::string &task_name, int t=0) |
Returns the goal for a given task at a given timestep (cost task). More... | |
void | SetRho (const std::string &task_name, const double rho, int t=0) |
Sets Rho for a given task at a given timestep (cost task). More... | |
double | GetRho (const std::string &task_name, int t=0) |
Returns the precision (Rho) for a given task at a given timestep (cost task). More... | |
void | SetGoalEQ (const std::string &task_name, Eigen::VectorXdRefConst goal, int t=0) |
Sets goal for a given task at a given timestep (equality task). More... | |
Eigen::VectorXd | GetGoalEQ (const std::string &task_name, int t=0) |
Returns the goal for a given task at a given timestep (equality task). More... | |
void | SetRhoEQ (const std::string &task_name, const double rho, int t=0) |
Sets Rho for a given task at a given timestep (equality task). More... | |
double | GetRhoEQ (const std::string &task_name, int t=0) |
Returns the precision (Rho) for a given task at a given timestep (equality task). More... | |
void | SetGoalNEQ (const std::string &task_name, Eigen::VectorXdRefConst goal, int t=0) |
Sets goal for a given task at a given timestep (inequality task). More... | |
Eigen::VectorXd | GetGoalNEQ (const std::string &task_name, int t=0) |
Returns the goal for a given task at a given timestep (goal task). More... | |
void | SetRhoNEQ (const std::string &task_name, const double rho, int t=0) |
Sets Rho for a given task at a given timestep (inequality task). More... | |
double | GetRhoNEQ (const std::string &task_name, int t=0) |
Returns the precision (Rho) for a given task at a given timestep (equality task). More... | |
Eigen::MatrixXd | GetBounds () const |
Returns the joint bounds (first column lower, second column upper). More... | |
int | GetT () const |
Returns the number of timesteps in the trajectory. More... | |
void | SetT (const int T_in) |
Sets the number of timesteps in the trajectory. Note: Rho/Goal need to be updated for every timestep after calling this method. More... | |
double | GetTau () const |
Returns the time discretization tau for the trajectory. More... | |
void | SetTau (const double tau_in) |
Sets the time discretization tau for the trajectory. More... | |
double | get_ct () const |
Returns the cost scaling factor. More... | |
double | GetScalarTaskCost (int t) const |
Returns the scalar task cost at timestep t. More... | |
Eigen::RowVectorXd | GetScalarTaskJacobian (int t) const |
Returns the Jacobian of the scalar task cost at timestep t. More... | |
double | GetScalarTransitionCost (int t) const |
Returns the scalar transition cost (x^T*W*x) at timestep t. More... | |
Eigen::RowVectorXd | GetScalarTransitionJacobian (int t) const |
Returns the Jacobian of the transition cost at timestep t. More... | |
double | GetCost () const |
Returns the scalar cost for the entire trajectory (both task and transition cost). More... | |
Eigen::RowVectorXd | GetCostJacobian () const |
Returns the Jacobian of the scalar cost over the entire trajectory (Jacobian of GetCost). More... | |
Eigen::VectorXd | GetEquality () const |
Returns the equality constraint values for the entire trajectory. More... | |
Eigen::VectorXd | GetInequality () const |
Returns the inequality constraint values for the entire trajectory. More... | |
Eigen::SparseMatrix< double > | GetEqualityJacobian () const |
Returns the sparse Jacobian matrix of the equality constraints over the entire trajectory. More... | |
Eigen::SparseMatrix< double > | GetInequalityJacobian () const |
Returns the sparse Jacobian matrix of the inequality constraints over the entire trajectory. More... | |
std::vector< Eigen::Triplet< double > > | GetEqualityJacobianTriplets () const |
Returns a vector of triplets to fill a sparse Jacobian for the equality constraints. More... | |
int | get_active_nonlinear_equality_constraints_dimension () const |
Returns the dimension of the active equality constraints. More... | |
Eigen::VectorXd | GetEquality (int t) const |
Returns the value of the equality constraints at timestep t. More... | |
Eigen::MatrixXd | GetEqualityJacobian (int t) const |
Returns the Jacobian of the equality constraints at timestep t. More... | |
Eigen::VectorXd | GetInequality (int t) const |
Returns the value of the inequality constraints at timestep t. More... | |
Eigen::MatrixXd | GetInequalityJacobian (int t) const |
Returns the Jacobian of the inequality constraints at timestep t. More... | |
std::vector< Eigen::Triplet< double > > | GetInequalityJacobianTriplets () const |
Returns a vector of triplets to fill a sparse Jacobian for the inequality constraints. More... | |
int | get_active_nonlinear_inequality_constraints_dimension () const |
Returns the dimension of the active inequality constraints. More... | |
int | get_joint_velocity_constraint_dimension () const |
Returns the dimension of the joint velocity constraint (linear inequality). More... | |
Eigen::VectorXd | GetJointVelocityConstraint () const |
Returns the joint velocity constraint inequality terms (linear). More... | |
Eigen::MatrixXd | GetJointVelocityConstraintBounds () const |
Returns the joint velocity constraint bounds (constant terms). More... | |
std::vector< Eigen::Triplet< double > > | GetJointVelocityConstraintJacobianTriplets () const |
Returns the joint velocity constraint Jacobian as triplets. More... | |
Eigen::VectorXd | GetJointVelocityLimits () const |
Returns the per-DoF joint velocity limit vector. More... | |
void | SetJointVelocityLimits (const Eigen::VectorXd &qdot_max_in) |
Sets the joint velocity limits. Supports N- and 1-dimensional vectors. More... | |
Public Member Functions inherited from exotica::PlanningProblem | |
PlanningProblem () | |
virtual | ~PlanningProblem () |
void | InstantiateBase (const Initializer &init) override |
TaskMapMap & | GetTaskMaps () |
TaskMapVec & | GetTasks () |
ScenePtr | GetScene () const |
std::string | Print (const std::string &prepend) const override |
void | SetStartState (Eigen::VectorXdRefConst x) |
Eigen::VectorXd | GetStartState () const |
virtual Eigen::VectorXd | ApplyStartState (bool update_traj=true) |
void | SetStartTime (double t) |
double | GetStartTime () const |
unsigned int | GetNumberOfProblemUpdates () const |
void | ResetNumberOfProblemUpdates () |
std::pair< std::vector< double >, std::vector< double > > | GetCostEvolution () const |
int | GetNumberOfIterations () const |
double | GetCostEvolution (int index) const |
void | ResetCostEvolution (size_t size) |
void | SetCostEvolution (int index, double value) |
KinematicRequestFlags | GetFlags () const |
virtual bool | IsValid () |
Evaluates whether the problem is valid. More... | |
int | get_num_positions () const |
! Dimension of planning problem. TODO: Update from positions/velocities/controls and make private. More... | |
int | get_num_velocities () const |
int | get_num_controls () const |
Public Member Functions inherited from exotica::Object | |
Object () | |
virtual | ~Object () |
virtual std::string | type () const |
Type Information wrapper: must be virtual so that it is polymorphic... More... | |
std::string | GetObjectName () |
void | InstantiateObject (const Initializer &init) |
Public Member Functions inherited from exotica::InstantiableBase | |
InstantiableBase ()=default | |
virtual | ~InstantiableBase ()=default |
virtual Initializer | GetInitializerTemplate ()=0 |
virtual void | InstantiateInternal (const Initializer &init)=0 |
virtual std::vector< Initializer > | GetAllTemplates () const =0 |
Public Attributes | |
TimeIndexedTask | cost |
Cost task. More... | |
TimeIndexedTask | inequality |
General inequality task. More... | |
TimeIndexedTask | equality |
General equality task. More... | |
Eigen::MatrixXd | W |
std::vector< TaskSpaceVector > | Phi |
std::vector< Eigen::MatrixXd > | jacobian |
std::vector< Hessian > | hessian |
int | length_Phi |
int | length_jacobian |
int | num_tasks |
bool | use_bounds |
Public Attributes inherited from exotica::PlanningProblem | |
double | t_start |
TerminationCriterion | termination_criterion |
int | N = 0 |
Public Attributes inherited from exotica::Object | |
std::string | ns_ |
std::string | object_name_ |
bool | debug_ |
Protected Member Functions | |
virtual void | ReinitializeVariables () |
void | ValidateTimeIndex (int &t_in) const |
Checks the desired time index for bounds and supports -1 indexing. More... | |
Protected Member Functions inherited from exotica::PlanningProblem | |
void | UpdateTaskKinematics (std::shared_ptr< KinematicResponse > response) |
void | UpdateMultipleTaskKinematics (std::vector< std::shared_ptr< KinematicResponse >> responses) |
Protected Attributes | |
int | T_ = 0 |
Number of time steps. More... | |
double | tau_ = 0 |
Time step duration. More... | |
std::vector< Eigen::VectorXd > | x |
Current internal problem state. More... | |
std::vector< Eigen::VectorXd > | xdiff |
double | w_scale_ = 1.0 |
Kinematic system transition error covariance multiplier (constant throughout the trajectory) More... | |
TaskSpaceVector | cost_Phi |
TaskSpaceVector | inequality_Phi |
TaskSpaceVector | equality_Phi |
std::vector< Eigen::VectorXd > | initial_trajectory_ |
std::vector< std::shared_ptr< KinematicResponse > > | kinematic_solutions_ |
double | ct |
Normalisation of scalar cost and Jacobian over trajectory length. More... | |
Eigen::VectorXd | q_dot_max_ |
Joint velocity limit (rad/s) More... | |
Eigen::VectorXd | xdiff_max_ |
Maximum change in the variables in a single timestep tau_. Gets set/updated via SetJointVelocityLimits or ReinitializeVariables. More... | |
std::vector< std::pair< int, int > > | active_nonlinear_equality_constraints_ |
std::vector< std::pair< int, int > > | active_nonlinear_inequality_constraints_ |
int | active_nonlinear_equality_constraints_dimension_ = 0 |
int | active_nonlinear_inequality_constraints_dimension_ = 0 |
int | joint_velocity_constraint_dimension_ = 0 |
std::vector< Eigen::Triplet< double > > | joint_velocity_constraint_jacobian_triplets_ |
Protected Attributes inherited from exotica::PlanningProblem | |
ScenePtr | scene_ |
TaskMapMap | task_maps_ |
TaskMapVec | tasks_ |
KinematicRequestFlags | flags_ = KinematicRequestFlags::KIN_FK |
Eigen::VectorXd | start_state_ |
unsigned int | number_of_problem_updates_ = 0 |
std::vector< std::pair< std::chrono::high_resolution_clock::time_point, double > > | cost_evolution_ |
exotica::AbstractTimeIndexedProblem::AbstractTimeIndexedProblem | ( | ) |
|
virtual |
int exotica::AbstractTimeIndexedProblem::get_active_nonlinear_equality_constraints_dimension | ( | ) | const |
Returns the dimension of the active equality constraints.
int exotica::AbstractTimeIndexedProblem::get_active_nonlinear_inequality_constraints_dimension | ( | ) | const |
Returns the dimension of the active inequality constraints.
double exotica::AbstractTimeIndexedProblem::get_ct | ( | ) | const |
Returns the cost scaling factor.
int exotica::AbstractTimeIndexedProblem::get_joint_velocity_constraint_dimension | ( | ) | const |
Returns the dimension of the joint velocity constraint (linear inequality).
Eigen::MatrixXd exotica::AbstractTimeIndexedProblem::GetBounds | ( | ) | const |
Returns the joint bounds (first column lower, second column upper).
double exotica::AbstractTimeIndexedProblem::GetCost | ( | ) | const |
Returns the scalar cost for the entire trajectory (both task and transition cost).
Eigen::RowVectorXd exotica::AbstractTimeIndexedProblem::GetCostJacobian | ( | ) | const |
Returns the Jacobian of the scalar cost over the entire trajectory (Jacobian of GetCost).
double exotica::AbstractTimeIndexedProblem::GetDuration | ( | ) | const |
Returns the duration of the trajectory (T * tau).
Eigen::VectorXd exotica::AbstractTimeIndexedProblem::GetEquality | ( | ) | const |
Returns the equality constraint values for the entire trajectory.
Eigen::VectorXd exotica::AbstractTimeIndexedProblem::GetEquality | ( | int | t | ) | const |
Returns the value of the equality constraints at timestep t.
Eigen::SparseMatrix<double> exotica::AbstractTimeIndexedProblem::GetEqualityJacobian | ( | ) | const |
Returns the sparse Jacobian matrix of the equality constraints over the entire trajectory.
Eigen::MatrixXd exotica::AbstractTimeIndexedProblem::GetEqualityJacobian | ( | int | t | ) | const |
Returns the Jacobian of the equality constraints at timestep t.
std::vector<Eigen::Triplet<double> > exotica::AbstractTimeIndexedProblem::GetEqualityJacobianTriplets | ( | ) | const |
Returns a vector of triplets to fill a sparse Jacobian for the equality constraints.
Eigen::VectorXd exotica::AbstractTimeIndexedProblem::GetGoal | ( | const std::string & | task_name, |
int | t = 0 |
||
) |
Returns the goal for a given task at a given timestep (cost task).
task_name | Name of task |
t | Timestep |
Eigen::VectorXd exotica::AbstractTimeIndexedProblem::GetGoalEQ | ( | const std::string & | task_name, |
int | t = 0 |
||
) |
Returns the goal for a given task at a given timestep (equality task).
task_name | Name of task |
t | Timestep |
Eigen::VectorXd exotica::AbstractTimeIndexedProblem::GetGoalNEQ | ( | const std::string & | task_name, |
int | t = 0 |
||
) |
Returns the goal for a given task at a given timestep (goal task).
task_name | Name of task |
t | Timestep |
Eigen::VectorXd exotica::AbstractTimeIndexedProblem::GetInequality | ( | ) | const |
Returns the inequality constraint values for the entire trajectory.
Eigen::VectorXd exotica::AbstractTimeIndexedProblem::GetInequality | ( | int | t | ) | const |
Returns the value of the inequality constraints at timestep t.
Eigen::SparseMatrix<double> exotica::AbstractTimeIndexedProblem::GetInequalityJacobian | ( | ) | const |
Returns the sparse Jacobian matrix of the inequality constraints over the entire trajectory.
Eigen::MatrixXd exotica::AbstractTimeIndexedProblem::GetInequalityJacobian | ( | int | t | ) | const |
Returns the Jacobian of the inequality constraints at timestep t.
std::vector<Eigen::Triplet<double> > exotica::AbstractTimeIndexedProblem::GetInequalityJacobianTriplets | ( | ) | const |
Returns a vector of triplets to fill a sparse Jacobian for the inequality constraints.
std::vector<Eigen::VectorXd> exotica::AbstractTimeIndexedProblem::GetInitialTrajectory | ( | ) | const |
Returns the initial trajectory/seed.
Eigen::VectorXd exotica::AbstractTimeIndexedProblem::GetJointVelocityConstraint | ( | ) | const |
Returns the joint velocity constraint inequality terms (linear).
Eigen::MatrixXd exotica::AbstractTimeIndexedProblem::GetJointVelocityConstraintBounds | ( | ) | const |
Returns the joint velocity constraint bounds (constant terms).
std::vector<Eigen::Triplet<double> > exotica::AbstractTimeIndexedProblem::GetJointVelocityConstraintJacobianTriplets | ( | ) | const |
Returns the joint velocity constraint Jacobian as triplets.
Eigen::VectorXd exotica::AbstractTimeIndexedProblem::GetJointVelocityLimits | ( | ) | const |
Returns the per-DoF joint velocity limit vector.
double exotica::AbstractTimeIndexedProblem::GetRho | ( | const std::string & | task_name, |
int | t = 0 |
||
) |
Returns the precision (Rho) for a given task at a given timestep (cost task).
task_name | Name of task |
t | Timestep |
double exotica::AbstractTimeIndexedProblem::GetRhoEQ | ( | const std::string & | task_name, |
int | t = 0 |
||
) |
Returns the precision (Rho) for a given task at a given timestep (equality task).
task_name | Name of task |
t | Timestep |
double exotica::AbstractTimeIndexedProblem::GetRhoNEQ | ( | const std::string & | task_name, |
int | t = 0 |
||
) |
Returns the precision (Rho) for a given task at a given timestep (equality task).
task_name | Name of task |
t | Timestep |
double exotica::AbstractTimeIndexedProblem::GetScalarTaskCost | ( | int | t | ) | const |
Returns the scalar task cost at timestep t.
Eigen::RowVectorXd exotica::AbstractTimeIndexedProblem::GetScalarTaskJacobian | ( | int | t | ) | const |
Returns the Jacobian of the scalar task cost at timestep t.
double exotica::AbstractTimeIndexedProblem::GetScalarTransitionCost | ( | int | t | ) | const |
Returns the scalar transition cost (x^T*W*x) at timestep t.
Eigen::RowVectorXd exotica::AbstractTimeIndexedProblem::GetScalarTransitionJacobian | ( | int | t | ) | const |
Returns the Jacobian of the transition cost at timestep t.
int exotica::AbstractTimeIndexedProblem::GetT | ( | ) | const |
Returns the number of timesteps in the trajectory.
double exotica::AbstractTimeIndexedProblem::GetTau | ( | ) | const |
Returns the time discretization tau for the trajectory.
|
virtual |
Updates internal variables before solving, e.g., after setting new values for Rho.
Reimplemented from exotica::PlanningProblem.
Reimplemented in exotica::UnconstrainedTimeIndexedProblem, and exotica::BoundedTimeIndexedProblem.
|
protectedvirtual |
Reimplemented in exotica::UnconstrainedTimeIndexedProblem, and exotica::BoundedTimeIndexedProblem.
void exotica::AbstractTimeIndexedProblem::SetGoal | ( | const std::string & | task_name, |
Eigen::VectorXdRefConst | goal, | ||
int | t = 0 |
||
) |
Sets goal for a given task at a given timestep (cost task).
task_name | Name of task |
goal | Goal |
t | Timestep |
void exotica::AbstractTimeIndexedProblem::SetGoalEQ | ( | const std::string & | task_name, |
Eigen::VectorXdRefConst | goal, | ||
int | t = 0 |
||
) |
Sets goal for a given task at a given timestep (equality task).
task_name | Name of task |
goal | Goal |
t | Timestep |
void exotica::AbstractTimeIndexedProblem::SetGoalNEQ | ( | const std::string & | task_name, |
Eigen::VectorXdRefConst | goal, | ||
int | t = 0 |
||
) |
Sets goal for a given task at a given timestep (inequality task).
task_name | Name of task |
goal | Goal |
t | Timestep |
void exotica::AbstractTimeIndexedProblem::SetInitialTrajectory | ( | const std::vector< Eigen::VectorXd > & | q_init_in | ) |
Sets the initial trajectory/seed.
q_init_in | Vector of states. Expects T states of dimension N. |
void exotica::AbstractTimeIndexedProblem::SetJointVelocityLimits | ( | const Eigen::VectorXd & | qdot_max_in | ) |
Sets the joint velocity limits. Supports N- and 1-dimensional vectors.
void exotica::AbstractTimeIndexedProblem::SetRho | ( | const std::string & | task_name, |
const double | rho, | ||
int | t = 0 |
||
) |
Sets Rho for a given task at a given timestep (cost task).
task_name | Name of task |
rho | Rho (scaling/precision) |
t | Timestep |
void exotica::AbstractTimeIndexedProblem::SetRhoEQ | ( | const std::string & | task_name, |
const double | rho, | ||
int | t = 0 |
||
) |
Sets Rho for a given task at a given timestep (equality task).
task_name | Name of task |
rho | Rho (scaling/precision) |
t | Timestep |
void exotica::AbstractTimeIndexedProblem::SetRhoNEQ | ( | const std::string & | task_name, |
const double | rho, | ||
int | t = 0 |
||
) |
Sets Rho for a given task at a given timestep (inequality task).
task_name | Name of task |
rho | Rho (scaling/precision) |
t | Timestep |
void exotica::AbstractTimeIndexedProblem::SetT | ( | const int | T_in | ) |
Sets the number of timesteps in the trajectory. Note: Rho/Goal need to be updated for every timestep after calling this method.
void exotica::AbstractTimeIndexedProblem::SetTau | ( | const double | tau_in | ) |
Sets the time discretization tau for the trajectory.
|
virtual |
Updates an individual timestep from a given state vector.
x_in | State |
t | Timestep to update |
Reimplemented in exotica::UnconstrainedTimeIndexedProblem, and exotica::BoundedTimeIndexedProblem.
void exotica::AbstractTimeIndexedProblem::Update | ( | Eigen::VectorXdRefConst | x_trajectory_in | ) |
Updates the entire problem from a given trajectory (e.g., used in an optimization solver)
x_trajectory_in | Trajectory flattened as a vector; expects dimension: (T - 1) * N |
|
inlineprotected |
Checks the desired time index for bounds and supports -1 indexing.
|
protected |
|
protected |
|
protected |
|
protected |
TimeIndexedTask exotica::AbstractTimeIndexedProblem::cost |
Cost task.
|
protected |
|
protected |
Normalisation of scalar cost and Jacobian over trajectory length.
TimeIndexedTask exotica::AbstractTimeIndexedProblem::equality |
General equality task.
|
protected |
std::vector<Hessian> exotica::AbstractTimeIndexedProblem::hessian |
TimeIndexedTask exotica::AbstractTimeIndexedProblem::inequality |
General inequality task.
|
protected |
|
protected |
std::vector<Eigen::MatrixXd> exotica::AbstractTimeIndexedProblem::jacobian |
|
protected |
|
protected |
|
protected |
int exotica::AbstractTimeIndexedProblem::length_jacobian |
int exotica::AbstractTimeIndexedProblem::length_Phi |
int exotica::AbstractTimeIndexedProblem::num_tasks |
std::vector<TaskSpaceVector> exotica::AbstractTimeIndexedProblem::Phi |
|
protected |
Joint velocity limit (rad/s)
|
protected |
Number of time steps.
|
protected |
Time step duration.
bool exotica::AbstractTimeIndexedProblem::use_bounds |
Eigen::MatrixXd exotica::AbstractTimeIndexedProblem::W |
|
protected |
Kinematic system transition error covariance multiplier (constant throughout the trajectory)
|
protected |
Current internal problem state.
|
protected |
|
protected |
Maximum change in the variables in a single timestep tau_. Gets set/updated via SetJointVelocityLimits or ReinitializeVariables.