31#include "rtabmap/core/rtabmap_core_export.h"
33#include <rtabmap/core/LocalGrid.h>
34#include <rtabmap/core/Parameters.h>
35#include <rtabmap/core/Transform.h>
59 inline static float logodds(
double probability)
61 return (
float) log(probability/(1-probability));
67 return 1. - ( 1. / (1. + exp(logodds)));
90 bool update(
const std::map<int, Transform> & poses);
100 const std::map<int, Transform> &
addedNodes()
const {
return addedNodes_;}
103 void getGridMin(
double & x,
double & y)
const {x=minValues_[0];y=minValues_[1];}
105 void getGridMax(
double & x,
double & y)
const {x=maxValues_[0];y=maxValues_[1];}
107 void getGridMin(
double & x,
double & y,
double & z)
const {x=minValues_[0];y=minValues_[1];z=minValues_[2];}
109 void getGridMax(
double & x,
double & y,
double & z)
const {x=maxValues_[0];y=maxValues_[1];z=maxValues_[2];}
123 virtual void assemble(
const std::list<std::pair<int, Transform> > & newPoses) = 0;
126 const std::map<int, LocalGrid> &
cache()
const {
return cache_->localGrids();}
142 float logOddsClampingMin_;
143 float logOddsClampingMax_;
145 double minValues_[3];
146 double maxValues_[3];
150 std::map<int, Transform> addedNodes_;
Abstract base for assembling per-node LocalGrid data into a global map.
GlobalMap(const LocalGridCache *cache, const ParametersMap ¶meters=ParametersMap())
Constructs the base map; subclasses call from their constructor.
void getGridMax(double &x, double &y, double &z) const
3D grid maximum (x, y, z) in meters.
void addAssembledNode(int id, const Transform &pose)
Records a successfully assembled node (ids <= 0 are ignored).
bool fullUpdateNeeded(const std::map< int, Transform > &poses) const
True if the map should be rebuilt from cache (loop closure or disjoint graph).
virtual unsigned long getMemoryUsed() const
Approximate memory used by assembled-node bookkeeping (bytes).
void getGridMin(double &x, double &y, double &z) const
3D grid minimum (x, y, z) in meters.
float getCellSize() const
static double probability(double logodds)
Converts log-odds back to probability in (0, 1).
const std::map< int, LocalGrid > & cache() const
const std::map< int, Transform > & assembledNodes() const
const std::map< int, Transform > & addedNodes() const
float getUpdateError() const
bool isNodeAssembled(int id)
bool update(const std::map< int, Transform > &poses)
Incrementally assemble new nodes from poses.
virtual void clear()
Clears assembled nodes and grid bounds; does not clear LocalGridCache.
void getGridMax(double &x, double &y) const
2D grid maximum (x, y) in meters.
void getGridMin(double &x, double &y) const
2D grid minimum (x, y) in meters.
virtual void assemble(const std::list< std::pair< int, Transform > > &newPoses)=0
Subclass hook: merge newPoses into the global map; call addAssembledNode().
static float logodds(double probability)
Converts probability in (0, 1) to log-odds.
Cache of LocalGrid entries keyed by map node id.
std::map< std::string, std::string > ParametersMap
Parameter keys mapped to their values, as used by every configurable class (see Parameters).