|
NavMap
|
Namespaces | |
| namespace | detail |
Classes | |
| struct | AABB |
| Axis-aligned bounding box. More... | |
| struct | BVHNode |
| Node in a per-surface bounding volume hierarchy (BVH). More... | |
| struct | Colors |
| Optional per-vertex colors (RGBA, 8-bit per channel). More... | |
| struct | CombineOptions |
| Options of combine_layer(). More... | |
| struct | DescriptorParams |
| Which descriptors to compute, and over which neighbourhoods. More... | |
| class | DistanceField |
| Distance from each NavCel to the nearest seed (seed NavCels and, optionally, the open edges of the mesh), kept up to date incrementally. More... | |
| struct | LayerMeta |
| Metadata associated to a layer (optional). More... | |
| class | LayerRegistry |
| Registry of named layers (per-NavCel). More... | |
| struct | LayerView |
Typed layer view storing one T value per NavCel. More... | |
| struct | LayerViewBase |
| Non-templated base for runtime layer handling. More... | |
| struct | NavCel |
| Navigation cell (triangle) with geometry and adjacency. More... | |
| class | NavMap |
| class | OccupancyLayer |
| Log-odds occupancy over an int16 layer of a NavMap. More... | |
| struct | OccupancyParams |
| Probabilities of the update rule and of the classification (OctoMap defaults). More... | |
| struct | Positions |
| Structure-of-arrays for storing 3D vertex positions. More... | |
| struct | Ray |
| Simple ray (origin + direction). More... | |
| struct | RayHit |
| Result of a raycast against the NavMap. More... | |
| struct | SimplifyParams |
| Parameters of simplify(). More... | |
| struct | SimplifyStats |
| Sizes before and after simplify(). More... | |
| struct | Surface |
| A connected set of NavCels in a common reference frame. More... | |
| struct | SurfaceLink |
| Connection between two NavCels that do not share an edge (stairs, an elevator, a door between surfaces that are not welded...). More... | |
| class | TraversalScratch |
| Reusable traversal buffers. Not thread-safe: one per thread. More... | |
Typedefs | |
| using | NavCelId = uint32_t |
| Index of a triangle (NavCel) within the global mesh. | |
| using | PointId = uint32_t |
| Index into the per-vertex position arrays (SoA). | |
| using | Vec3 = Eigen::Vector3f |
| 3D vector alias used across NavMap geometry. | |
Enumerations | |
| enum class | AreaShape { CIRCULAR , RECTANGULAR } |
| Shape selector for area-writing APIs. More... | |
| enum class | CombineOp : uint8_t { OVERWRITE , TRUE_OVERWRITE , MAX , MAX_KEEP_UNKNOWN , MIN , ADD } |
| How a source value s is combined into the destination value d (as costmap_2d's update modes). More... | |
| enum class | LayerType : uint8_t { U8 = 0 , F32 = 1 , F64 = 2 , I16 = 3 } |
| Runtime type tag for a layer's scalar storage. More... | |
| enum class | LinkType : uint8_t { GENERIC = 0 , RAMP = 1 , STAIRS = 2 , ELEVATOR = 3 , DOOR = 4 } |
| Main container for navigable surfaces, geometry, and layers. More... | |
| enum class | Metric { EUCLIDEAN , GEODESIC } |
| Distance from a centre used to grow a region. More... | |
| enum class | OccupancyState : uint8_t { UNKNOWN = 0 , FREE = 1 , OCCUPIED = 2 } |
| Three-state classification of a NavCel. More... | |
Functions | |
| Vec3 | closest_point_on_triangle (const Vec3 &p, const Vec3 &a, const Vec3 &b, const Vec3 &c) |
| Compute the closest point on triangle ABC to point P. | |
| std::ptrdiff_t | combine_layer (NavMap &nm, const std::string &dst, const std::string &src, CombineOp op, const CombineOptions &options={}) |
Combine layer src into layer dst cell by cell with op. | |
| void | compute_descriptors (NavMap &nm, const DescriptorParams ¶ms={}) |
Compute the selected descriptors as F32 layers of nm (created or overwritten). | |
| template<class F> | |
| std::size_t | for_each_by_distance (const NavMap &nm, NavCelId seed, const Eigen::Vector3f ¢er, float max_distance, F &&f, TraversalScratch *scratch=nullptr) |
Visits NavCels by geodesic distance from center, up to max_distance: a spiral over the surface (nearest free cell, local search...). | |
| template<class F> | |
| std::size_t | for_each_in_aabb (const NavMap &nm, const AABB &box, F &&f, TraversalScratch *scratch=nullptr) |
Visits the NavCels whose bounding box overlaps box, on every surface (via the BVH). | |
| template<class F> | |
| std::size_t | for_each_in_disc (const NavMap &nm, const Eigen::Vector3f ¢er, float radius, F &&f, Metric metric=Metric::EUCLIDEAN, TraversalScratch *scratch=nullptr) |
As above, locating the seed under center; visits nothing if the centre is off the map. | |
| template<class F> | |
| std::size_t | for_each_in_disc (const NavMap &nm, NavCelId seed, const Eigen::Vector3f ¢er, float radius, F &&f, Metric metric=Metric::EUCLIDEAN, TraversalScratch *scratch=nullptr) |
Visits the NavCels within radius of center, connected to seed (which should contain the centre). | |
| template<class F> | |
| std::size_t | for_each_in_polygon (const NavMap &nm, const Eigen::Vector3f &on_surface, const std::vector< Eigen::Vector2f > &poly, F &&f, TraversalScratch *scratch=nullptr) |
As above, locating the seed under on_surface (a point of the polygon's level). | |
| template<class F> | |
| std::size_t | for_each_in_polygon (const NavMap &nm, NavCelId seed, const std::vector< Eigen::Vector2f > &poly, F &&f, TraversalScratch *scratch=nullptr) |
Visits the NavCels whose centroid lies inside the XY polygon poly, connected to seed through NavCels inside it (so only the seed's level). | |
| template<class F> | |
| std::size_t | for_each_in_ring (const NavMap &nm, NavCelId seed, const Eigen::Vector3f ¢er, float r_in, float r_out, F &&f, Metric metric=Metric::EUCLIDEAN, TraversalScratch *scratch=nullptr) |
Visits the NavCels at distance in [r_in, r_out] from center, connected to seed through NavCels within r_out (the inner part is crossed, not visited). | |
| template<class F> | |
| bool | for_each_on_segment (const NavMap &nm, const Eigen::Vector3f &a, const Eigen::Vector3f &b, F &&f) |
As above, locating the seed under a; false if a is off the map. | |
| template<class F> | |
| bool | for_each_on_segment (const NavMap &nm, NavCelId seed, const Eigen::Vector3f &a, const Eigen::Vector3f &b, F &&f) |
Walks the surface along segment a -> b (in XY), from seed (the NavCel under a), visiting each NavCel crossed with the segment parameters where it enters and leaves. | |
| template<typename T> | |
| constexpr LayerType | layer_type_tag () |
| Helper to map C++ scalar type to navmap::LayerType tag. | |
| template<> | |
| constexpr LayerType | layer_type_tag< double > () |
| template<> | |
| constexpr LayerType | layer_type_tag< float > () |
| template<> | |
| constexpr LayerType | layer_type_tag< int16_t > () |
| template<> | |
| constexpr LayerType | layer_type_tag< uint8_t > () |
| float | point_segment_distance (const Vec3 &p, const Vec3 &a, const Vec3 &b) |
Distance from point p to segment [a, b] (a point if a == b). | |
| float | point_triangle_squared_distance (const Vec3 &p, const Vec3 &a, const Vec3 &b, const Vec3 &c, Vec3 *closest=nullptr) |
| Squared distance between point and triangle, with optional closest pt. | |
| bool | ray_triangle_intersect (const Vec3 &orig, const Vec3 &dir, const Vec3 &v0, const Vec3 &v1, const Vec3 &v2, float &t, float &u, float &v) |
| Möller–Trumbore ray–triangle intersection. | |
| SimplifyStats | simplify (NavMap &nm, const SimplifyParams ¶ms={}) |
Simplify nm in place by half-edge collapses, cheapest first. | |
| float | triangle_area (const Vec3 &a, const Vec3 &b, const Vec3 &c) |
| Compute the area of a triangle ABC. | |
| Vec3 | triangle_normal (const Vec3 &a, const Vec3 &b, const Vec3 &c) |
| Compute a unit normal of triangle ABC. | |
Variables | |
| constexpr std::uint8_t | FREE_SPACE = 0 |
| Known free. | |
| constexpr std::uint8_t | INSCRIBED_INFLATED_OBSTACLE = 253 |
| The robot would touch an obstacle. | |
| constexpr std::uint8_t | LETHAL_OBSTACLE = 254 |
| Obstacle. | |
| constexpr std::uint8_t | MAX_NON_OBSTACLE = 252 |
| Highest traversable cost. | |
| constexpr std::uint8_t | NO_INFORMATION = 255 |
| Unknown, not observed. | |
| using PointId = uint32_t |
Index into the per-vertex position arrays (SoA).
|
strong |
|
strong |
How a source value s is combined into the destination value d (as costmap_2d's update modes).
|
strong |
|
strong |
Main container for navigable surfaces, geometry, and layers.
A navmap::NavMap aggregates vertex positions, a list of navmap::NavCel triangles (global indexing), one or more navmap::Surface partitions, and a navmap::LayerRegistry with arbitrary per-NavCel scalar attributes.
Typical workflow
| Enumerator | |
|---|---|
| GENERIC | |
| RAMP | |
| STAIRS | |
| ELEVATOR | |
| DOOR | |
|
strong |
Distance from a centre used to grow a region.
| Enumerator | |
|---|---|
| EUCLIDEAN | 3D distance from the centre to each NavCel centroid |
| GEODESIC | Along the surface: straight lines on it, bent only around borders. |
|
strong |
Three-state classification of a NavCel.
| Enumerator | |
|---|---|
| UNKNOWN | |
| FREE | |
| OCCUPIED | |
Compute the closest point on triangle ABC to point P.
Robustly handles all Voronoi regions (vertices/edges/interior). Degenerate triangles fall back to nearest vertex.
| p | Query point. |
| a | Triangle vertex A. |
| b | Triangle vertex B. |
| c | Triangle vertex C. |
p. | std::ptrdiff_t combine_layer | ( | NavMap & | nm, |
| const std::string & | dst, | ||
| const std::string & | src, | ||
| CombineOp | op, | ||
| const CombineOptions & | options = {} ) |
Combine layer src into layer dst cell by cell with op.
Both layers must exist with one value per NavCel; their types may differ (values convert as in NavMap::layer_get: integers are rounded and clamped to their range). Which value is unknown is each layer's own LayerMeta::unknown (NaN allowed). Writing an unknown value into dst writes the unknown of dst; if dst has none, nothing is written.
Cells whose value changes are recorded with mark_changed() in dst. The provenance layer, if requested, gets source_id wherever the result is the source's value (MAX/MIN: it won or tied; ADD: it added something), even if the value was already the same.
dst value changed, or -1 if a layer is missing, sizes differ or dst == src. | void compute_descriptors | ( | NavMap & | nm, |
| const DescriptorParams & | params = {} ) |
Compute the selected descriptors as F32 layers of nm (created or overwritten).
Discs grow over the mesh adjacency from each NavCel (navmap/Iterators.hpp), so a descriptor never mixes floors. "clearance" casts a ray up from each centroid against every surface of the map: it is the room up to the next surface the map holds (the floor above), not to a ceiling that is not in the map; +inf when there is none within clearance_max.
| std::size_t for_each_by_distance | ( | const NavMap & | nm, |
| NavCelId | seed, | ||
| const Eigen::Vector3f & | center, | ||
| float | max_distance, | ||
| F && | f, | ||
| TraversalScratch * | scratch = nullptr ) |
Visits NavCels by geodesic distance from center, up to max_distance: a spiral over the surface (nearest free cell, local search...).
The seed comes first, always. The order is non-decreasing up to the distance between neighbour centroids.
| f | Visitor f(NavCelId, float distance); returning false stops. |
| std::size_t for_each_in_aabb | ( | const NavMap & | nm, |
| const AABB & | box, | ||
| F && | f, | ||
| TraversalScratch * | scratch = nullptr ) |
Visits the NavCels whose bounding box overlaps box, on every surface (via the BVH).
| f | Visitor f(NavCelId); returning false stops. |
| std::size_t for_each_in_disc | ( | const NavMap & | nm, |
| const Eigen::Vector3f & | center, | ||
| float | radius, | ||
| F && | f, | ||
| Metric | metric = Metric::EUCLIDEAN, | ||
| TraversalScratch * | scratch = nullptr ) |
As above, locating the seed under center; visits nothing if the centre is off the map.
| std::size_t for_each_in_disc | ( | const NavMap & | nm, |
| NavCelId | seed, | ||
| const Eigen::Vector3f & | center, | ||
| float | radius, | ||
| F && | f, | ||
| Metric | metric = Metric::EUCLIDEAN, | ||
| TraversalScratch * | scratch = nullptr ) |
Visits the NavCels within radius of center, connected to seed (which should contain the centre).
The seed is always visited.
| f | Visitor f(NavCelId); returning false stops. |
| std::size_t for_each_in_polygon | ( | const NavMap & | nm, |
| const Eigen::Vector3f & | on_surface, | ||
| const std::vector< Eigen::Vector2f > & | poly, | ||
| F && | f, | ||
| TraversalScratch * | scratch = nullptr ) |
As above, locating the seed under on_surface (a point of the polygon's level).
| std::size_t for_each_in_polygon | ( | const NavMap & | nm, |
| NavCelId | seed, | ||
| const std::vector< Eigen::Vector2f > & | poly, | ||
| F && | f, | ||
| TraversalScratch * | scratch = nullptr ) |
Visits the NavCels whose centroid lies inside the XY polygon poly, connected to seed through NavCels inside it (so only the seed's level).
Even-odd rule.
| f | Visitor f(NavCelId); returning false stops. |
| std::size_t for_each_in_ring | ( | const NavMap & | nm, |
| NavCelId | seed, | ||
| const Eigen::Vector3f & | center, | ||
| float | r_in, | ||
| float | r_out, | ||
| F && | f, | ||
| Metric | metric = Metric::EUCLIDEAN, | ||
| TraversalScratch * | scratch = nullptr ) |
Visits the NavCels at distance in [r_in, r_out] from center, connected to seed through NavCels within r_out (the inner part is crossed, not visited).
| f | Visitor f(NavCelId); returning false stops. |
| bool for_each_on_segment | ( | const NavMap & | nm, |
| const Eigen::Vector3f & | a, | ||
| const Eigen::Vector3f & | b, | ||
| F && | f ) |
As above, locating the seed under a; false if a is off the map.
| bool for_each_on_segment | ( | const NavMap & | nm, |
| NavCelId | seed, | ||
| const Eigen::Vector3f & | a, | ||
| const Eigen::Vector3f & | b, | ||
| F && | f ) |
Walks the surface along segment a -> b (in XY), from seed (the NavCel under a), visiting each NavCel crossed with the segment parameters where it enters and leaves.
The walk follows the mesh adjacency, so it stays on the seed's level, also on slopes.
| f | Visitor f(NavCelId, float t_in, float t_out), 0 <= t_in <= t_out <= 1; returning false stops. |
|
constexpr |
Helper to map C++ scalar type to navmap::LayerType tag.
|
constexpr |
|
constexpr |
|
constexpr |
|
constexpr |
Distance from point p to segment [a, b] (a point if a == b).
| float point_triangle_squared_distance | ( | const Vec3 & | p, |
| const Vec3 & | a, | ||
| const Vec3 & | b, | ||
| const Vec3 & | c, | ||
| Vec3 * | closest = nullptr ) |
Squared distance between point and triangle, with optional closest pt.
| p | Query point. |
| a | Triangle vertex A. |
| b | Triangle vertex B. |
| c | Triangle vertex C. |
| closest | Optional output: closest point on triangle to p. |
p to triangle ABC.| bool ray_triangle_intersect | ( | const Vec3 & | orig, |
| const Vec3 & | dir, | ||
| const Vec3 & | v0, | ||
| const Vec3 & | v1, | ||
| const Vec3 & | v2, | ||
| float & | t, | ||
| float & | u, | ||
| float & | v ) |
Möller–Trumbore ray–triangle intersection.
Solves intersection between a ray (orig + t * dir, t > 0) and triangle (v0, v1, v2). Returns true on hit and outputs:
t: parametric distance along the ray (t > 0).u, v: barycentric coordinates (with w = 1 - u - v).| orig | Ray origin. |
| dir | Ray direction (not necessarily unit length). |
| v0 | First triangle vertex. |
| v1 | Second triangle vertex. |
| v2 | Third triangle vertex. |
| t | Output ray parameter on hit (> 0). |
| u | Output barycentric u on hit. |
| v | Output barycentric v on hit. |
kEps is set conservatively for typical mapping units (meters). | SimplifyStats simplify | ( | NavMap & | nm, |
| const SimplifyParams & | params = {} ) |
Simplify nm in place by half-edge collapses, cheapest first.
A vertex is removed only if all its NavCels have the same values in the kept layers and belong to the same surface, so every layer keeps its value at every point of the map: borders between values (an obstacle, unknown space, a different cost) are kept exactly. Open edges keep their shape (within max_error), topology is preserved (no folds, no new holes or bridges), and NavCels that are the end of a link survive. Layers, surfaces, links and vertex colors are carried over; NavCel and vertex ids change. Geometry accelerations are rebuilt.
Compute the area of a triangle ABC.
| a | First vertex (world coordinates). |
| b | Second vertex (world coordinates). |
| c | Third vertex (world coordinates). |
Compute a unit normal of triangle ABC.
The normal is computed as normalized cross product (b - a) x (c - a). If the triangle is degenerate (near-zero area), returns +Z (0, 0, 1).
| a | First vertex (world coordinates). |
| b | Second vertex (world coordinates). |
| c | Third vertex (world coordinates). |
|
constexpr |
Known free.
|
constexpr |
The robot would touch an obstacle.
|
constexpr |
Obstacle.
|
constexpr |
Highest traversable cost.
|
constexpr |
Unknown, not observed.