Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Fix stubgen #1254

Open
wants to merge 18 commits into
base: production
Choose a base branch
from
12 changes: 12 additions & 0 deletions python/bindings/bindings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,18 @@ void init_python_bindings()
.def("close",&PyVoidHandle::Close,"deprecated")
.def("Close",&PyVoidHandle::Close)
;

#ifdef USE_PYBIND11_PYTHON_BINDINGS
class_<PyVoidHandleConst, OPENRAVE_SHARED_PTR<PyVoidHandleConst> >(m, "VoidHandleConst")
.def(init<>())
// error: static assertion failed: Holder classes are only supported for custom types, so cannot do
// .def(init<OPENRAVE_SHARED_PTR<void>>(), "handle"_a)
#else
class_<PyVoidHandleConst, OPENRAVE_SHARED_PTR<PyVoidHandleConst> >("VoidHandleConst")
#endif
.def("close",&PyVoidHandleConst::Close,"deprecated")
.def("Close",&PyVoidHandleConst::Close)
;
}

} // namespace openravepy
4 changes: 4 additions & 0 deletions python/bindings/include/openravepy/bindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,11 @@ inline std::string GetPyErrorString()
}

/// should call in the beginning of all BOOST_PYTHON_MODULE
#ifdef USE_PYBIND11_PYTHON_BINDINGS
void init_python_bindings(py::module& m);
#else
void init_python_bindings();
#endif

} // namespace openravepy

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,19 @@ class OPENRAVEPY_API PyCollisionCheckerBase : public PyInterfaceBase
virtual bool CheckSelfCollision(object o1, PyCollisionReportPtr pReport);
};

struct CollisionCheckerBaseInitializer
{
#ifdef USE_PYBIND11_PYTHON_BINDINGS
CollisionCheckerBaseInitializer(py::module& m_);
void init_openravepy_collisionchecker();
py::module& m;
py::class_<PyCollisionCheckerBase, OPENRAVE_SHARED_PTR<PyCollisionCheckerBase>, PyInterfaceBase> collisionchecker;
#else
CollisionCheckerBaseInitializer();
void init_openravepy_collisionchecker();
py::class_<PyCollisionCheckerBase, OPENRAVE_SHARED_PTR<PyCollisionCheckerBase>, bases<PyInterfaceBase> > collisionchecker;
#endif
};

} // namespace openravepy
#endif // OPENRAVEPY_INTERNAL_COLLISIONCHECKERBASE_H
14 changes: 14 additions & 0 deletions python/bindings/include/openravepy/openravepy_collisionreport.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,20 @@ class OPENRAVEPY_API PyCollisionReport
uint32_t nKeepPrevious = 0;
};

struct CollisionReportInitializer
{
#ifdef USE_PYBIND11_PYTHON_BINDINGS
CollisionReportInitializer(py::module& m_);
void init_openravepy_collisionreport();
py::module& m;
py::class_<PyCollisionReport, OPENRAVE_SHARED_PTR<PyCollisionReport> > collisionreport;
#else
CollisionReportInitializer();
void init_openravepy_collisionreport();
py::class_<PyCollisionReport, OPENRAVE_SHARED_PTR<PyCollisionReport> > collisionreport;
#endif
};

} // namespace openravepy

#endif // OPENRAVEPY_INTERNAL_COLLISIONREPORT_H
16 changes: 15 additions & 1 deletion python/bindings/include/openravepy/openravepy_controllerbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,5 +73,19 @@ class PyMultiControllerBase : public PyControllerBase
object GetController(int dof);
};

struct ControllerBaseInitializer
{
#ifdef USE_PYBIND11_PYTHON_BINDINGS
ControllerBaseInitializer(py::module& m_);
void init_openravepy_controller();
py::module& m;
py::class_<PyControllerBase, OPENRAVE_SHARED_PTR<PyControllerBase>, PyInterfaceBase> controller;
#else
ControllerBaseInitializer();
void init_openravepy_controller();
py::class_<PyControllerBase, OPENRAVE_SHARED_PTR<PyControllerBase>, bases<PyInterfaceBase> > controller;
#endif
};

} // namespace openravepy
#endif // OPENRAVEPY_INTERNAL_CONTROLLERBASE_H
#endif // OPENRAVEPY_INTERNAL_CONTROLLERBASE_H
12 changes: 12 additions & 0 deletions python/bindings/include/openravepy/openravepy_ikparameterization.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,18 @@ class PyIkParameterization
void _Update(const IkParameterization& ikparam);
};

struct IkParameterizationInitializer
{
#ifdef USE_PYBIND11_PYTHON_BINDINGS
IkParameterizationInitializer(py::module& m_);
void init_openravepy_ikparameterization();
py::module& m;
#else
IkParameterizationInitializer();
void init_openravepy_ikparameterization();
#endif
};

} // namespace openravepy

