21 static constexpr
unsigned FRBITS = 9;
31 if (
auto* o = dynamic_cast<const mrpt::obs::CObservation2DRangeScan*>(&obs);
37 if (
auto* o = dynamic_cast<const mrpt::obs::CObservation3DRangeScan*>(&obs);
58 pts.insertionOptions.addToExistingPointsMap =
true;
59 pts.insertionOptions.disableDeletion =
true;
60 pts.insertionOptions.fuseWithExisting =
false;
61 pts.insertionOptions.insertInvalidPoints =
false;
62 pts.insertionOptions.minDistBetweenLaserPoints = .0;
64 pts.loadFromRangeScan(o, &robotPose);
66 const auto sensorPose3D = robotPose + o.
sensorPose;
75 const float maxValidRange)
84 for (std::size_t idx = 0; idx < xs.size();
108 const auto sensorPose3D = robotPose + o.
sensorPose;
126 if (maxFreeCertainty == .0f) maxFreeCertainty = maxCertainty;
128 const voxelType logodd_observation_free =
129 std::max<voxelType>(1,
p2l(maxFreeCertainty));
130 const voxelType logodd_observation_occupied =
131 3 * std::max<voxelType>(1,
p2l(maxCertainty));
136 logodd_observation_occupied;
155 const int Acx = trg_cx - cx;
156 const int Acy = trg_cy - cy;
157 const int Acz = trg_cz - cz;
159 const int Acx_ = std::abs(Acx);
160 const int Acy_ = std::abs(Acy);
161 const int Acz_ = std::abs(Acz);
163 const int nStepsRay =
mrpt::max3(Acx_, Acy_, Acz_);
164 if (!nStepsRay)
return;
166 const float N_1 = 1.0f / nStepsRay;
169 const int frAcx = (Acx < 0 ? -1 : +1) *
round((Acx_ <<
FRBITS) * N_1);
170 const int frAcy = (Acy < 0 ? -1 : +1) *
round((Acy_ <<
FRBITS) * N_1);
171 const int frAcz = (Acz < 0 ? -1 : +1) *
round((Acz_ <<
FRBITS) * N_1);
178 for (
int nStep = 0; nStep < nStepsRay; nStep++)
181 cx, cy, cz, logodd_observation_free, logodd_thres_free);
197 trg_cx, trg_cy, trg_cz, logodd_observation_occupied,
198 logodd_thres_occupied);
double x
X,Y,Z coordinates.
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini" file.
uint8_t decimation
(Default:1) If !=1, split the range image in blocks of DxD (D=decimation), and only generates one poi...
uint32_t LF_decimation
[LikelihoodField] The decimation of the points in a scan, default=1 == no decimation ...
const T max3(const T &A, const T &B, const T &C)
const mrpt::aligned_std_vector< float > & getPointsBufferRef_y() const
Provides a direct access to a read-only reference of the internal point buffer.
uint16_t decimation
Decimation for insertPointCloud() or 2D range scans (Default: 1)
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement, as from a time-of-flight range camera or any other RGBD sensor.
void internal_insertObservationScan2D(const mrpt::obs::CObservation2DRangeScan &o, const mrpt::poses::CPose3D &robotPose)
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
float LF_stdHit
[LikelihoodField] The laser range "sigma" used in computations; Default value = 0.35
float LF_maxCorrsDistance
[LikelihoodField] The max.
uint16_t decimation_3d_range
Specify the decimation of 3D range scans.
TInsertionOptions insertionOptions
With this struct options are provided to the observation insertion process.
static void updateCell_fast_occupied(cell_t *theCell, const cell_t logodd_obs, const cell_t thres)
Performs Bayesian fusion of a new observation of a cell.
bool LF_useSquareDist
[LikelihoodField] (Default:false) Use exp(dist^2/std^2) instead of exp(dist^2/std^2) ...
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...
This class allows loading and storing values and vectors of different types from a configuration text...
bool internal_insertObservation(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D *robotPose=nullptr) override
Insert the observation information into this map.
const mrpt::aligned_std_vector< float > & getPointsBufferRef_z() const
Provides a direct access to a read-only reference of the internal point buffer.
int y2idx(coord_t y) const
bool isOutOfBounds(const int cx, const int cy, const int cz) const
void project3DPointsFromDepthImageInto(mrpt::obs::CObservation3DRangeScan &src_obs, POINTMAP &dest_pointcloud, const mrpt::obs::T3DPointsProjectionParams &projectParams, const mrpt::obs::TRangeImageFilterParams &filterParams)
int x2idx(coord_t x) const
Transform a coordinate values into voxel indexes.
int32_t rayTracing_decimation
[rayTracing] One out of "rayTracing_decimation" rays will be simulated and compared only: set to 1 to...
void insertRay(const mrpt::math::TPoint3D &sensor, const mrpt::math::TPoint3D &end, bool endIsOccupied=true)
Increases the freeness of a ray segment, and the occupancy of the voxel at its end point (unless endI...
string iniFile(myDataDir+string("benchmark-options.ini"))
void OnPostSuccesfulInsertObs(const mrpt::obs::CObservation &) override
See base class.
bool m_is_empty
True upon construction; used by isEmpty()
GLsizei const GLchar ** string
float LF_zHit
[LikelihoodField]
float maxFreenessUpdateCertainty
A value in the range [0.5,1] for updating a free voxel.
#define MRPT_LOAD_CONFIG_VAR( variableName, variableType, configFileObject, sectionNameStr)
An useful macro for loading variables stored in a INI-like file under a key with the same name that t...
void internal_insertObservationScan3D(const mrpt::obs::CObservation3DRangeScan &o, const mrpt::poses::CPose3D &robotPose)
void saveToConfigFile(mrpt::config::CConfigFileBase &c, const std::string &s) const override
This method saves the options to a ".ini"-like file or memory-stored string list. ...
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Declares a class that represents any robot's observation.
float maxOccupancyUpdateCertainty
A value in the range [0.5,1] used for updating voxel with a Bayesian approach (default 0...
Used in CObservation3DRangeScan::project3DPointsFromDepthImageInto()
static constexpr unsigned FRBITS
void insertPointCloud(const mrpt::math::TPoint3D &sensorCenter, const mrpt::maps::CPointsMap &pts, const float maxValidRange=std::numeric_limits< float >::max())
Calls insertRay() for each point in the point cloud, using as sensor central point (the origin of all...
TLikelihoodMethod likelihoodMethod
The selected method to compute an observation likelihood.
float LF_maxRange
[LikelihoodField] The max.
#define MRPT_SAVE_CONFIG_VAR_COMMENT(variableName, __comment)
A generic provider of log-odds grid-map maintainance functions.
TInsertionOptions insertionOptions
The options used when inserting observations in the map.
grid_t m_grid
The actual 3D voxels container.
static voxelType p2l(const float p)
Scales a real valued probability in [0,1] to an integer representation of: log(p)-log(1-p) in the val...
int z2idx(coord_t z) const
static void updateCell_fast_free(cell_t *theCell, const cell_t logodd_obs, const cell_t thres)
Performs Bayesian fusion of a new observation of a cell.
const mrpt::aligned_std_vector< float > & getPointsBufferRef_x() const
Provides a direct access to a read-only reference of the internal point buffer.
float rayTracing_stdHit
[rayTracing] The laser range sigma.
OccGridCellTraits::cellType voxelType
The type of the map voxels:
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
bool takeIntoAccountSensorPoseOnRobot
(Default: false) If false, local (sensor-centric) coordinates of points are generated.
float maxRange
The maximum range allowed by the device, in meters (e.g.
int round(const T value)
Returns the closer integer (int) to x.