24template<
typename DataT = se::Data<Field::TSDF, Colour::Off, Semantics::Off>,
25 Res ResT = Res::Single,
31template<Field FldT, Colour ColB, Semantics SemB, Res ResT,
int BlockSize>
43 Eigen::Vector3f dim = Eigen::Vector3f::Constant(10.0f);
51 Eigen::Isometry3f T_MW = Eigen::Isometry3f(Eigen::Translation3f(dim / 2));
62 os << str_utils::volume_to_pretty_str(
c.dim,
"dim") <<
" m\n";
63 os << str_utils::value_to_pretty_str(
c.res,
"res") <<
" m/voxel\n";
64 os << str_utils::eigen_matrix_to_pretty_str(
c.T_MW.matrix(),
"T_MW") <<
"\n";
68 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
80 Map(
const Eigen::Vector3f& dim,
168 template<Safe SafeB = Safe::Off>
180 template<Safe SafeB = Safe::Off, Res ResTDummy = ResT>
181 typename std::enable_if_t<ResTDummy == Res::Multi, DataType>
193 template<Safe SafeB = Safe::Off, Res ResTDummy = ResT>
194 typename std::enable_if_t<ResTDummy == Res::Multi, DataType>
237 template<
typename Val
idF,
typename GetF, Safe SafeB = Safe::Off, Res ResTDummy = ResT>
239 std::optional<std::invoke_result_t<GetF, DataType>>>
246 template<Safe SafeB = Safe::Off,
typename Val
idF,
typename GetF>
247 std::optional<std::invoke_result_t<GetF, DataType>>
257 template<Safe SafeB = Safe::Off>
269 template<Safe SafeB = Safe::Off, Res ResTDummy = ResT>
270 typename std::enable_if_t<ResTDummy == Res::Multi, std::optional<se::field_t>>
281 template<Safe SafeB = Safe::Off, Res ResTDummy = ResT, Colour ColourTDummy = ColB>
283 std::optional<colour_t>>
290 template<Safe SafeB = Safe::Off, Colour ColourTDummy = ColB>
291 typename std::enable_if_t<ColourTDummy == Colour::On, std::optional<colour_t>>
301 template<Safe SafeB = Safe::Off>
322 const Eigen::Vector3f&
point_W)
const;
340 template<se::Field FldTDummy = FldT>
341 typename std::enable_if_t<FldTDummy == se::Field::Occupancy, int>
345 const Eigen::Vector3f&
point_W,
346 const int scale)
const;
364 template<se::Field FldTDummy = FldT>
365 typename std::enable_if_t<FldTDummy == se::Field::Occupancy, int>
369 const Eigen::Vector3f&
point_W,
370 const int scale)
const;
387 template<Res ResTDummy = ResT>
388 typename std::enable_if_t<ResTDummy == Res::Multi, int>
392 const Eigen::Vector3f&
point_W)
const;
410 const Eigen::Affine3f&
T_OW = Eigen::Affine3f::Identity(),
426 const Eigen::Affine3f&
T_OW = Eigen::Affine3f::Identity(),
448 Eigen::Vector3f&
point_W)
const;
482 template<se::Safe SafeB = se::Safe::On>
483 typename std::enable_if_t<SafeB == se::Safe::On, bool>
494 template<se::Safe SafeB>
495 typename std::enable_if_t<SafeB == se::Safe::Off, bool>
506 template<se::Safe SafeB = se::Safe::On>
507 typename std::enable_if_t<SafeB == se::Safe::On, bool>
518 template<se::Safe SafeB>
519 typename std::enable_if_t<SafeB == se::Safe::Off, bool>
530 template<se::Safe SafeB = se::Safe::On>
532 const std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f>>&
points_W,
533 std::vector<Eigen::Vector3i, Eigen::aligned_allocator<Eigen::Vector3i>>&
voxel_coords)
544 template<se::Safe SafeB>
546 const std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f>>&
points_W,
547 std::vector<Eigen::Vector3i, Eigen::aligned_allocator<Eigen::Vector3i>>&
voxel_coords)
566 const Eigen::AlignedBox3f&
aabb()
const;
574 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
605template<se::Res ResT = se::Res::Multi,
int BlockSize = 8>
608template<se::Res ResT = se::Res::Multi,
int BlockSize = 8>
611template<se::Res ResT = se::Res::Multi,
int BlockSize = 8>
614template<se::Res ResT = se::Res::Multi,
int BlockSize = 8>
619template<se::Res ResT = se::Res::Single,
int BlockSize = 8>
622template<se::Res ResT = se::Res::Single,
int BlockSize = 8>
625template<se::Res ResT = se::Res::Single,
int BlockSize = 8>
628template<se::Res ResT = se::Res::Single,
int BlockSize = 8>
633#include "impl/map_impl.hpp"
const Eigen::Vector3f dimension_
The dimensions of the map.
Definition map.hpp:579
DataType getData(const Eigen::Vector3f &point_W) const
Get the stored data at the provided coordinates in [meter].
const Eigen::Isometry3f T_MW_
The transformation from world to map frame.
Definition map.hpp:580
std::enable_if_t< ResTDummy==Res::Multi, std::optional< se::field_t > > getFieldInterp(const Eigen::Vector3f &point_W, int &returned_scale) const
Get the interpolated field value at the provided coordinates and the scale it is stored at.
const DataConfigType & getDataConfig() const
Get the data configuration of the map.
Definition map.hpp:156
const Eigen::Vector3f ub_M_
The upper map bound.
Definition map.hpp:584
bool contains(const Eigen::Vector3f &point_W) const
Verify if a point is inside the map.
std::optional< se::field_vec_t > getFieldGrad(const Eigen::Vector3f &point_W) const
Get the field gradient at the provided coordinates.
SurfaceMesh mesh(const Eigen::Affine3f &T_OW=Eigen::Affine3f::Identity(), const int min_desired_scale=0) const
Return a mesh of the reconstructed surface in the world frame in units of metres.
StructureMesh structure(const Eigen::Affine3f &T_OW=Eigen::Affine3f::Identity(), const bool only_leaves=true) const
Return a mesh of the octree structure in the world frame in units of metres.
const Eigen::Isometry3f T_WM_
The transformation from map to world frame.
Definition map.hpp:581
int saveMesh(const std::string &filename, const Eigen::Affine3f &T_OW=Eigen::Affine3f::Identity(), const int min_desired_scale=0) const
Save the mesh returned by se::Map::mesh() in filename.
std::enable_if_t< ResTDummy==Res::Multi, std::optional< std::invoke_result_t< GetF, DataType > > > getInterp(const Eigen::Vector3f &point_W, ValidF valid, GetF get, int &returned_scale) const
Interpolate a member of DataType at the supplied coordinates and the finest possible scale.
int saveStructure(const std::string &filename, const Eigen::Affine3f &T_OW=Eigen::Affine3f::Identity(), const bool only_leaves=true) const
Save the mesh returned by se::Map::structure_meshing() in filename.
std::enable_if_t< ResTDummy==Res::Multi, int > saveScaleSlices(const std::string &filename_x, const std::string &filename_y, const std::string &filename_z, const Eigen::Vector3f &point_W) const
Save three slices of the integration scale, each perpendicular to one of the axes (x,...
const Eigen::Vector3f & getDim() const
Get the dimensions of the map in [meter] (length x width x height)
Definition map.hpp:136
OctreeType octree_
Definition map.hpp:577
Map & operator=(const Map &)=delete
The copy assignment operator is explicitly deleted.
OctreeType & getOctree()
Return a reference to the internal se::Octree.
Definition map.hpp:551
Map(const Config &map_config, const typename Data< FldT, ColB, SemB >::Config &data_config=typename Data< FldT, ColB, SemB >::Config())
The map constructor.
void voxelToPoint(const Eigen::Vector3i &voxel_coord, const int voxel_size, Eigen::Vector3f &point_W) const
Convert voxel coordinates in [voxel] for a given voxel size to its centre point coordinates in [meter...
Map(const Map &)=delete
The copy constructor is explicitly deleted.
const float resolution_
The resolution of the map.
Definition map.hpp:578
const OctreeType & getOctree() const
Return a constant reference to the internal se::Octree.
Definition map.hpp:557
void voxelToCornerPoints(const Eigen::Vector3i &voxel_coord, const int voxel_size, Eigen::Matrix< float, 3, 8 > &corner_points_W) const
Convert voxel coordinates in [voxel] for a given voxel size to its eight corner point coordinates in ...
std::enable_if_t< ResTDummy==Res::Multi &&ColourTDummy==Colour::On, std::optional< colour_t > > getColourInterp(const Eigen::Vector3f &point_W, int &returned_scale) const
Interpolate the colour at the supplied coordinates and the finest possible scale.
static const Eigen::Matrix< float, 3, 8 > corner_rel_steps_
The eight relative unit corner offsets.
Definition map.hpp:592
const Eigen::Vector3f lb_M_
The lower map bound.
Definition map.hpp:583
const Eigen::AlignedBox3f & aabb() const
Return the axis-aligned bounding box in the world frame W of the map's allocated leaves.
void voxelToCornerPoints(const Eigen::Vector3i &voxel_coord, Eigen::Matrix< float, 3, 8 > &corner_points_W) const
Convert voxel coordinates in [voxel] for a given voxel size to its eight corner point coordinates in ...
int saveFieldSlices(const std::string &filename_x, const std::string &filename_y, const std::string &filename_z, const Eigen::Vector3f &point_W) const
Save three slices of the field value, each perpendicular to one of the axes (x, y and z) at the provi...
const DataConfigType data_config_
The configuration of the data.
Definition map.hpp:586
std::optional< std::invoke_result_t< GetF, DataType > > getInterp(const Eigen::Vector3f &point_W, ValidF valid, GetF get) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::enable_if_t< ResTDummy==Res::Multi, DataType > getMaxData(const Eigen::Vector3f &point_W, const int scale_desired) const
Get the stored max data at the provided coordinates in [meter] for a given scale.
Definition map.hpp:195
Eigen::AlignedBox3i cached_octree_aabb_
Definition map.hpp:589
const Eigen::Isometry3f & getTMW() const
Get the transformation from world to map frame.
Definition map.hpp:116
Eigen::AlignedBox3f cached_aabb_
Definition map.hpp:588
se::Octree< DataType, ResT, BlockSize > OctreeType
Definition map.hpp:36
OctreeType::SurfaceMesh SurfaceMesh
Definition map.hpp:37
std::enable_if_t< SafeB==se::Safe::On, bool > pointToVoxel(const Eigen::Vector3f &point_W, Eigen::Vector3f &voxel_coord_f) const
Convert point coordinates in [meter] to its voxel coordinates in [voxel].
Data< FldT, ColB, SemB > DataType
Definition map.hpp:34
std::enable_if_t< ResTDummy==Res::Multi, DataType > getMinData(const Eigen::Vector3f &point_W, const int scale_desired) const
Get the stored min data at the provided coordinates in [meter] for a given scale.
std::enable_if_t< SafeB==se::Safe::On, bool > pointsToVoxels(const std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > &points_W, std::vector< Eigen::Vector3i, Eigen::aligned_allocator< Eigen::Vector3i > > &voxel_coords) const
Convert a vector of point coordinates in [meter] to its voxel coordinates in [voxel].
std::enable_if_t< SafeB==se::Safe::Off, bool > pointToVoxel(const Eigen::Vector3f &point_W, Eigen::Vector3f &voxel_coord_f) const
Convert point coordinates in [meter] to its voxel coordinates in [voxel].
float getRes() const
Get the resolution of the map in [meter/voxel].
Definition map.hpp:146
Map(const Eigen::Vector3f &dim, const float res, const typename Data< FldT, ColB, SemB >::Config &data_config=typename Data< FldT, ColB, SemB >::Config())
The map constructor.
std::enable_if_t< FldTDummy==se::Field::Occupancy, int > saveMinFieldSlices(const std::string &filename_x, const std::string &filename_y, const std::string &filename_z, const Eigen::Vector3f &point_W, const int scale) const
Save three slices of the minimum field value, each perpendicular to one of the axes (x,...
void voxelToPoint(const Eigen::Vector3i &voxel_coord, Eigen::Vector3f &point_W) const
Convert voxel coordinates in [voxel] to its centre point coordinates in [meter].
std::enable_if_t< FldTDummy==se::Field::Occupancy, int > saveMaxFieldSlices(const std::string &filename_x, const std::string &filename_y, const std::string &filename_z, const Eigen::Vector3f &point_W, const int scale) const
Save three slices of the maximum field value, each perpendicular to one of the axes (x,...
Data< FldT, ColB, SemB >::Config DataConfigType
Definition map.hpp:35
std::enable_if_t< ColourTDummy==Colour::On, std::optional< colour_t > > getColourInterp(const Eigen::Vector3f &point_W) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
std::optional< se::field_t > getFieldInterp(const Eigen::Vector3f &point_W) const
Get the interpolated field value at the provided coordinates.
std::enable_if_t< SafeB==se::Safe::On, bool > pointToVoxel(const Eigen::Vector3f &point_W, Eigen::Vector3i &voxel_coord) const
Convert point coordinates in [meter] to its voxel coordinates (bottom, front, left corner) in [voxel]...
const Eigen::Isometry3f & getTWM() const
Get the transformation from map to world frame.
Definition map.hpp:126
OctreeType::StructureMesh StructureMesh
Definition map.hpp:38
std::enable_if_t< SafeB==se::Safe::Off, bool > pointToVoxel(const Eigen::Vector3f &point_W, Eigen::Vector3i &voxel_coord) const
Convert point coordinates in [meter] to its voxel coordinates (bottom, front, left corner) in [voxel]...
std::enable_if_t< SafeB==se::Safe::Off, bool > pointsToVoxels(const std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > &points_W, std::vector< Eigen::Vector3i, Eigen::aligned_allocator< Eigen::Vector3i > > &voxel_coords) const
Convert a vector of point coordinates in [meter] to its voxel coordinates in [voxel].
std::enable_if_t< OctreeT::DataType::fld_==Field::Occupancy, typename OctreeT::DataType > getMaxData(const OctreeT &octree, const Eigen::Vector3i &voxel_coord, const int scale_desired)
Get the max occupancy data at a given scale.
Helper wrapper to allocate and de-allocate octants in the octree.
Definition bounded_vector.hpp:14
Res
Definition setup_util.hpp:23
Field
Definition setup_util.hpp:18
Semantics
Definition setup_util.hpp:20
Colour
Definition setup_util.hpp:19
Definition config.hpp:105
void readYaml(const std::string &yaml_file)
Reads the struct members from the "map" node of a YAML file.
friend std::ostream & operator<<(std::ostream &os, const Config &c)
Definition map.hpp:60