when compiling my own project, I got an error as follows:
myRRT.cc:80:78: error: no matching function for call to ‘ompl::tools::SelfConfig::getDefaultNearestNeighbors(ompl::geometric::RRT*)’
nn_.reset(tools::SelfConfig::getDefaultNearestNeighbors<Motion *>(this));
^
In file included from /home/htf/Downloads/Active-ORB-SLAM2-octomap/src/myRRT.cc:36:0:
/opt/ros/indigo/include/ompl/tools/config/SelfConfig.h:93:42: note: candidate: template<class _T> static ompl::NearestNeighbors<_T>* ompl::tools::SelfConfig::getDefaultNearestNeighbors(const StateSpacePtr&)
static NearestNeighbors<_T>* getDefaultNearestNeighbors(const base::StateSpacePtr &space)
^
/opt/ros/indigo/include/ompl/tools/config/SelfConfig.h:93:42: note: template argument deduction/substitution failed:
/home/htf/Downloads/Active-ORB-SLAM2-octomap/src/myRRT.cc:80:78: note: cannot convert ‘(ompl::geometric::RRT*)this’ (type ‘ompl::geometric::RRT*’) to type ‘const StateSpacePtr& {aka const boost::shared_ptr<ompl::base::StateSpace>&}’
nn_.reset(tools::SelfConfig::getDefaultNearestNeighbors<Motion *>(this))
here is a part of my source code,
void ompl::geometric::RRT::setup()
{
Planner::setup();
tools::SelfConfig sc(si_, getName());
sc.configurePlannerRange(maxDistance_);
if (!nn_)
nn_.reset(tools::SelfConfig::getDefaultNearestNeighbors<Motion *>(this));
nn_->setDistanceFunction(std::bind(&RRT::distanceFunction, this, std::placeholders::_1, std::placeholders::_2));
}
this is one of a example file what I have referedRRT does anyone have encountered the similar question? i'am new to C++, hope to get some clues. thank you in advance.
ompl::tools::SelfConfig::getDefaultNearestNeighbors(ompl::geometric::RRT*)
so you should modify it like this:nn_.reset(tools::SelfConfig::getDefaultNearestNeighbors<Motion>(*this));
maybemotion
is the templete and (*this) means you want to call object using (*this) I am also the green hand. I am not sure.