#endif // OPENRAVEPY_IKPARAMETERIZATION_H
13 changes: 13 additions & 0 deletions python/bindings/include/openravepy/openravepy_iksolverbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,5 +102,18 @@ class PyIkSolverBase : public PyInterfaceBase

object RegisterCustomFilter(int priority, object fncallback);
};

struct IkSolverBaseInitializer
{
#ifdef USE_PYBIND11_PYTHON_BINDINGS
IkSolverBaseInitializer(py::module& m_);
void init_openravepy_iksolver();
py::module& m;
#else
IkSolverBaseInitializer();
void init_openravepy_iksolver();
#endif
};

} // namespace openravepy
#endif // OPENRAVEPY_INTERNAL_IKSOLVERBASE_H
68 changes: 13 additions & 55 deletions python/bindings/include/openravepy/openravepy_int.h
Original file line number Diff line number Diff line change
Expand Up @@ -597,11 +597,7 @@ class OPENRAVEPY_API PyRay

OPENRAVEPY_API py::object toPyGraphHandle(const GraphHandlePtr p);
OPENRAVEPY_API py::object toPyUserData(UserDataPtr p);
#ifdef USE_PYBIND11_PYTHON_BINDINGS
void init_openravepy_ikparameterization(py::module& m);
#else
void init_openravepy_ikparameterization();
#endif

OPENRAVEPY_API py::object toPyAABB(const AABB& ab);
/// \brief PyAABB -> AABB
OPENRAVEPY_API AABB ExtractAABB(py::object o);
Expand Down Expand Up @@ -751,38 +747,20 @@ OPENRAVEPY_API void UnlockEnvironment(PyEnvironmentBasePtr);
OPENRAVEPY_API int RaveGetEnvironmentId(PyEnvironmentBasePtr pyenv);
OPENRAVEPY_API PyEnvironmentBasePtr RaveGetEnvironment(int id);

#ifdef USE_PYBIND11_PYTHON_BINDINGS
void init_openravepy_collisionchecker(py::module& m);
#else
void init_openravepy_collisionchecker();
#endif
OPENRAVEPY_API CollisionCheckerBasePtr GetCollisionChecker(PyCollisionCheckerBasePtr);
OPENRAVEPY_API PyInterfaceBasePtr toPyCollisionChecker(CollisionCheckerBasePtr, PyEnvironmentBasePtr);
OPENRAVEPY_API bool IsCollisionReport(py::object);
OPENRAVEPY_API bool UpdateCollisionReport(py::object, const CollisionReport&);
OPENRAVEPY_API PyCollisionReportPtr toPyCollisionReport(const CollisionReportPtr& p);
OPENRAVEPY_API PyCollisionReportPtr toPyCollisionReport(const CollisionReport&);
#ifdef USE_PYBIND11_PYTHON_BINDINGS
void init_openravepy_controller(py::module& m);
#else
void init_openravepy_controller();
#endif
OPENRAVEPY_API ControllerBasePtr GetController(PyControllerBasePtr);
OPENRAVEPY_API PyInterfaceBasePtr toPyController(ControllerBasePtr, PyEnvironmentBasePtr);
#ifdef USE_PYBIND11_PYTHON_BINDINGS
void init_openravepy_iksolver(py::module& m);
#else
void init_openravepy_iksolver();
#endif

OPENRAVEPY_API IkSolverBasePtr GetIkSolver(py::object);
OPENRAVEPY_API IkSolverBasePtr GetIkSolver(PyIkSolverBasePtr);
OPENRAVEPY_API PyInterfaceBasePtr toPyIkSolver(IkSolverBasePtr, PyEnvironmentBasePtr);
OPENRAVEPY_API py::object toPyIkSolver(IkSolverBasePtr, py::object);
#ifdef USE_PYBIND11_PYTHON_BINDINGS
void init_openravepy_kinbody(py::module& m);
#else
void init_openravepy_kinbody();
#endif

