Skip to content

Commit

Permalink
Update python wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
jlblancoc committed Nov 5, 2023
1 parent 5916980 commit ec2e05e
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 163 deletions.
21 changes: 4 additions & 17 deletions python/src/mrpt/maps/CColouredOctoMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -986,31 +986,18 @@ struct PyCallBack_mrpt_maps_CColouredPointsMap : public mrpt::maps::CColouredPoi
}
return CPointsMap::asString();
}
bool nn_single_search(const struct mrpt::math::TPoint3D_<float> & a0, struct mrpt::math::TPoint3D_<float> & a1, float & a2) const override {
bool nn_supports_indices() const override {
pybind11::gil_scoped_acquire gil;
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::CColouredPointsMap *>(this), "nn_single_search");
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::CColouredPointsMap *>(this), "nn_supports_indices");
if (overload) {
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0, a1, a2);
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
static pybind11::detail::override_caster_t<bool> caster;
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
}
else return pybind11::detail::cast_safe<bool>(std::move(o));
}
return CPointsMap::nn_single_search(a0, a1, a2);
}
bool nn_single_search(const struct mrpt::math::TPoint2D_<float> & a0, struct mrpt::math::TPoint2D_<float> & a1, float & a2) const override {
pybind11::gil_scoped_acquire gil;
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::CColouredPointsMap *>(this), "nn_single_search");
if (overload) {
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0, a1, a2);
auto o = overload.operator()<pybind11::return_value_policy::reference>();
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
static pybind11::detail::override_caster_t<bool> caster;
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
}
else return pybind11::detail::cast_safe<bool>(std::move(o));
}
return CPointsMap::nn_single_search(a0, a1, a2);
return CPointsMap::nn_supports_indices();
}
void PLY_import_set_face_count(size_t a0) override {
pybind11::gil_scoped_acquire gil;
Expand Down
24 changes: 5 additions & 19 deletions python/src/mrpt/maps/COccupancyGridMap2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,31 +283,18 @@ struct PyCallBack_mrpt_maps_COccupancyGridMap2D : public mrpt::maps::COccupancyG
}
return COccupancyGridMap2D::asString();
}
bool nn_single_search(const struct mrpt::math::TPoint3D_<float> & a0, struct mrpt::math::TPoint3D_<float> & a1, float & a2) const override {
bool nn_supports_indices() const override {
pybind11::gil_scoped_acquire gil;
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::COccupancyGridMap2D *>(this), "nn_single_search");
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::COccupancyGridMap2D *>(this), "nn_supports_indices");
if (overload) {
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0, a1, a2);
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
static pybind11::detail::override_caster_t<bool> caster;
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
}
else return pybind11::detail::cast_safe<bool>(std::move(o));
}
return COccupancyGridMap2D::nn_single_search(a0, a1, a2);
}
bool nn_single_search(const struct mrpt::math::TPoint2D_<float> & a0, struct mrpt::math::TPoint2D_<float> & a1, float & a2) const override {
pybind11::gil_scoped_acquire gil;
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::COccupancyGridMap2D *>(this), "nn_single_search");
if (overload) {
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0, a1, a2);
auto o = overload.operator()<pybind11::return_value_policy::reference>();
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
static pybind11::detail::override_caster_t<bool> caster;
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
}
else return pybind11::detail::cast_safe<bool>(std::move(o));
}
return COccupancyGridMap2D::nn_single_search(a0, a1, a2);
return COccupancyGridMap2D::nn_supports_indices();
}
bool canComputeObservationLikelihood(const class mrpt::obs::CObservation & a0) const override {
pybind11::gil_scoped_acquire gil;
Expand Down Expand Up @@ -609,8 +596,7 @@ void bind_mrpt_maps_COccupancyGridMap2D(std::function< pybind11::module &(std::s
cl.def("compute3DMatchingRatio", (float (mrpt::maps::COccupancyGridMap2D::*)(const class mrpt::maps::CMetricMap *, const class mrpt::poses::CPose3D &, const struct mrpt::maps::TMatchingRatioParams &) const) &mrpt::maps::COccupancyGridMap2D::compute3DMatchingRatio, "See docs in base class: in this class this always returns 0 \n\nC++: mrpt::maps::COccupancyGridMap2D::compute3DMatchingRatio(const class mrpt::maps::CMetricMap *, const class mrpt::poses::CPose3D &, const struct mrpt::maps::TMatchingRatioParams &) const --> float", pybind11::arg("otherMap"), pybind11::arg("otherMapPose"), pybind11::arg("params"));
cl.def("saveMetricMapRepresentationToFile", (void (mrpt::maps::COccupancyGridMap2D::*)(const std::string &) const) &mrpt::maps::COccupancyGridMap2D::saveMetricMapRepresentationToFile, "This virtual method saves the map to a file \"filNamePrefix\"+<\n some_file_extension >, as an image or in any other applicable way (Notice\n that other methods to save the map may be implemented in classes\n implementing this virtual interface). \n\nC++: mrpt::maps::COccupancyGridMap2D::saveMetricMapRepresentationToFile(const std::string &) const --> void", pybind11::arg("filNamePrefix"));
cl.def("asString", (std::string (mrpt::maps::COccupancyGridMap2D::*)() const) &mrpt::maps::COccupancyGridMap2D::asString, "Returns a short description of the map. \n\nC++: mrpt::maps::COccupancyGridMap2D::asString() const --> std::string");
cl.def("nn_single_search", (bool (mrpt::maps::COccupancyGridMap2D::*)(const struct mrpt::math::TPoint3D_<float> &, struct mrpt::math::TPoint3D_<float> &, float &) const) &mrpt::maps::COccupancyGridMap2D::nn_single_search, " @{ \n\nC++: mrpt::maps::COccupancyGridMap2D::nn_single_search(const struct mrpt::math::TPoint3D_<float> &, struct mrpt::math::TPoint3D_<float> &, float &) const --> bool", pybind11::arg("query"), pybind11::arg("result"), pybind11::arg("out_dist_sqr"));
cl.def("nn_single_search", (bool (mrpt::maps::COccupancyGridMap2D::*)(const struct mrpt::math::TPoint2D_<float> &, struct mrpt::math::TPoint2D_<float> &, float &) const) &mrpt::maps::COccupancyGridMap2D::nn_single_search, "C++: mrpt::maps::COccupancyGridMap2D::nn_single_search(const struct mrpt::math::TPoint2D_<float> &, struct mrpt::math::TPoint2D_<float> &, float &) const --> bool", pybind11::arg("query"), pybind11::arg("result"), pybind11::arg("out_dist_sqr"));
cl.def("nn_supports_indices", (bool (mrpt::maps::COccupancyGridMap2D::*)() const) &mrpt::maps::COccupancyGridMap2D::nn_supports_indices, " @{ \n\nC++: mrpt::maps::COccupancyGridMap2D::nn_supports_indices() const --> bool");
cl.def("assign", (class mrpt::maps::COccupancyGridMap2D & (mrpt::maps::COccupancyGridMap2D::*)(const class mrpt::maps::COccupancyGridMap2D &)) &mrpt::maps::COccupancyGridMap2D::operator=, "C++: mrpt::maps::COccupancyGridMap2D::operator=(const class mrpt::maps::COccupancyGridMap2D &) --> class mrpt::maps::COccupancyGridMap2D &", pybind11::return_value_policy::automatic, pybind11::arg(""));

{ // mrpt::maps::COccupancyGridMap2D::TUpdateCellsInfoChangeOnly file:mrpt/maps/COccupancyGridMap2D.h line:215
Expand Down
24 changes: 5 additions & 19 deletions python/src/mrpt/maps/COccupancyGridMap3D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,31 +276,18 @@ struct PyCallBack_mrpt_maps_COccupancyGridMap3D : public mrpt::maps::COccupancyG
}
return COccupancyGridMap3D::asString();
}
bool nn_single_search(const struct mrpt::math::TPoint3D_<float> & a0, struct mrpt::math::TPoint3D_<float> & a1, float & a2) const override {
bool nn_supports_indices() const override {
pybind11::gil_scoped_acquire gil;
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::COccupancyGridMap3D *>(this), "nn_single_search");
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::COccupancyGridMap3D *>(this), "nn_supports_indices");
if (overload) {
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0, a1, a2);
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
static pybind11::detail::override_caster_t<bool> caster;
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
}
else return pybind11::detail::cast_safe<bool>(std::move(o));
}
return COccupancyGridMap3D::nn_single_search(a0, a1, a2);
}
bool nn_single_search(const struct mrpt::math::TPoint2D_<float> & a0, struct mrpt::math::TPoint2D_<float> & a1, float & a2) const override {
pybind11::gil_scoped_acquire gil;
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::COccupancyGridMap3D *>(this), "nn_single_search");
if (overload) {
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0, a1, a2);
auto o = overload.operator()<pybind11::return_value_policy::reference>();
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
static pybind11::detail::override_caster_t<bool> caster;
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
}
else return pybind11::detail::cast_safe<bool>(std::move(o));
}
return COccupancyGridMap3D::nn_single_search(a0, a1, a2);
return COccupancyGridMap3D::nn_supports_indices();
}
bool canComputeObservationLikelihood(const class mrpt::obs::CObservation & a0) const override {
pybind11::gil_scoped_acquire gil;
Expand Down Expand Up @@ -513,8 +500,7 @@ void bind_mrpt_maps_COccupancyGridMap3D(std::function< pybind11::module &(std::s
cl.def("compute3DMatchingRatio", (float (mrpt::maps::COccupancyGridMap3D::*)(const class mrpt::maps::CMetricMap *, const class mrpt::poses::CPose3D &, const struct mrpt::maps::TMatchingRatioParams &) const) &mrpt::maps::COccupancyGridMap3D::compute3DMatchingRatio, "See docs in base class: in this class this always returns 0 \n\nC++: mrpt::maps::COccupancyGridMap3D::compute3DMatchingRatio(const class mrpt::maps::CMetricMap *, const class mrpt::poses::CPose3D &, const struct mrpt::maps::TMatchingRatioParams &) const --> float", pybind11::arg("otherMap"), pybind11::arg("otherMapPose"), pybind11::arg("params"));
cl.def("saveMetricMapRepresentationToFile", (void (mrpt::maps::COccupancyGridMap3D::*)(const std::string &) const) &mrpt::maps::COccupancyGridMap3D::saveMetricMapRepresentationToFile, "C++: mrpt::maps::COccupancyGridMap3D::saveMetricMapRepresentationToFile(const std::string &) const --> void", pybind11::arg("f"));
cl.def("asString", (std::string (mrpt::maps::COccupancyGridMap3D::*)() const) &mrpt::maps::COccupancyGridMap3D::asString, "Returns a short description of the map. \n\nC++: mrpt::maps::COccupancyGridMap3D::asString() const --> std::string");
cl.def("nn_single_search", (bool (mrpt::maps::COccupancyGridMap3D::*)(const struct mrpt::math::TPoint3D_<float> &, struct mrpt::math::TPoint3D_<float> &, float &) const) &mrpt::maps::COccupancyGridMap3D::nn_single_search, " @{ \n\nC++: mrpt::maps::COccupancyGridMap3D::nn_single_search(const struct mrpt::math::TPoint3D_<float> &, struct mrpt::math::TPoint3D_<float> &, float &) const --> bool", pybind11::arg("query"), pybind11::arg("result"), pybind11::arg("out_dist_sqr"));
cl.def("nn_single_search", (bool (mrpt::maps::COccupancyGridMap3D::*)(const struct mrpt::math::TPoint2D_<float> &, struct mrpt::math::TPoint2D_<float> &, float &) const) &mrpt::maps::COccupancyGridMap3D::nn_single_search, "C++: mrpt::maps::COccupancyGridMap3D::nn_single_search(const struct mrpt::math::TPoint2D_<float> &, struct mrpt::math::TPoint2D_<float> &, float &) const --> bool", pybind11::arg("query"), pybind11::arg("result"), pybind11::arg("out_dist_sqr"));
cl.def("nn_supports_indices", (bool (mrpt::maps::COccupancyGridMap3D::*)() const) &mrpt::maps::COccupancyGridMap3D::nn_supports_indices, " @{ \n\nC++: mrpt::maps::COccupancyGridMap3D::nn_supports_indices() const --> bool");
cl.def("assign", (class mrpt::maps::COccupancyGridMap3D & (mrpt::maps::COccupancyGridMap3D::*)(const class mrpt::maps::COccupancyGridMap3D &)) &mrpt::maps::COccupancyGridMap3D::operator=, "C++: mrpt::maps::COccupancyGridMap3D::operator=(const class mrpt::maps::COccupancyGridMap3D &) --> class mrpt::maps::COccupancyGridMap3D &", pybind11::return_value_policy::automatic, pybind11::arg(""));

{ // mrpt::maps::COccupancyGridMap3D::TInsertionOptions file:mrpt/maps/COccupancyGridMap3D.h line:221
Expand Down
21 changes: 4 additions & 17 deletions python/src/mrpt/maps/COctoMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -991,31 +991,18 @@ struct PyCallBack_mrpt_maps_CSimplePointsMap : public mrpt::maps::CSimplePointsM
}
return CPointsMap::asString();
}
bool nn_single_search(const struct mrpt::math::TPoint3D_<float> & a0, struct mrpt::math::TPoint3D_<float> & a1, float & a2) const override {
bool nn_supports_indices() const override {
pybind11::gil_scoped_acquire gil;
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::CSimplePointsMap *>(this), "nn_single_search");
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::CSimplePointsMap *>(this), "nn_supports_indices");
if (overload) {
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0, a1, a2);
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
static pybind11::detail::override_caster_t<bool> caster;
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
}
else return pybind11::detail::cast_safe<bool>(std::move(o));
}
return CPointsMap::nn_single_search(a0, a1, a2);
}
bool nn_single_search(const struct mrpt::math::TPoint2D_<float> & a0, struct mrpt::math::TPoint2D_<float> & a1, float & a2) const override {
pybind11::gil_scoped_acquire gil;
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::CSimplePointsMap *>(this), "nn_single_search");
if (overload) {
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0, a1, a2);
auto o = overload.operator()<pybind11::return_value_policy::reference>();
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
static pybind11::detail::override_caster_t<bool> caster;
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
}
else return pybind11::detail::cast_safe<bool>(std::move(o));
}
return CPointsMap::nn_single_search(a0, a1, a2);
return CPointsMap::nn_supports_indices();
}
void PLY_import_set_face_count(size_t a0) override {
pybind11::gil_scoped_acquire gil;
Expand Down
21 changes: 4 additions & 17 deletions python/src/mrpt/maps/CPointCloudFilterByDistance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,31 +555,18 @@ struct PyCallBack_mrpt_maps_CPointsMapXYZI : public mrpt::maps::CPointsMapXYZI {
}
return CPointsMap::asString();
}
bool nn_single_search(const struct mrpt::math::TPoint3D_<float> & a0, struct mrpt::math::TPoint3D_<float> & a1, float & a2) const override {
bool nn_supports_indices() const override {
pybind11::gil_scoped_acquire gil;
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::CPointsMapXYZI *>(this), "nn_single_search");
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::CPointsMapXYZI *>(this), "nn_supports_indices");
if (overload) {
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0, a1, a2);
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
static pybind11::detail::override_caster_t<bool> caster;
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
}
else return pybind11::detail::cast_safe<bool>(std::move(o));
}
return CPointsMap::nn_single_search(a0, a1, a2);
}
bool nn_single_search(const struct mrpt::math::TPoint2D_<float> & a0, struct mrpt::math::TPoint2D_<float> & a1, float & a2) const override {
pybind11::gil_scoped_acquire gil;
pybind11::function overload = pybind11::get_overload(static_cast<const mrpt::maps::CPointsMapXYZI *>(this), "nn_single_search");
if (overload) {
auto o = overload.operator()<pybind11::return_value_policy::reference>(a0, a1, a2);
auto o = overload.operator()<pybind11::return_value_policy::reference>();
if (pybind11::detail::cast_is_temporary_value_reference<bool>::value) {
static pybind11::detail::override_caster_t<bool> caster;
return pybind11::detail::cast_ref<bool>(std::move(o), caster);
}
else return pybind11::detail::cast_safe<bool>(std::move(o));
}
return CPointsMap::nn_single_search(a0, a1, a2);
return CPointsMap::nn_supports_indices();
}
void PLY_import_set_face_count(size_t a0) override {
pybind11::gil_scoped_acquire gil;
Expand Down
3 changes: 1 addition & 2 deletions python/src/mrpt/maps/CPointsMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,7 @@ void bind_mrpt_maps_CPointsMap(std::function< pybind11::module &(std::string con
cl.def("kdtree_distance", (float (mrpt::maps::CPointsMap::*)(const float *, size_t, size_t) const) &mrpt::maps::CPointsMap::kdtree_distance, "Returns the distance between the vector \"p1[0:size-1]\" and the data\n point with index \"idx_p2\" stored in the class:\n\nC++: mrpt::maps::CPointsMap::kdtree_distance(const float *, size_t, size_t) const --> float", pybind11::arg("p1"), pybind11::arg("idx_p2"), pybind11::arg("size"));
cl.def("mark_as_modified", (void (mrpt::maps::CPointsMap::*)() const) &mrpt::maps::CPointsMap::mark_as_modified, "Users normally don't need to call this. Called by this class or children\n classes, set m_largestDistanceFromOriginIsUpdated=false, invalidates the\n kd-tree cache, and such. \n\nC++: mrpt::maps::CPointsMap::mark_as_modified() const --> void");
cl.def("asString", (std::string (mrpt::maps::CPointsMap::*)() const) &mrpt::maps::CPointsMap::asString, "Returns a short description of the map. \n\nC++: mrpt::maps::CPointsMap::asString() const --> std::string");
cl.def("nn_single_search", (bool (mrpt::maps::CPointsMap::*)(const struct mrpt::math::TPoint3D_<float> &, struct mrpt::math::TPoint3D_<float> &, float &) const) &mrpt::maps::CPointsMap::nn_single_search, " @{ \n\nC++: mrpt::maps::CPointsMap::nn_single_search(const struct mrpt::math::TPoint3D_<float> &, struct mrpt::math::TPoint3D_<float> &, float &) const --> bool", pybind11::arg("query"), pybind11::arg("result"), pybind11::arg("out_dist_sqr"));
cl.def("nn_single_search", (bool (mrpt::maps::CPointsMap::*)(const struct mrpt::math::TPoint2D_<float> &, struct mrpt::math::TPoint2D_<float> &, float &) const) &mrpt::maps::CPointsMap::nn_single_search, "C++: mrpt::maps::CPointsMap::nn_single_search(const struct mrpt::math::TPoint2D_<float> &, struct mrpt::math::TPoint2D_<float> &, float &) const --> bool", pybind11::arg("query"), pybind11::arg("result"), pybind11::arg("out_dist_sqr"));
cl.def("nn_supports_indices", (bool (mrpt::maps::CPointsMap::*)() const) &mrpt::maps::CPointsMap::nn_supports_indices, " @{ \n\nC++: mrpt::maps::CPointsMap::nn_supports_indices() const --> bool");

{ // mrpt::maps::CPointsMap::TInsertionOptions file:mrpt/maps/CPointsMap.h line:228
auto & enclosing_class = cl;
Expand Down
2 changes: 1 addition & 1 deletion python/src/mrpt/maps/CPointsMap_1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

void bind_mrpt_maps_CPointsMap_1(std::function< pybind11::module &(std::string const &namespace_) > &M)
{
{ // mrpt::opengl::PointCloudAdapter file:mrpt/maps/CPointsMap.h line:1239
{ // mrpt::opengl::PointCloudAdapter file:mrpt/maps/CPointsMap.h line:1246
pybind11::class_<mrpt::opengl::PointCloudAdapter<mrpt::maps::CPointsMap>, std::shared_ptr<mrpt::opengl::PointCloudAdapter<mrpt::maps::CPointsMap>>> cl(M("mrpt::opengl"), "PointCloudAdapter_mrpt_maps_CPointsMap_t", "Specialization mrpt::opengl::PointCloudAdapter<mrpt::maps::CPointsMap>\n \n");
cl.def( pybind11::init<const class mrpt::maps::CPointsMap &>(), pybind11::arg("obj") );

Expand Down
Loading

0 comments on commit ec2e05e

Please sign in to comment.