46 std::vector<double> bounds;
47 auto joint_limits =
scene_->GetKinematicTree().GetJointLimits();
50 for (
unsigned int i = 0; i <
N; ++i)
52 bounds[i] = joint_limits(i, 0);
53 bounds[i +
N] = joint_limits(i, 1);
61 if (init.Goal.size() ==
N)
65 else if (init.Goal.size() == 0)
67 goal_ = Eigen::VectorXd::Zero(
N);
71 ThrowNamed(
"Dimension mismatch: problem N=" <<
N <<
", but goal state has dimension " << init.Goal.size());
93 if (compound_ && init.FloatingBaseLowerLimits.rows() > 0 && init.FloatingBaseUpperLimits.rows() > 0)
95 if (
scene_->GetKinematicTree().GetControlledBaseType() ==
exotica::BaseType::FLOATING && init.FloatingBaseLowerLimits.rows() == 6 && init.FloatingBaseUpperLimits.rows() == 6)
97 scene_->GetKinematicTree().SetFloatingBaseLimitsPosXYZEulerZYX(
98 std::vector<double>(init.FloatingBaseLowerLimits.data(), init.FloatingBaseLowerLimits.data() + init.FloatingBaseLowerLimits.size()),
99 std::vector<double>(init.FloatingBaseUpperLimits.data(), init.FloatingBaseUpperLimits.data() + init.FloatingBaseUpperLimits.size()));
101 else if (
scene_->GetKinematicTree().GetControlledBaseType() ==
exotica::BaseType::PLANAR && init.FloatingBaseLowerLimits.rows() == 3 && init.FloatingBaseUpperLimits.rows() == 3)
103 scene_->GetKinematicTree().SetPlanarBaseLimitsPosXYEulerZ(
104 std::vector<double>(init.FloatingBaseLowerLimits.data(), init.FloatingBaseLowerLimits.data() + init.FloatingBaseLowerLimits.size()),
105 std::vector<double>(init.FloatingBaseUpperLimits.data(), init.FloatingBaseUpperLimits.data() + init.FloatingBaseUpperLimits.size()));
119 for (
int i = 0; i <
tasks_.size(); ++i)
tasks_[i]->is_used =
false;
127 ThrowPretty(
"Dimensionality of goal state wrong: Got " << qT.rows() <<
", expected " <<
N);
142 ThrowPretty(
"Cannot set Goal. Task map '" << task_name <<
"' does not exist.");
156 ThrowPretty(
"Cannot set rho. Task map '" << task_name <<
"' does not exist.");
168 ThrowPretty(
"Cannot get Goal. Task map '" << task_name <<
"' does not exist.");
180 ThrowPretty(
"Cannot get rho. Task map '" << task_name <<
"' does not exist.");
194 ThrowPretty(
"Cannot set Goal. Task map '" << task_name <<
"' does not exist.");
208 ThrowPretty(
"Cannot set rho. Task map '" << task_name <<
"' does not exist.");
220 ThrowPretty(
"Cannot get Goal. Task map '" << task_name <<
"' does not exist.");
232 ThrowPretty(
"Cannot get rho. Task map '" << task_name <<
"' does not exist.");
251 const Eigen::VectorXd
x =
scene_->GetKinematicTree().GetControlledState();
252 const Eigen::MatrixXd bounds =
scene_->GetKinematicTree().GetJointLimits();
253 for (
int i = 0; i <
N; ++i)
255 if (x(i) < bounds(i, 0) || x(i) > bounds(i, 1))
257 if (
debug_)
HIGHLIGHT_NAMED(
"SamplingProblem::IsValid",
"State is out of bounds: joint #" << i <<
": " << bounds(i, 0) <<
" < " << x(i) <<
" < " << bounds(i, 1));
268 HIGHLIGHT_NAMED(
"SamplingProblem::IsValid",
"NEQ = " << std::boolalpha << inequality_is_valid <<
", EQ = " << equality_is_valid);
269 if (!equality_is_valid)
273 if (!inequality_is_valid)
279 return (inequality_is_valid && equality_is_valid);
std::vector< TaskVectorEntry > map
KinematicRequestFlags flags_
virtual Eigen::VectorXd ApplyStartState(bool update_traj=true)
void SetRhoEQ(const std::string &task_name, const double &rho)
bool IsValid() override
Evaluates whether the problem is valid.
void SetGoalNEQ(const std::string &task_name, Eigen::VectorXdRefConst goal)
unsigned int number_of_problem_updates_
bool IsStateValid(Eigen::VectorXdRefConst x)
void PreUpdate() override
void SetZero(const int n)
Eigen::VectorXd GetGoalEQ(const std::string &task_name)
void SetGoalState(Eigen::VectorXdRefConst qT)
void SetRhoNEQ(const std::string &task_name, const double &rho)
void Instantiate(const SamplingProblemInitializer &init) override
void Update(Eigen::VectorXdRefConst x)
Eigen::VectorXd GetGoalNEQ(const std::string &task_name)
std::vector< double > GetBounds()
virtual void Initialize(const std::vector< exotica::Initializer > &inits, std::shared_ptr< PlanningProblem > prob, TaskSpaceVector &Phi)
bool IsCompoundStateSpace()
const Eigen::Ref< const Eigen::VectorXd > & VectorXdRefConst
Convenience wrapper for storing references to sub-matrices/vectors.
double GetRhoNEQ(const std::string &task_name)
virtual ~SamplingProblem()
#define HIGHLIGHT_NAMED(name, x)
std::vector< TaskIndexing > indexing
void SetGoalEQ(const std::string &task_name, Eigen::VectorXdRefConst goal)
void AppendVector(std::vector< Val > &orig, const std::vector< Val > &extra)
double GetRhoEQ(const std::string &task_name)
#define REGISTER_PROBLEM_TYPE(TYPE, DERIV)
void Update(const TaskSpaceVector &big_Phi)