Go to the documentation of this file.
30 #ifndef EXOTICA_CORE_ABSTRACT_TIME_INDEXED_PROBLEM_H_
31 #define EXOTICA_CORE_ABSTRACT_TIME_INDEXED_PROBLEM_H_
33 #include <Eigen/Sparse>
77 Eigen::VectorXd
GetGoal(
const std::string& task_name,
int t = 0);
83 void SetRho(
const std::string& task_name,
const double rho,
int t = 0);
88 double GetRho(
const std::string& task_name,
int t = 0);
99 Eigen::VectorXd
GetGoalEQ(
const std::string& task_name,
int t = 0);
105 void SetRhoEQ(
const std::string& task_name,
const double rho,
int t = 0);
110 double GetRhoEQ(
const std::string& task_name,
int t = 0);
121 Eigen::VectorXd
GetGoalNEQ(
const std::string& task_name,
int t = 0);
127 void SetRhoNEQ(
const std::string& task_name,
const double rho,
int t = 0);
132 double GetRhoNEQ(
const std::string& task_name,
int t = 0);
141 void SetT(
const int T_in);
147 void SetTau(
const double tau_in);
231 std::vector<TaskSpaceVector>
Phi;
247 if (t_in >=
T_ || t_in < -1)
249 ThrowPretty(
"Requested t=" << t_in <<
" out of range, needs to be 0 =< t < " <<
T_);
260 std::vector<Eigen::VectorXd>
x;
289 #endif // EXOTICA_CORE_ABSTRACT_TIME_INDEXED_PROBLEM_H_
TaskSpaceVector cost_Phi
Definition: abstract_time_indexed_problem.h:265
std::vector< Eigen::VectorXd > initial_trajectory_
Definition: abstract_time_indexed_problem.h:269
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).
int get_active_nonlinear_inequality_constraints_dimension() const
Returns the dimension of the active inequality constraints.
Eigen::MatrixXd GetJointVelocityConstraintBounds() const
Returns the joint velocity constraint bounds (constant terms).
std::vector< std::pair< int, int > > active_nonlinear_inequality_constraints_
Definition: abstract_time_indexed_problem.h:279
int GetT() const
Returns the number of timesteps in the trajectory.
double GetScalarTransitionCost(int t) const
Returns the scalar transition cost (x^T*W*x) at timestep t.
int joint_velocity_constraint_dimension_
Definition: abstract_time_indexed_problem.h:284
std::vector< Eigen::VectorXd > x
Current internal problem state.
Definition: abstract_time_indexed_problem.h:260
double GetDuration() const
Returns the duration of the trajectory (T * tau).
void SetTau(const double tau_in)
Sets the time discretization tau for the trajectory.
Eigen::VectorXd GetGoalEQ(const std::string &task_name, int t=0)
Returns the goal for a given task at a given timestep (equality task).
double w_scale_
Kinematic system transition error covariance multiplier (constant throughout the trajectory)
Definition: abstract_time_indexed_problem.h:263
Eigen::VectorXd GetEquality() const
Returns the equality constraint values for the entire trajectory.
std::vector< Eigen::MatrixXd > jacobian
Definition: abstract_time_indexed_problem.h:232
void ValidateTimeIndex(int &t_in) const
Checks the desired time index for bounds and supports -1 indexing.
Definition: abstract_time_indexed_problem.h:245
void Update(Eigen::VectorXdRefConst x_trajectory_in)
Updates the entire problem from a given trajectory (e.g., used in an optimization solver)
Eigen::VectorXd GetGoal(const std::string &task_name, int t=0)
Returns the goal for a given task at a given timestep (cost task).
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).
Eigen::SparseMatrix< double > GetEqualityJacobian() const
Returns the sparse Jacobian matrix of the equality constraints over the entire trajectory.
Definition: cartpole_dynamics_solver.h:38
double GetScalarTaskCost(int t) const
Returns the scalar task cost at timestep t.
Eigen::VectorXd GetJointVelocityConstraint() const
Returns the joint velocity constraint inequality terms (linear).
double GetRhoEQ(const std::string &task_name, int t=0)
Returns the precision (Rho) for a given task at a given timestep (equality task).
TaskSpaceVector equality_Phi
Definition: abstract_time_indexed_problem.h:267
Eigen::VectorXd GetJointVelocityLimits() const
Returns the per-DoF joint velocity limit vector.
int T_
Number of time steps.
Definition: abstract_time_indexed_problem.h:257
Definition: abstract_time_indexed_problem.h:40
Eigen::VectorXd xdiff_max_
Maximum change in the variables in a single timestep tau_. Gets set/updated via SetJointVelocityLimit...
Definition: abstract_time_indexed_problem.h:275
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).
void SetT(const int T_in)
Sets the number of timesteps in the trajectory. Note: Rho/Goal need to be updated for every timestep ...
const typedef Eigen::Ref< const Eigen::VectorXd > & VectorXdRefConst
Convenience wrapper for storing references to sub-matrices/vectors.
Definition: conversions.h:52
double tau_
Time step duration.
Definition: abstract_time_indexed_problem.h:258
virtual void ReinitializeVariables()
bool use_bounds
Definition: abstract_time_indexed_problem.h:239
Definition: task_space_vector.h:50
std::vector< Hessian > hessian
Definition: abstract_time_indexed_problem.h:233
void SetJointVelocityLimits(const Eigen::VectorXd &qdot_max_in)
Sets the joint velocity limits. Supports N- and 1-dimensional vectors.
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).
int num_tasks
Definition: abstract_time_indexed_problem.h:238
std::vector< Eigen::Triplet< double > > GetInequalityJacobianTriplets() const
Returns a vector of triplets to fill a sparse Jacobian for the inequality constraints.
TimeIndexedTask equality
General equality task.
Definition: abstract_time_indexed_problem.h:226
int length_jacobian
Definition: abstract_time_indexed_problem.h:237
Eigen::VectorXd GetGoalNEQ(const std::string &task_name, int t=0)
Returns the goal for a given task at a given timestep (goal task).
TimeIndexedTask cost
Cost task.
Definition: abstract_time_indexed_problem.h:224
std::vector< TaskSpaceVector > Phi
Definition: abstract_time_indexed_problem.h:231
int get_joint_velocity_constraint_dimension() const
Returns the dimension of the joint velocity constraint (linear inequality).
double GetCost() const
Returns the scalar cost for the entire trajectory (both task and transition cost).
double get_ct() const
Returns the cost scaling factor.
int active_nonlinear_inequality_constraints_dimension_
Definition: abstract_time_indexed_problem.h:281
std::vector< Eigen::VectorXd > GetInitialTrajectory() const
Returns the initial trajectory/seed.
Eigen::RowVectorXd GetScalarTaskJacobian(int t) const
Returns the Jacobian of the scalar task cost at timestep t.
double GetRho(const std::string &task_name, int t=0)
Returns the precision (Rho) for a given task at a given timestep (cost task).
void SetInitialTrajectory(const std::vector< Eigen::VectorXd > &q_init_in)
Sets the initial trajectory/seed.
Eigen::MatrixXd GetBounds() const
Returns the joint bounds (first column lower, second column upper).
std::vector< std::pair< int, int > > active_nonlinear_equality_constraints_
Definition: abstract_time_indexed_problem.h:278
#define ThrowPretty(m)
Definition: exception.h:36
std::vector< Eigen::VectorXd > xdiff
Definition: abstract_time_indexed_problem.h:261
Definition: planning_problem.h:64
std::vector< Eigen::Triplet< double > > GetJointVelocityConstraintJacobianTriplets() const
Returns the joint velocity constraint Jacobian as triplets.
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).
Eigen::RowVectorXd GetCostJacobian() const
Returns the Jacobian of the scalar cost over the entire trajectory (Jacobian of GetCost).
Eigen::VectorXd q_dot_max_
Joint velocity limit (rad/s)
Definition: abstract_time_indexed_problem.h:274
std::vector< std::shared_ptr< KinematicResponse > > kinematic_solutions_
Definition: abstract_time_indexed_problem.h:270
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).
TimeIndexedTask inequality
General inequality task.
Definition: abstract_time_indexed_problem.h:225
virtual void PreUpdate()
Updates internal variables before solving, e.g., after setting new values for Rho.
TaskSpaceVector inequality_Phi
Definition: abstract_time_indexed_problem.h:266
double GetTau() const
Returns the time discretization tau for the trajectory.
AbstractTimeIndexedProblem()
int length_Phi
Definition: abstract_time_indexed_problem.h:236
int get_active_nonlinear_equality_constraints_dimension() const
Returns the dimension of the active equality constraints.
std::vector< Eigen::Triplet< double > > joint_velocity_constraint_jacobian_triplets_
Definition: abstract_time_indexed_problem.h:285
Eigen::RowVectorXd GetScalarTransitionJacobian(int t) const
Returns the Jacobian of the transition cost at timestep t.
Eigen::SparseMatrix< double > GetInequalityJacobian() const
Returns the sparse Jacobian matrix of the inequality constraints over the entire trajectory.
Eigen::MatrixXd W
Definition: abstract_time_indexed_problem.h:228
virtual ~AbstractTimeIndexedProblem()
double GetRhoNEQ(const std::string &task_name, int t=0)
Returns the precision (Rho) for a given task at a given timestep (equality task).
Eigen::VectorXd GetInequality() const
Returns the inequality constraint values for the entire trajectory.
double ct
Normalisation of scalar cost and Jacobian over trajectory length.
Definition: abstract_time_indexed_problem.h:272
std::vector< Eigen::Triplet< double > > GetEqualityJacobianTriplets() const
Returns a vector of triplets to fill a sparse Jacobian for the equality constraints.
int active_nonlinear_equality_constraints_dimension_
Definition: abstract_time_indexed_problem.h:280