Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions src/pyhpp/manipulation/path-planner.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,29 @@ PathVectorPtr_t TransitionPlanner::planPath(ConfigurationIn_t qInit,
return trObj()->planPath(qInit, qGoals, resetRoadmap);
}

PathVectorPtr_t TransitionPlanner::planPathSingle(ConfigurationIn_t qInit,
ConfigurationIn_t qGoal,
bool resetRoadmap) {
const size_type n = obj->problem()->robot()->configSize();
if (qInit.rows() != n) {
std::ostringstream os;
os << "qInit = " << hpp::pinocchio::displayConfig(qInit)
<< "should be of size " << n << ".";
throw std::logic_error(os.str().c_str());
}
if (qGoal.rows() != n) {
std::ostringstream os;
os << "qGoal = " << hpp::pinocchio::displayConfig(qGoal)
<< "should be of size " << n << ".";
throw std::logic_error(os.str().c_str());
}
// Build a C++-owned (1 x n) MatrixXd to avoid the eigenpy (1,N) conversion
// issue where Ref<const MatrixXd> receives garbage values for rows()>0 index.
hpp::constraints::matrix_t goals(1, n);
goals.row(0) = qGoal;
return trObj()->planPath(qInit, goals, resetRoadmap);
}

tuple TransitionPlanner::directPath(ConfigurationIn_t q1, ConfigurationIn_t q2,
bool validate) {
if (q1.rows() != obj->problem()->robot()->configSize()) {
Expand Down Expand Up @@ -255,6 +278,8 @@ void exposePathPlanners() {
.def("innerProblem", &TransitionPlanner::innerProblem,
DocClassMethod(innerProblem))
.def("planPath", &TransitionPlanner::planPath, DocClassMethod(planPath))
.def("planPathSingle", &TransitionPlanner::planPathSingle,
DocClassMethod(planPath))
.def("directPath", &TransitionPlanner::directPath)
.def("validateConfiguration", &TransitionPlanner::validateConfiguration)
.def("optimizePath", &TransitionPlanner::optimizePath,
Expand Down
2 changes: 2 additions & 0 deletions src/pyhpp/manipulation/path-planner.hh
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ struct TransitionPlanner : public pyhpp::core::PathPlanner {
pyhpp::core::Problem innerProblem() const;
PathVectorPtr_t planPath(ConfigurationIn_t qInit, matrixIn_t qGoals,
bool resetRoadmap);
PathVectorPtr_t planPathSingle(ConfigurationIn_t qInit,
ConfigurationIn_t qGoal, bool resetRoadmap);
tuple directPath(ConfigurationIn_t q1, ConfigurationIn_t q2, bool validate);
tuple validateConfiguration(ConfigurationIn_t q, std::size_t id) const;
PathVectorPtr_t optimizePath(const PathPtr_t& path);
Expand Down