ompl_py.cpp
Go to the documentation of this file.
1 //
2 // Copyright (c) 2018, University of Edinburgh
3 // All rights reserved.
4 //
5 // Redistribution and use in source and binary forms, with or without
6 // modification, are permitted provided that the following conditions are met:
7 //
8 // * Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 // * Redistributions in binary form must reproduce the above copyright
11 // notice, this list of conditions and the following disclaimer in the
12 // documentation and/or other materials provided with the distribution.
13 // * Neither the name of nor the names of its contributors may be used to
14 // endorse or promote products derived from this software without specific
15 // prior written permission.
16 //
17 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
18 // AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
19 // IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
20 // ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
21 // LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22 // CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23 // SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24 // INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25 // CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26 // ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 // POSSIBILITY OF SUCH DAMAGE.
28 //
29 
30 #undef NDEBUG
31 #include <pybind11/eigen.h>
32 #include <pybind11/pybind11.h>
33 #include <pybind11/stl.h>
34 
36 
37 using namespace exotica;
38 namespace py = pybind11;
39 
40 PYBIND11_MODULE(exotica_ompl_solver_py, module)
41 {
42  module.doc() = "Exotica wrapper of OMPL solvers";
43 
44  py::module::import("pyexotica");
45 
46  py::class_<OMPLSolver<SamplingProblem>, std::shared_ptr<OMPLSolver<SamplingProblem>>, MotionSolver> ompl_solver(module, "OMPLMotionSolver");
47  ompl_solver.def("GetRandomSeed", &OMPLSolver<SamplingProblem>::GetRandomSeed);
48 
49  // State-space properties exposed via OMPLSolver
50  ompl_solver.def_property_readonly("maximum_extent", &OMPLSolver<SamplingProblem>::GetMaximumExtent);
53 
54  py::class_<RRTSolver, std::shared_ptr<RRTSolver>, OMPLSolver<SamplingProblem>> rrt(module, "RRTSolver");
55 
56  py::class_<RRTConnectSolver, std::shared_ptr<RRTConnectSolver>, OMPLSolver<SamplingProblem>> rrtcon(module, "RRTConnectSolver");
57  rrtcon.def_property("range", &RRTConnectSolver::GetRange, &RRTConnectSolver::SetRange);
58 
59  py::class_<ESTSolver, std::shared_ptr<ESTSolver>, OMPLSolver<SamplingProblem>> est(module, "ESTSolver");
60 
61  py::class_<KPIECESolver, std::shared_ptr<KPIECESolver>, OMPLSolver<SamplingProblem>> kpiece(module, "KPIECESolver");
62 
63  py::class_<BKPIECESolver, std::shared_ptr<BKPIECESolver>, OMPLSolver<SamplingProblem>> bkpiece(module, "BKPIECESolver");
64 
65  py::class_<PRMSolver, std::shared_ptr<PRMSolver>, OMPLSolver<SamplingProblem>> prm(module, "PRMSolver");
66  prm.def_property("multi_query", &PRMSolver::IsMultiQuery, &PRMSolver::SetMultiQuery);
67  prm.def("grow_roadmap", &PRMSolver::GrowRoadmap);
68  prm.def("expand_roadmap", &PRMSolver::ExpandRoadmap);
69  prm.def("clear", &PRMSolver::Clear);
70  prm.def("clear_query", &PRMSolver::ClearQuery);
71  prm.def("setup", &PRMSolver::Setup);
72  prm.def("edge_count", &PRMSolver::EdgeCount);
73  prm.def("milestone_count", &PRMSolver::MilestoneCount);
74 
75  py::class_<LazyPRMSolver, std::shared_ptr<LazyPRMSolver>, OMPLSolver<SamplingProblem>> lprm(module, "LazyPRMSolver");
76  lprm.def_property("multi_query", &LazyPRMSolver::IsMultiQuery, &LazyPRMSolver::SetMultiQuery);
77  lprm.def("clear", &LazyPRMSolver::Clear);
78  lprm.def("clear_query", &LazyPRMSolver::ClearQuery);
79  lprm.def("setup", &LazyPRMSolver::Setup);
80  lprm.def("edge_count", &LazyPRMSolver::EdgeCount);
81  lprm.def("milestone_count", &LazyPRMSolver::MilestoneCount);
82 }
void SetMultiQuery(bool val)
PYBIND11_MODULE(exotica_ompl_solver_py, module)
Definition: ompl_py.cpp:40
void ExpandRoadmap(double t)


exotica_ompl_solver
Author(s): Yiming Yang
autogenerated on Sat Apr 10 2021 02:36:37