15 template <
class GRAPH_T>
36 initial_pose = *initial_pose_in;
40 params.icp.Align(&m1, &m2, initial_pose, &running_time, (
void*)&info);
43 rel_edge->copyFrom(*pdf);
46 if (icp_info) *icp_info = info;
50 template <
class GRAPH_T>
61 mrpt::format(
"Laser scan doesn't contain valid range image"));
64 mrpt::format(
"Laser scan doesn't contain valid range image"));
87 params.icp.Align3D(&m1, &m2, initial_pose, &running_time, (
void*)&info);
93 if (fabs(pdf->getMeanVal().z()) < 0.1)
95 rel_edge->copyFrom(*pdf);
103 if (icp_info) *icp_info = info;
108 template <
class GRAPH_T>
114 size_t map_size = m->
size();
119 size_t conservative_keep_point_every = map_size / low_lim;
121 std::min(keep_point_every, conservative_keep_point_every);
125 std::vector<bool> deletion_mask(map_size,
true);
126 for (
size_t i = 0; i != map_size; ++i)
128 if (i % keep_point_every == 0)
130 deletion_mask[i] =
false;
141 template <
class GRAPH_T>
148 bool success =
false;
155 if (scan3D_in->hasRangeImage)
157 scan3D_in->convertTo2DScan(**scan2D_out,
params.conversion_params);
162 std::cout <<
"No valid rangeImage found" << std::endl;
170 template <
class GRAPH_T>
176 "3D=>2D LaserScan Conversion Sensor label = %s\n",
179 "3D=>2D LaserScan Conversion angle sup = %.2f deg\n",
182 "3D=>2D LaserScan Conversion angle inf = %.2f deg\n",
185 "3D=>2D LaserScan Conversion oversampling ratio = %.2f\n",
188 "3D=>2D LaserScan Conversion Z minimum = %.2f\n",
195 template <
class GRAPH_T>
201 conversion_params.sensorLabel =
source.read_string(
202 section,
"conversion_sensor_label",
"KINECT_TO_2D_SCAN",
false);
204 source.read_double(section,
"conversion_angle_sup", 10,
false));
206 source.read_double(section,
"conversion_angle_inf", 10,
false));
207 conversion_params.oversampling_ratio =
source.read_double(
208 section,
"conversion_oversampling_ratio", 1.1,
false);
209 conversion_params.z_min =
source.read_double(
210 section,
"conversion_z_min", 0,
false);
213 icp.options.loadFromConfigFile(
source,
"ICP");
215 has_read_config =
true;
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream.
double RAD2DEG(const double x)
Radians to degrees.
bool convert3DTo2DRangeScan(mrpt::obs::CObservation3DRangeScan::Ptr &scan3D_in, mrpt::obs::CObservation2DRangeScan::Ptr *scan2D_out)
Wrapper around the CObservation3DRangeScan::convertTo2DScan corresponding method. ...
double DEG2RAD(const double x)
Degrees to radians.
void getICPEdge(const mrpt::obs::CObservation2DRangeScan &from, const mrpt::obs::CObservation2DRangeScan &to, constraint_t *rel_edge, const mrpt::poses::CPose2D *initial_pose=nullptr, mrpt::slam::CICP::TReturnInfo *icp_info=nullptr)
Align the 2D range scans provided and fill the potential edge that can transform the one into the oth...
std::string sensorLabel
The sensor label that will have the newly created observation.
mrpt::obs::T3DPointsTo2DScanParams conversion_params
Struct holding the parameters of 3D to the corresponding 2D range scan conversion.
double oversampling_ratio
(Default=1.2=120%) How many more laser scans rays to create (read docs for CObservation3DRangeScan::c...
double angle_sup
(Default=5 degrees) [Only if use_origin_sensor_pose=false] The upper & lower half-FOV angle (in radia...
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 decimatePointsMap(mrpt::maps::CPointsMap *m, size_t keep_point_every=4, size_t low_lim=0)
Reduce the size of the given CPointsMap by keeping one out of "keep_point_every" points.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
double z_min
(Default:-inf, +inf) [Only if use_origin_sensor_pose=true] Only obstacle points with Z coordinates wi...
static Ptr Create(Args &&... args)
TConfigParams options
The options employed by the ICP align.
typename GRAPH_T::constraint_t constraint_t
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 hasRangeImage
true means the field rangeImage contains valid data
void loadFromConfigFile(const mrpt::config::CConfigFileBase &source, const std::string §ion) override
This method load the options from a ".ini"-like file or memory-stored string list.
virtual void dumpToTextStream(std::ostream &out) const
This method should clearly display all the contents of the structure in textual form, sending it to a std::ostream.
GLsizei const GLchar ** string
#define ASSERTDEBMSG_(f, __ERROR_MSG)
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
A class used to store a 2D pose, including the 2D coordinate point and a heading (phi) angle...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
The ICP algorithm return information.
GLsizei GLsizei GLchar * source
size_t size() const
Returns the number of stored points in the map.
GLenum const GLfloat * params
void applyDeletionMask(const std::vector< bool > &mask)
Remove from the map the points marked in a bool's array as "true".
bool insertObservation(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D *robotPose=nullptr)
Insert the observation information into this map.