Python API

pywavemap

A fast, efficient and accurate multi-resolution, multi-sensor 3D occupancy mapping framework.

class pywavemap.Map

Base class for wavemap maps.

add_to_cell_value

Increment the value of the map at a given index.

clear

Erase all cells in the map.

create = <nanobind.nb_func object>
property empty

Whether the map is empty.

get_cell_value

Query the value of the map at a given index.

interpolate

Query the map’s value at a point, using the specified interpolation mode.

load = <nanobind.nb_func object>
property max_index

Index of the maximum corner of the map’s Axis Aligned Bounding Box.

property max_log_odds

Upper threshold for the occupancy values stored in the map, in log-odds.

property memory_usage

The amount of memory used by the map, in bytes.

property min_cell_width

Maximum map resolution, set as width of smallest cell it can represent.

property min_index

Index of the minimum corner of the map’s Axis Aligned Bounding Box.

property min_log_odds

Lower threshold for the occupancy values stored in the map, in log-odds.

prune

Free up memory by pruning nodes that are no longer needed. Note that this pruning operation is lossless and does not alter the estimated occupancy posterior.

prune_smart

Similar to prune(), but avoids de-allocating nodes that were recently updated and will likely be used again in the near future.

set_cell_value
property size

The number of cells or nodes in the map, for fixed or multi-resolution maps, respectively.

store

Store a wavemap map as a .wvmp file.

threshold

Threshold the occupancy values of all cells in the map to stay within the range specified by its min_log_odds and max_log_odds.

property tree_height

Height of the octree used to store the map. Note that this value is only defined for multi-resolution maps.

class pywavemap.HashedWaveletOctree

Bases: Map

A class that stores maps using hashed wavelet octrees.

get_cell_value

Overloaded function.

  1. get_cell_value(self, index: numpy.ndarray[dtype=int32, shape=(3), order='C']) -> float

Query the value of the map at a given index.

  1. get_cell_value(self, node_index: pywavemap._pywavemap_bindings.OctreeIndex) -> float

Query the value of the map at a given octree node index.

get_cell_values

Overloaded function.

  1. get_cell_values(self, index_list: ndarray[dtype=int32, shape=(*, 3), device='cpu']) -> numpy.ndarray[dtype=float32]

Query the map at the given indices, provided as a matrix with one (x, y, z) index per row.

  1. get_cell_values(self, node_index_list: ndarray[dtype=int32, shape=(*, 4), device='cpu']) -> numpy.ndarray[dtype=float32]

Query the map at the given node indices, provided as a matrix with one (height, x, y, z) node index per row.

interpolate

Overloaded function.

  1. interpolate(self, position: numpy.ndarray[dtype=float32, shape=(3), order='C'], mode: pywavemap._pywavemap_bindings.InterpolationMode = InterpolationMode.TRILINEAR) -> float

Query the map’s value at a point, using the specified interpolation mode.

  1. interpolate(self, position_list: ndarray[dtype=float32, shape=(*, 3), device='cpu'], mode: pywavemap._pywavemap_bindings.InterpolationMode = InterpolationMode.TRILINEAR) -> numpy.ndarray[dtype=float32]

Query the map’s value at the given points, using the specified interpolation mode.

class pywavemap.HashedChunkedWaveletOctree

Bases: Map

A class that stores maps using hashed chunked wavelet octrees.

get_cell_value

Overloaded function.

  1. get_cell_value(self, index: numpy.ndarray[dtype=int32, shape=(3), order='C']) -> float

Query the value of the map at a given index.

  1. get_cell_value(self, node_index: pywavemap._pywavemap_bindings.OctreeIndex) -> float

Query the value of the map at a given octree node index.

interpolate

Query the map’s value at a point, using the specified interpolation mode.

class pywavemap.InterpolationMode(value)
NEAREST = 0
TRILINEAR = 1
class pywavemap.OctreeIndex

A class representing indices of octree nodes.

compute_child_index

Compute the index of the node’s n-th child, where n ranges from 0 to 7.

compute_parent_index

Overloaded function.

  1. compute_parent_index(self) -> pywavemap._pywavemap_bindings.OctreeIndex

