PRM's setConnectionFilter with python bindings

Issue #392 wontfix
Elad Pardilov
created an issue


I installed the package, using python 2.7.12. Each and every demo is working fine on the system (ubuntu 16.04) using python.

I want to use the PRM class, and set a unique connection filter of my own. From what I understood so far I should do so with the function setConnectionFilter.

In the code attached, which is an altered version of the file from demos, I tried to create a very simple connection filter named myConnectionFilter (will upgrade it once it works), and no matter what I change in it, I keep getting this error:

" Traceback (most recent call last):

File "", line 87, in <module>


File "", line 64, in plan


Boost.Python.ArgumentError: Python argument types in

PRM.setConnectionFilter(PRM, function)

did not match C++ signature:

setConnectionFilter(ompl::geometric::PRM {lvalue}, std::function<bool (unsigned long const&, unsigned long const&)> connectionFilter)


I saw in some other demos that its possible to send a function like I did here (for example line 91 here

Can you tell me what I did wrong? How can I fix it?

Thanks a lot.

Comments (6)

  1. Mark Moll

    Part of the problem is that you need to cast a python function to the right C++ type like so:


    However, that doesn't fix the code, because your connection filter assumes states are given as input, when actually vertex id's are passed. You can get the graph from PRM with PRM::getRoadMap(), but won't help much. The graph is a Boost.Graph and we haven't created python bindings for that. Sorry, it looks like this cannot be done in python.

  2. Log in to comment