12 #include <Eigen/StdVector> 53 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
61 template<
typename DataT = se::Data<Field::TSDF, Colour::Off, Semantics::Off>,
62 Res ResT = Res::Single,
68 template<Field FldT, Colour ColB, Semantics SemB, Res ResT,
int BlockSize>
69 class Map<
se::
Data<FldT, ColB, SemB>, ResT, BlockSize> {
84 Map(
const Eigen::Vector3f&
dim,
103 inline bool contains(
const Eigen::Vector3f& point_W)
const;
202 template<Safe SafeB = Safe::Off>
203 inline const DataType
getData(
const Eigen::Vector3f& point_W)
const;
214 template<Safe SafeB = Safe::Off, Res ResTDummy = ResT>
215 inline typename std::enable_if_t<ResTDummy == Res::Multi, DataType>
216 getMaxData(
const Eigen::Vector3f& point_W,
const int scale_desired)
const 218 Eigen::Vector3i voxel_coord;
222 pointToVoxel<Safe::Off>(point_W, voxel_coord);
225 if (!pointToVoxel<Safe::On>(point_W, voxel_coord)) {
241 template<Safe SafeB = Safe::Off>
242 inline std::optional<se::field_t>
getFieldInterp(
const Eigen::Vector3f& point_W)
const;
253 template<Safe SafeB = Safe::Off, Res ResTDummy = ResT>
254 inline typename std::enable_if_t<ResTDummy == Res::Multi, std::optional<se::field_t>>
255 getFieldInterp(
const Eigen::Vector3f& point_W,
int& returned_scale)
const;
264 template<Safe SafeB = Safe::Off>
265 inline std::optional<se::field_vec_t>
getFieldGrad(
const Eigen::Vector3f& point_W)
const;
282 int saveFieldSlices(
const std::string& filename_x,
283 const std::string& filename_y,
284 const std::string& filename_z,
285 const Eigen::Vector3f& point_W)
const;
303 template<se::Field FldTDummy = FldT>
304 typename std::enable_if_t<FldTDummy == se::Field::Occupancy, int>
305 saveMaxFieldSlices(
const std::string& filename_x,
306 const std::string& filename_y,
307 const std::string& filename_z,
308 const Eigen::Vector3f& point_W,
309 const int scale)
const;
326 template<Res ResTDummy = ResT>
327 typename std::enable_if_t<ResTDummy == Res::Multi, int>
328 saveScaleSlices(
const std::string& filename_x,
329 const std::string& filename_y,
330 const std::string& filename_z,
331 const Eigen::Vector3f& point_W)
const;
343 int saveStructure(
const std::string& filename,
344 const Eigen::Matrix4f& T_WM = Eigen::Matrix4f::Identity())
const;
355 int saveMesh(
const std::string& filename,
356 const Eigen::Matrix4f& T_OW = Eigen::Matrix4f::Identity())
const;
366 int saveMeshVoxel(
const std::string& filename)
const;
376 inline void voxelToPoint(
const Eigen::Vector3i& voxel_coord, Eigen::Vector3f& point_W)
const;
385 inline void voxelToPoint(
const Eigen::Vector3i& voxel_coord,
386 const int voxel_size,
387 Eigen::Vector3f& point_W)
const;
397 inline void voxelToCornerPoints(
const Eigen::Vector3i& voxel_coord,
398 Eigen::Matrix<float, 3, 8>& corner_points_W)
const;
407 inline void voxelToCornerPoints(
const Eigen::Vector3i& voxel_coord,
408 const int voxel_size,
409 Eigen::Matrix<float, 3, 8>& corner_points_W)
const;
421 template<se::Safe SafeB = se::Safe::On>
422 inline typename std::enable_if_t<SafeB == se::Safe::On, bool>
423 pointToVoxel(
const Eigen::Vector3f& point_W, Eigen::Vector3i& voxel_coord)
const;
433 template<se::Safe SafeB>
434 inline typename std::enable_if_t<SafeB == se::Safe::Off, bool>
435 pointToVoxel(
const Eigen::Vector3f& point_W, Eigen::Vector3i& voxel_coord)
const;
445 template<se::Safe SafeB = se::Safe::On>
446 inline typename std::enable_if_t<SafeB == se::Safe::On, bool>
447 pointToVoxel(
const Eigen::Vector3f& point_W, Eigen::Vector3f& voxel_coord_f)
const;
457 template<se::Safe SafeB>
458 inline typename std::enable_if_t<SafeB == se::Safe::Off, bool>
459 pointToVoxel(
const Eigen::Vector3f& point_W, Eigen::Vector3f& voxel_coord_f)
const;
469 template<se::Safe SafeB = se::Safe::On>
470 inline typename std::enable_if_t<SafeB == se::Safe::On, bool> pointsToVoxels(
471 const std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f>>& points_W,
472 std::vector<Eigen::Vector3i, Eigen::aligned_allocator<Eigen::Vector3i>>& voxel_coords)
483 template<se::Safe SafeB>
484 inline typename std::enable_if_t<SafeB == se::Safe::Off, bool> pointsToVoxels(
485 const std::vector<Eigen::Vector3f, Eigen::aligned_allocator<Eigen::Vector3f>>& points_W,
486 std::vector<Eigen::Vector3i, Eigen::aligned_allocator<Eigen::Vector3i>>& voxel_coords)
519 octree_ptr_ = octree_ptr;
526 static constexpr
Res res_ = ResT;
534 bool initialiseOctree();
544 std::shared_ptr<OctreeType> octree_ptr_ =
nullptr;
561 template<se::Res ResT = se::Res::Single,
int BlockSize = 8>
564 template<se::Res ResT = se::Res::Single,
int BlockSize = 8>
567 template<se::Res ResT = se::Res::Single,
int BlockSize = 8>
570 template<se::Res ResT = se::Res::Single,
int BlockSize = 8>
575 template<se::Res ResT = se::Res::Single,
int BlockSize = 8>
578 template<se::Res ResT = se::Res::Single,
int BlockSize = 8>
581 template<se::Res ResT = se::Res::Single,
int BlockSize = 8>
584 template<se::Res ResT = se::Res::Single,
int BlockSize = 8>
589 #include "impl/map_impl.hpp" DataConfigType data_config_
The configuration of the data.
Definition: map.hpp:546
static Eigen::Matrix3f to_rotation(const Eigen::Matrix4f &T)
Eigen::Matrix4f getTWM() const
Get the transformation from map to world frame.
Definition: map.hpp:120
const Eigen::Vector3f lb_M_
The lower map bound.
Definition: map.hpp:541
Eigen::Matrix4f T_MW
The transformation from the world frame W to the map frame M.
Definition: map.hpp:41
Res
Definition: setup_util.hpp:23
void setOctree(std::shared_ptr< OctreeType > octree_ptr)
Update the octree pointer to a new one.
Definition: map.hpp:516
std::shared_ptr< OctreeType > getOctree()
Get the shared pointer to the octree.
Definition: map.hpp:494
float res
The resolution of map voxels in metres.
Definition: map.hpp:37
std::ostream & operator<<(std::ostream &os, const FieldDataConfig< se::Field::Occupancy > &c)
Colour
Definition: setup_util.hpp:19
const Eigen::Vector3f dimension_
The dimensions of the map.
Definition: map.hpp:536
DataConfig< FldT, ColB, SemB > DataConfigType
Definition: map.hpp:72
MapConfig()
Initializes the config to a 10m x 10m x 3m map with a 10cm resolution and the origin at the centre of...
Eigen::Vector3f dim
The dimensions of the map in metres.
Definition: map.hpp:33
Eigen::Matrix< float, 3, 8 > corner_rel_steps_
The eight relative unit corner offsets.
Definition: map.hpp:548
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:216
OctreeT::DataType getData(const OctreeT &octree, const Eigen::Vector3i &voxel_coord)
Single/multi-res get data functions.
std::enable_if_t<(OctreeT::fld_==se::Field::TSDF &&OctreeT::res_==se::Res::Multi), std::optional< se::field_t > > getFieldInterp(const OctreeT &octree, const Eigen::Vector3f &voxel_coord_f, const int scale_desired, int &scale_returned)
Get the interplated field value for a given coordinate [float voxel coordinates] and desired scale...
Definition: visitor.hpp:273
Eigen::Vector3f gettMW() const
Get the translation from world to map frame.
Definition: map.hpp:130
Eigen::Matrix3f getRWM() const
Get the rotation from map to world frame.
Definition: map.hpp:160
Eigen::Matrix4f getTMW() const
Get the transformation from world to map frame.
Definition: map.hpp:110
const Eigen::Matrix4f T_MW_
The transformation from world to map frame.
Definition: map.hpp:538
Data< FldT, ColB, SemB > DataType
Definition: map.hpp:71
const float resolution_
The resolution of the map.
Definition: map.hpp:537
Eigen::Vector3f gettWM() const
Get the translation from map to world frame.
Definition: map.hpp:140
Eigen::Matrix3f getRMW() const
Get the rotation from world to map frame.
Definition: map.hpp:150
std::shared_ptr< OctreeType > getOctree() const
Get the const shared pointer to the octree.
Definition: map.hpp:504
Field
Definition: setup_util.hpp:18
const Eigen::Matrix4f T_WM_
The transformation from map to world frame.
Definition: map.hpp:539
static Eigen::Vector3f to_translation(const Eigen::Matrix4f &T)
The octree is the memory manager of the map.
Definition: octree.hpp:36
float getRes() const
Get the resolution of the map in [meter/voxel].
Definition: map.hpp:180
DataConfigType getDataConfig() const
Get the data configuration of the map.
Definition: map.hpp:190
std::enable_if_t< OctreeT::DataType::fld_==se::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.
Semantics
Definition: setup_util.hpp:20
se::Octree< DataType, ResT, BlockSize > OctreeType
Definition: map.hpp:73
const Eigen::Vector3f ub_M_
The upper map bound.
Definition: map.hpp:542
Eigen::Vector3f getDim() const
Get the dimensions of the map in [meter] (length x width x height)
Definition: map.hpp:170
std::enable_if_t< OctreeT::res_==se::Res::Single, std::optional< se::field_vec_t > > getFieldGrad(const OctreeT &octree, const Eigen::Vector3f &voxel_coord_f)
Single-res get gradient functions.
Helper wrapper to allocate and de-allocate octants in the octree.
Definition: colour_utils.hpp:17
static const std::vector< Eigen::Vector3f, Eigen::aligned_allocator< Eigen::Vector3f > > scale
The colours used for the various integration scales.
Definition: colour_utils.hpp:22