PRM's setConnectionFilter with python bindings

Issue #392 wontfix
Elad Pardilov
created an issue

Hello,

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 RigidBodyPlanning.py 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 "rigid_body_planning.py", line 87, in <module>

plan()

File "rigid_body_planning.py", line 64, in plan

planner.setConnectionFilter(myConnectionFilter)

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 https://ompl.kavrakilab.org/RigidBodyPlanningWithODESolverAndControls_8py_source.html)

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:

        planner.setConnectionFilter(og.ConnectionFilter(myConnectionFilter))
    

    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