OPENRAVEPY_API KinBodyPtr GetKinBody(py::object);
OPENRAVEPY_API KinBodyPtr GetKinBody(PyKinBodyPtr);
OPENRAVEPY_API PyEnvironmentBasePtr GetPyEnvFromPyKinBody(py::object okinbody);
Expand All @@ -797,46 +775,26 @@ OPENRAVEPY_API py::object toPyKinBodyJoint(KinBody::JointPtr pjoint, PyEnvironme
OPENRAVEPY_API KinBody::JointPtr GetKinBodyJoint(py::object);
OPENRAVEPY_API std::string reprPyKinBodyJoint(py::object);
OPENRAVEPY_API std::string strPyKinBodyJoint(py::object);
#ifdef USE_PYBIND11_PYTHON_BINDINGS
void init_openravepy_module(py::module& m);
#else
void init_openravepy_module();
#endif

OPENRAVEPY_API ModuleBasePtr GetModule(PyModuleBasePtr);
OPENRAVEPY_API PyInterfaceBasePtr toPyModule(ModuleBasePtr, PyEnvironmentBasePtr);
#ifdef USE_PYBIND11_PYTHON_BINDINGS
void init_openravepy_physicsengine(py::module& m);
#else
void init_openravepy_physicsengine();
#endif

OPENRAVEPY_API PhysicsEngineBasePtr GetPhysicsEngine(PyPhysicsEngineBasePtr);
OPENRAVEPY_API PyInterfaceBasePtr toPyPhysicsEngine(PhysicsEngineBasePtr, PyEnvironmentBasePtr);
#ifdef USE_PYBIND11_PYTHON_BINDINGS
void init_openravepy_planner(py::module& m);
#else
void init_openravepy_planner();
#endif

OPENRAVEPY_API PlannerBasePtr GetPlanner(PyPlannerBasePtr);
OPENRAVEPY_API PyInterfaceBasePtr toPyPlanner(PlannerBasePtr, PyEnvironmentBasePtr);
OPENRAVEPY_API PlannerBase::PlannerParametersPtr GetPlannerParameters(py::object);
OPENRAVEPY_API PlannerBase::PlannerParametersConstPtr GetPlannerParametersConst(py::object);

OPENRAVEPY_API py::object toPyPlannerParameters(PlannerBase::PlannerParametersPtr params);
#ifdef USE_PYBIND11_PYTHON_BINDINGS
void init_openravepy_robot(py::module& m);
#else
void init_openravepy_robot();
#endif

OPENRAVEPY_API RobotBasePtr GetRobot(py::object);
OPENRAVEPY_API RobotBasePtr GetRobot(PyRobotBasePtr);
OPENRAVEPY_API PyInterfaceBasePtr toPyRobot(RobotBasePtr, PyEnvironmentBasePtr);
OPENRAVEPY_API RobotBase::ManipulatorPtr GetRobotManipulator(py::object);
OPENRAVEPY_API py::object toPyRobotManipulator(RobotBase::ManipulatorPtr, PyEnvironmentBasePtr);
#ifdef USE_PYBIND11_PYTHON_BINDINGS
void init_openravepy_sensor(py::module& m);
#else
void init_openravepy_sensor();
#endif

OPENRAVEPY_API SensorBasePtr GetSensor(PySensorBasePtr);
OPENRAVEPY_API PyInterfaceBasePtr toPySensor(SensorBasePtr, PyEnvironmentBasePtr);
OPENRAVEPY_API py::object toPySensorData(SensorBasePtr, PyEnvironmentBasePtr);
Expand All @@ -854,11 +812,7 @@ void init_openravepy_spacesampler();
#endif
OPENRAVEPY_API SpaceSamplerBasePtr GetSpaceSampler(PySpaceSamplerBasePtr);
OPENRAVEPY_API PyInterfaceBasePtr toPySpaceSampler(SpaceSamplerBasePtr, PyEnvironmentBasePtr);
#ifdef USE_PYBIND11_PYTHON_BINDINGS
void init_openravepy_trajectory(py::module& m);
#else
void init_openravepy_trajectory();
#endif

OPENRAVEPY_API TrajectoryBasePtr GetTrajectory(py::object);
OPENRAVEPY_API TrajectoryBasePtr GetTrajectory(PyTrajectoryBasePtr);
OPENRAVEPY_API PyInterfaceBasePtr toPyTrajectory(TrajectoryBasePtr, PyEnvironmentBasePtr);
Expand Down Expand Up @@ -895,9 +849,13 @@ OPENRAVEPY_API PyConnectedBodyInfoPtr toPyConnectedBodyInfo(const RobotBase::Con

OPENRAVEPY_API PyInterfaceBasePtr RaveCreateInterface(PyEnvironmentBasePtr pyenv, InterfaceType type, const std::string& name);
#ifdef USE_PYBIND11_PYTHON_BINDINGS
void init_openravepy_global_basic(py::module& m);
void init_openravepy_global(py::module& m);
void init_openravepy_global_functions(py::module& m);
#else
void init_openravepy_global_basic();
void init_openravepy_global();
void init_openravepy_global_functions();
#endif
#ifdef USE_PYBIND11_PYTHON_BINDINGS
void InitPlanningUtils(py::module& m);
Expand Down
14 changes: 14 additions & 0 deletions python/bindings/include/openravepy/openravepy_kinbody.h
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,20 @@ class OPENRAVEPY_API PyKinBody : public PyInterfaceBase
template <typename T>
py::object GetCustomParameters(const std::map<std::string, std::vector<T> >& parameters, py::object oname = py::none_(), int index = -1);

struct KinBodyInitializer
{
#ifdef USE_PYBIND11_PYTHON_BINDINGS
KinBodyInitializer(py::module& m_);
void init_openravepy_kinbody();
py::module& m;
py::class_<PyKinBody, OPENRAVE_SHARED_PTR<PyKinBody>, PyInterfaceBase> kinbody;
#else
KinBodyInitializer();
void init_openravepy_kinbody();
py::class_<PyKinBody, OPENRAVE_SHARED_PTR<PyKinBody>, bases<PyInterfaceBase> > kinbody;
#endif
};

} // namespace openravepy

#endif
14 changes: 13 additions & 1 deletion python/bindings/include/openravepy/openravepy_module.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,17 @@ class OPENRAVEPY_API PyModuleBase : public PyInterfaceBase
bool SimulationStep(dReal fElapsedTime);
};