Compute the index of the node’s direct parent.

  1. compute_parent_index(self, parent_height: int) -> pywavemap._pywavemap_bindings.OctreeIndex

Compute the index of the node’s parent (or ancestor) at parent_height.

property height

The node’s resolution level in the octree. A height of 0 corresponds to the map’s maximum resolution. In a fully allocated tree, all leaf nodes are at height 0. Increasing the height by 1 doubles the node size along each dimension. The root node corresponds to the map’s lowest resolution, and the root node’s height matches the configured tree height.

property position

The node’s XYZ position in the octree’s grid at the resolution level set by height.

class pywavemap.Rotation

A class representing rotations in 3D space.

inverse

Compute the rotation’s inverse.

class pywavemap.Pose

A class representing poses in 3D space.

inverse

Compute the pose’s inverse.

class pywavemap.Pointcloud

A class to store pointclouds.

class pywavemap.PosedPointcloud

A class to store pointclouds with an associated pose.

class pywavemap.Image

A class to store depth images.

class pywavemap.PosedImage

A class to store depth images with an associated pose.

class pywavemap.Pipeline

A class to build pipelines of measurement integrators and map operations.

add_integrator

Create and register a new integrator

add_operation

Create and register a new map operation.

clear

Deregister all the pipeline’s measurement integrators and map operations.

clear_integrators

Deregister all integrators.

clear_operations

Deregister all map operations

has_integrator

Returns true if an integrator with the given name has been registered.

remove_integrator

Deregister the integrator with the given name. Returns true if it existed.

run_integrators

Overloaded function.

  1. run_integrators(self, integrator_names: typing.Sequence[str], posed_pointcloud: pywavemap._pywavemap_bindings.PosedPointcloud) -> bool

Integrate a given pointcloud.

  1. run_integrators(self, integrator_names: typing.Sequence[str], posed_image: pywavemap._pywavemap_bindings.PosedImage) -> bool

Integrate a given depth image.

run_operations

Run the map operations.

run_pipeline

Overloaded function.

  1. run_pipeline(self, integrator_names: typing.Sequence[str], posed_pointcloud: pywavemap._pywavemap_bindings.PosedPointcloud) -> bool

Integrate a given pointcloud, then run the map operations.

  1. run_pipeline(self, integrator_names: typing.Sequence[str], posed_image: pywavemap._pywavemap_bindings.PosedImage) -> bool

Integrate a given depth image, then run the map operations.

convert

Submodule with common conversion functions for wavemap index types.

convert.cell_width_to_height(cell_width: float, min_cell_width: float) int

Compute the minimum node height (resolution level) required to reacha given node width.

param cell_width:

The desired node width.

param min_cell_width:

The grid resolution at height 0 (max map resolution).

convert.height_to_cell_width(min_cell_width: float, height: int) float

Compute the node width at a given height.

param min_cell_width:

The grid resolution at height 0 (max map resolution).

param height:

The desired height (resolution level) of the node index.

convert.point_to_nearest_index(point: numpy.ndarray[dtype=float32, shape=(3), order='C'], cell_width: float) numpy.ndarray[dtype=int32, shape=(3), order='C']

Compute the nearest index to a point on a grid with a given cell width.

convert.point_to_node_index(point: numpy.ndarray[dtype=float32, shape=(3), order='C'], min_cell_width: float, height: int) pywavemap._pywavemap_bindings.OctreeIndex

Compute the index of a node containing a given point.

param min_cell_width:

The grid resolution at height 0 (max map resolution).

param height:

The desired height (resolution level) of the node index.

logging

Submodule to configure wavemap’s logging system.

logging.set_level(level: str = 'info') None

Set pywavemap’s logging level.

logging.enable_prefix(enable: bool = False) None

Whether to prefix log messages with timestamps and line numbers.

param

Submodule for wavemap’s config system.

class pywavemap.param.Value

A class that holds parameter values. Note that one Value can hold a primitive type, a list of Values, or a dictionary of Values. One Value can therefore hold the information needed to initialize an entire config, or even a hierarchy of nested configs.