10 #ifndef CRANGESCANOPS_IMPL_H
11 #define CRANGESCANOPS_IMPL_H
13 namespace mrpt {
namespace graphslam {
namespace deciders {
15 template<
class GRAPH_T>
34 if (initial_pose_in) {
35 initial_pose = *initial_pose_in;
38 mrpt::poses::CPosePDFPtr pdf =
params.icp.Align(
46 rel_edge->copyFrom(*pdf);
49 if (icp_info) *icp_info =
info;
53 template<
class GRAPH_T>
63 mrpt::format(
"Laser scan doesn't contain valid range image"));
65 mrpt::format(
"Laser scan doesn't contain valid range image"));
80 if (initial_pose_in) {
84 mrpt::poses::CPose3DPDFPtr pdf =
params.icp.Align3D(
95 if (fabs(pdf->getMeanVal().z()) < 0.1) {
96 rel_edge->copyFrom(*pdf);
103 if (icp_info) *icp_info =
info;
109 template<
class GRAPH_T>
112 size_t keep_point_every,
116 size_t map_size = m->
size();
120 size_t conservative_keep_point_every = map_size / low_lim;
121 keep_point_every =
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) {
127 if (i % keep_point_every == 0) {
128 deletion_mask[i] =
false;
138 template<
class GRAPH_T>
140 mrpt::obs::CObservation3DRangeScanPtr& scan3D_in,
141 mrpt::obs::CObservation2DRangeScanPtr* scan2D_out ) {
144 bool success =
false;
146 if ( !(*scan2D_out) ) {
150 if (scan3D_in->hasRangeImage) {
151 scan3D_in->convertTo2DScan(**scan2D_out,
params.conversion_params);
155 std::cout <<
"No valid rangeImage found" << std::endl;
166 template<
class GRAPH_T>
168 has_read_config(false)
171 template<
class GRAPH_T>
175 template<
class GRAPH_T>
180 out.
printf(
"3D=>2D LaserScan Conversion Sensor label = %s\n",
181 conversion_params.sensorLabel.c_str());
182 out.
printf(
"3D=>2D LaserScan Conversion angle sup = %.2f deg\n",
184 out.
printf(
"3D=>2D LaserScan Conversion angle inf = %.2f deg\n",
186 out.
printf(
"3D=>2D LaserScan Conversion oversampling ratio = %.2f\n",
187 conversion_params.oversampling_ratio);
188 out.
printf(
"3D=>2D LaserScan Conversion Z minimum = %.2f\n",
189 conversion_params.z_min);
191 icp.options.dumpToTextStream(out);
195 template<
class GRAPH_T>
201 conversion_params.sensorLabel =
source.read_string(
203 "conversion_sensor_label",
204 "KINECT_TO_2D_SCAN",
false);
207 "conversion_angle_sup",
211 "conversion_angle_inf",
213 conversion_params.oversampling_ratio =
source.read_double(
215 "conversion_oversampling_ratio",
217 conversion_params.z_min =
source.read_double(
224 icp.options.loadFromConfigFile(
source,
"ICP");
226 has_read_config =
true;
Class for keeping together all the RangeScanner-related functions.
void getICPEdge(const mrpt::obs::CObservation2DRangeScan &from, const mrpt::obs::CObservation2DRangeScan &to, constraint_t *rel_edge, const mrpt::poses::CPose2D *initial_pose=NULL, mrpt::slam::CICP::TReturnInfo *icp_info=NULL)
Align the 2D range scans provided and fill the potential edge that can transform the one into the oth...
GRAPH_T::constraint_t constraint_t
Handy typedefs.
bool insertObservation(const mrpt::obs::CObservation *obs, const mrpt::poses::CPose3D *robotPose=NULL)
Insert the observation information into this map.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors.
void applyDeletionMask(const std::vector< bool > &mask)
Remove from the map the points marked in a bool's array as "true".
size_t size() const
Returns the number of stored points in the map.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans.
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
static CObservation2DRangeScanPtr Create()
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement,...
bool hasRangeImage
true means the field rangeImage contains valid data
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).
This class allows loading and storing values and vectors of different types from a configuration text...
This base class is used to provide a unified interface to files,memory buffers,..Please see the deriv...
virtual int printf(const char *fmt,...) MRPT_printf_format_check(2
Writes a string to the stream in a textual form.
GLenum const GLfloat * params
GLsizei const GLchar ** string
GLsizei GLsizei GLchar * source
#define ASSERTMSG_(f, __ERROR_MSG)
double DEG2RAD(const double x)
Degrees to radians.
double RAD2DEG(const double x)
Radians to degrees.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
std::string BASE_IMPEXP format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
void loadFromConfigFile(const mrpt::utils::CConfigFileBase &source, const std::string §ion)
This method load the options from a ".ini"-like file or memory-stored string list.
void dumpToTextStream(mrpt::utils::CStream &out) const
This method should clearly display all the contents of the structure in textual form,...
The ICP algorithm return information.