namespace mola_metric_maps_py

Overview

namespace mola_metric_maps_py {

// typedefs

typedef py::array_t<float, py::array::c_style|py::array::forcecast> FloatArray;

// global functions

template <class Opts>
py::class_<Opts, mrpt::config::CLoadableOptions, std::shared_ptr<Opts>> bind_options(
    py::handle scope,
    const char* name,
    const std::string& qualName,
    const char* doc
    );

template <class T>
std::shared_ptr<T> deep_copy(const T& self);

template <class T, class PyClass>
void def_copy_and_pickle(PyClass& c);

template <class T, class PyClass>
void def_insert_point_cloud(PyClass& c);

template <class T, class PyClass>
void def_nn_search(PyClass& c);

template <class T, class PyClass>
void def_pt2pl_search(PyClass& c);

template <class T, class PyClass>
void def_options_capable(PyClass& c);

void init_voxel_maps(py::module_& m);
void init_keyframe_map(py::module_& m);
void init_incremental_point_cloud(py::module_& m);
void init_occgrid(py::module_& m);
mrpt::math::TPoint3Df to_point3df(const py::object& obj);
mrpt::poses::CPose3D to_pose3d(const py::object& obj);
std::optional<mrpt::poses::CPose3D> to_optional_pose3d(const py::object& obj);
py::array_t<float> points_to_numpy(const std::vector<mrpt::math::TPoint3Df>& pts);
FloatArray to_points_array(const py::object& obj);
mrpt::maps::CPointsMap::Ptr to_point_cloud(const py::object& obj);

bool insert_point_cloud(
    mrpt::maps::CMetricMap& map,
    const py::object& points,
    const py::object& robotPose
    );

py::bytes to_bytes(const mrpt::serialization::CSerializable& o);
void from_bytes(mrpt::serialization::CSerializable& o, const py::bytes& data);
std::string options_repr(const std::string& name, const mrpt::config::CLoadableOptions& o);

py::dict nn_single_search_batch(
    const mrpt::maps::NearestNeighborsCapable& nn,
    const py::object& queries
    );

} // namespace mola_metric_maps_py

Global Functions

template <class Opts>
py::class_<Opts, mrpt::config::CLoadableOptions, std::shared_ptr<Opts>> bind_options(
    py::handle scope,
    const char* name,
    const std::string& qualName,
    const char* doc
    )

Declares a CLoadableOptions-derived struct, nested in scope, with a default constructor, repr and str. Fields are added by the caller.

template <class T>
std::shared_ptr<T> deep_copy(const T& self)

A deep copy of a map, through serialization if it is not copyable

template <class T, class PyClass>
void def_copy_and_pickle(PyClass& c)

Pickling (through MRPT serialization), copy and deepcopy

template <class T, class PyClass>
void def_insert_point_cloud(PyClass& c)

insertPointCloud() of all CMetricMap classes

template <class T, class PyClass>
void def_nn_search(PyClass& c)

nn_*() queries of mrpt::maps::NearestNeighborsCapable, plus a NumPy batch query. The results have the same format as for mrpt.maps.CPointsMap.

template <class T, class PyClass>
void def_pt2pl_search(PyClass& c)

nn_search_pt2pl() of mp2p_icp::NearestPlaneCapable

template <class T, class PyClass>
void def_options_capable(PyClass& c)

creationOptions (as a copy), trySetCreationOptions() and optionsByName() of the classes implementing mola::OptionsCapable

mrpt::math::TPoint3Df to_point3df(const py::object& obj)

Converts an mrpt.math.TPoint3D, TPoint3Df, or a sequence of 3 numbers

mrpt::poses::CPose3D to_pose3d(const py::object& obj)

Converts None (identity), mrpt.poses.CPose3D, mrpt.math.TPose3D, a 4x4 homogeneous matrix, or a sequence [x, y, z, yaw, pitch, roll] (meters, radians).

std::optional<mrpt::poses::CPose3D> to_optional_pose3d(const py::object& obj)

Like to_pose3d(), but None becomes std::nullopt

py::array_t<float> points_to_numpy(const std::vector<mrpt::math::TPoint3Df>& pts)

An (N,3) float32 array from a list of points

FloatArray to_points_array(const py::object& obj)

An (N,3) float32 array, validating the shape of the input

mrpt::maps::CPointsMap::Ptr to_point_cloud(const py::object& obj)

A new point cloud from: an (N,3) array, a dict {field: 1-D array} (as mp2p_icp.layer_from_numpy()), or an mrpt.maps.CPointsMap (copied).

bool insert_point_cloud(
    mrpt::maps::CMetricMap& map,
    const py::object& points,
    const py::object& robotPose
    )

Inserts a point cloud observation into a map, as insertObservation() with an mrpt::obs::CObservationPointCloud. Releases the GIL.

py::bytes to_bytes(const mrpt::serialization::CSerializable& o)

Serializes an object (class name included) into Python bytes

void from_bytes(mrpt::serialization::CSerializable& o, const py::bytes& data)

The reverse of to_bytes(), into an existing object of the same class

std::string options_repr(
    const std::string& name,
    const mrpt::config::CLoadableOptions& o
    )

“Name(key=value, …)” from the text dump of a set of options

py::dict nn_single_search_batch(
    const mrpt::maps::NearestNeighborsCapable& nn,
    const py::object& queries
    )

Closest point to each row of an (N,3) array, as a dict of NumPy arrays