41 N =
scene_->GetKinematicTree().GetNumControlledJoints();
57 if (init.LowerBound.rows() ==
N)
59 scene_->GetKinematicTree().SetJointLimitsLower(init.LowerBound);
61 else if (init.LowerBound.rows() != 0)
63 ThrowNamed(
"Lower bound size incorrect! Expected " <<
N <<
" got " << init.LowerBound.rows());
65 if (init.UpperBound.rows() ==
N)
67 scene_->GetKinematicTree().SetJointLimitsUpper(init.UpperBound);
69 else if (init.UpperBound.rows() != 0)
71 ThrowNamed(
"Lower bound size incorrect! Expected " <<
N <<
" got " << init.UpperBound.rows());
89 bool succeeded =
true;
90 auto bounds =
scene_->GetKinematicTree().GetJointLimits();
92 std::cout.precision(4);
95 for (
int t = 0;
t <
T_; ++
t)
100 for (
int i = 0; i <
N; ++i)
102 constexpr
double tolerance = 1.e-3;
103 if (
x[
t](i) < bounds(i, 0) - tolerance ||
x[
t](i) > bounds(i, 1) + tolerance)
105 if (
debug_)
HIGHLIGHT_NAMED(
"TimeIndexedProblem::IsValid",
"State at timestep " <<
t <<
" is out of bounds: joint #" << i <<
": " << bounds(i, 0) <<
" < " <<
x[
t](i) <<
" < " << bounds(i, 1));
134 if (((
x[
t] -
x[
t - 1]).cwiseAbs() -
xdiff_max_).maxCoeff() > 1.e-5)
136 if (
debug_)
HIGHLIGHT_NAMED(
"TimeIndexedProblem::IsValid",
"Violated joint velocity constraints at timestep " <<
t <<
": (" << (
x[
t] -
x[
t - 1]).transpose() <<
"), (limit=" <<
xdiff_max_.transpose() <<
"), violation: (" << ((
x[
t] -
x[
t - 1]).cwiseAbs() -
xdiff_max_).transpose() <<
")");
Eigen::VectorXd GetInequality() const
Returns the inequality constraint values for the entire trajectory.
virtual Eigen::VectorXd ApplyStartState(bool update_traj=true)
TimeIndexedTask equality
General equality task.
bool IsValid() override
Evaluates whether the problem is valid, i.e., all bound and general constraints are satisfied...
TaskSpaceVector equality_Phi
geometry_msgs::TransformStamped t
virtual void ReinitializeVariables()
void Instantiate(const TimeIndexedProblemInitializer &init) override
Instantiates the problem from an Initializer.
virtual void Initialize(const std::vector< exotica::Initializer > &inits, std::shared_ptr< PlanningProblem > prob, TaskSpaceVector &Phi)
TimeIndexedTask inequality
General inequality task.
std::vector< Eigen::VectorXd > x
Current internal problem state.
double w_scale_
Kinematic system transition error covariance multiplier (constant throughout the trajectory) ...
int T_
Number of time steps.
TimeIndexedProblemInitializer parameters_
void SetJointVelocityLimits(const Eigen::VectorXd &qdot_max_in)
Sets the joint velocity limits. Supports N- and 1-dimensional vectors.
TimeIndexedTask cost
Cost task.
#define HIGHLIGHT_NAMED(name, x)
TaskSpaceVector inequality_Phi
Eigen::VectorXd GetEquality() const
Returns the equality constraint values for the entire trajectory.
double tau_
Time step duration.
Eigen::VectorXd xdiff_max_
Maximum change in the variables in a single timestep tau_. Gets set/updated via SetJointVelocityLimit...
Time-indexed problem with bound, joint velocity, and general equality/inequality constraints.
#define REGISTER_PROBLEM_TYPE(TYPE, DERIV)
Eigen::VectorXd q_dot_max_
Joint velocity limit (rad/s)