struct ModuleBaseInitializer
{
#ifdef USE_PYBIND11_PYTHON_BINDINGS
ModuleBaseInitializer(py::module& m_);
void init_openravepy_module();
py::module& m;
#else
ModuleBaseInitializer();
void init_openravepy_module();
#endif
};

} // namespace openravepy
#endif // OPENRAVEPY_INTERNAL_MODULE_H
#endif // OPENRAVEPY_INTERNAL_MODULE_H
12 changes: 12 additions & 0 deletions python/bindings/include/openravepy/openravepy_physicalenginebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,18 @@ class PyPhysicsEngineBase : public PyInterfaceBase
void SimulateStep(dReal fTimeElapsed);
};

struct PhysicsEngineBaseInitializer
{
#ifdef USE_PYBIND11_PYTHON_BINDINGS
PhysicsEngineBaseInitializer(py::module& m_);
void init_openravepy_physicsengine();
py::module& m;
#else
PhysicsEngineBaseInitializer();
void init_openravepy_physicsengine();
#endif
};

} // namespace openravepy

#endif // OPENRAVEPY_INTERNAL_PHYSICSENGINE_H
14 changes: 14 additions & 0 deletions python/bindings/include/openravepy/openravepy_plannerbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,19 @@ class PyPlannerBase : public PyInterfaceBase
PlannerBasePtr GetPlanner();
};

struct PlannerBaseInitializer
{
#ifdef USE_PYBIND11_PYTHON_BINDINGS
PlannerBaseInitializer(py::module& m_);
void init_openravepy_planner();
py::module& m;
py::class_<PyPlannerBase, OPENRAVE_SHARED_PTR<PyPlannerBase>, PyInterfaceBase> planner;
#else
PlannerBaseInitializer();
void init_openravepy_planner();
py::class_<PyPlannerBase, OPENRAVE_SHARED_PTR<PyPlannerBase>, bases<PyInterfaceBase> > planner;
#endif
};

} // namespace openravepy
#endif // OPENRAVEPY_INTERNAL_PLANNERBASE_H
14 changes: 14 additions & 0 deletions python/bindings/include/openravepy/openravepy_robotbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,20 @@ class OPENRAVEPY_API PyRobotBase : public PyKinBody
virtual void __enter__();
};

struct RobotBaseInitializer
{
#ifdef USE_PYBIND11_PYTHON_BINDINGS
RobotBaseInitializer(py::module& m_);
void init_openravepy_robot();
py::module& m;
py::class_<PyRobotBase, OPENRAVE_SHARED_PTR<PyRobotBase>, PyKinBody> robot;
#else
RobotBaseInitializer();
void init_openravepy_robot();
py::class_<PyRobotBase, OPENRAVE_SHARED_PTR<PyRobotBase>, bases<PyKinBody, PyInterfaceBase> > robot;
#endif
};

} // namespace openravepy

#endif // OPENRAVEPY_INTERNAL_ROBOT_H
14 changes: 14 additions & 0 deletions python/bindings/include/openravepy/openravepy_sensorbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,20 @@ class PySensorBase : public PyInterfaceBase
virtual object __unicode__();
};

struct SensorBaseInitializer
{
#ifdef USE_PYBIND11_PYTHON_BINDINGS
SensorBaseInitializer(py::module& m_);
void init_openravepy_sensor();
py::module& m;
py::class_<PySensorBase, OPENRAVE_SHARED_PTR<PySensorBase>, PyInterfaceBase> sensor;
#else
SensorBaseInitializer();
void init_openravepy_sensor();
py::class_<PySensorBase, OPENRAVE_SHARED_PTR<PySensorBase>, bases<PyInterfaceBase> > sensor;
#endif
};

} // namespace openravepy

#endif // OPENRAVEPY_INTERNAL_SENSORBASE_H
Loading
Loading