Go to the documentation of this file.
22 template <
class OCTREE,
class OCTREE_NODE>
28 template <
class OCTREE,
class OCTREE_NODE>
30 : insertionOptions(*this),
31 m_impl(new Impl({resolution}))
34 template <
class OCTREE,
class OCTREE_NODE>
35 template <
class octomap_po
int3d,
class octomap_po
intcloud>
36 bool COctoMapBase<OCTREE, OCTREE_NODE>::
37 internal_build_PointCloud_for_observation(
40 octomap_pointcloud& scan)
const
49 robotPose3D = (*robotPose);
66 octomap::point3d(sensorPose.
x(), sensorPose.
y(), sensorPose.z());
70 const size_t nPts = scanPts->
size();
76 for (
size_t i = 0; i < nPts; i++)
86 scan.push_back(gx, gy, gz);
106 octomap::point3d(sensorPose.
x(), sensorPose.
y(), sensorPose.z());
110 const size_t sizeRangeScan = o->
points3D_x.size();
113 scan.reserve(sizeRangeScan);
118 const float m00 = H.get_unsafe(0, 0);
119 const float m01 = H.get_unsafe(0, 1);
120 const float m02 = H.get_unsafe(0, 2);
121 const float m03 = H.get_unsafe(0, 3);
122 const float m10 = H.get_unsafe(1, 0);
123 const float m11 = H.get_unsafe(1, 1);
124 const float m12 = H.get_unsafe(1, 2);
125 const float m13 = H.get_unsafe(1, 3);
126 const float m20 = H.get_unsafe(2, 0);
127 const float m21 = H.get_unsafe(2, 1);
128 const float m22 = H.get_unsafe(2, 2);
129 const float m23 = H.get_unsafe(2, 3);
132 for (
size_t i = 0; i < sizeRangeScan; i++)
139 if (pt.
x != 0 || pt.
y != 0 || pt.
z != 0)
142 const float gx = m00 * pt.
x + m01 * pt.
y + m02 * pt.
z + m03;
143 const float gy = m10 * pt.
x + m11 * pt.
y + m12 * pt.
z + m13;
144 const float gz = m20 * pt.
x + m21 * pt.
y + m22 * pt.
z + m23;
147 scan.push_back(gx, gy, gz);
156 template <
class OCTREE,
class OCTREE_NODE>
166 mrpt::make_aligned_shared<mrpt::opengl::CSetOfObjects>();
168 this->getAs3DObject(obj3D);
179 m_impl->m_octomap.writeBinaryConst(fil);
184 template <
class OCTREE,
class OCTREE_NODE>
188 octomap::point3d sensorPt;
189 octomap::Pointcloud scan;
191 if (!internal_build_PointCloud_for_observation(
192 obs, &takenFrom, sensorPt, scan))
195 octomap::OcTreeKey key;
196 const size_t N = scan.size();
199 for (
size_t i = 0; i < N; i += likelihoodOptions.decimation)
201 if (m_impl->m_octomap
202 .coordToKeyChecked(scan.getPoint(i), key))
205 m_impl->m_octomap.search(key, 0 );
206 if (node) log_lik += std::log(node->getOccupancy());
213 template <
class OCTREE,
class OCTREE_NODE>
215 const float x,
const float y,
const float z,
double& prob_occupancy)
const
217 octomap::OcTreeKey key;
218 if (m_impl->m_octomap
219 .coordToKeyChecked(octomap::point3d(
x,
y,
z), key))
222 m_impl->m_octomap.search(key, 0 );
223 if (!node)
return false;
225 prob_occupancy = node->getOccupancy();
232 template <
class OCTREE,
class OCTREE_NODE>
234 const CPointsMap& ptMap,
const float sensor_x,
const float sensor_y,
235 const float sensor_z)
238 const octomap::point3d sensorPt(sensor_x, sensor_y, sensor_z);
240 const float *xs, *ys, *zs;
242 for (
size_t i = 0; i < N; i++)
245 sensorPt, octomap::point3d(xs[i], ys[i], zs[i]),
246 insertionOptions.maxrange, insertionOptions.pruning);
250 template <
class OCTREE,
class OCTREE_NODE>
255 octomap::point3d _end;
260 octomap::point3d(origin.
x, origin.
y, origin.
z),
261 octomap::point3d(direction.
x, direction.
y, direction.
z), _end,
262 ignoreUnknownCells, maxRange);
273 template <
class OCTREE,
class OCTREE_NODE>
283 clampingThresMin(0.1192),
284 clampingThresMax(0.971)
288 template <
class OCTREE,
class OCTREE_NODE>
297 clampingThresMin(0.1192),
298 clampingThresMax(0.971)
302 template <
class OCTREE,
class OCTREE_NODE>
308 template <
class OCTREE,
class OCTREE_NODE>
317 template <
class OCTREE,
class OCTREE_NODE>
335 template <
class OCTREE,
class OCTREE_NODE>
337 std::ostream& out)
const
340 "\n----------- [COctoMapBase<>::TInsertionOptions] ------------ \n\n");
354 template <
class OCTREE,
class OCTREE_NODE>
356 std::ostream& out)
const
359 "\n----------- [COctoMapBase<>::TLikelihoodOptions] ------------ \n\n");
367 template <
class OCTREE,
class OCTREE_NODE>
388 template <
class OCTREE,
class OCTREE_NODE>
396 template <
class OCTREE,
class OCTREE_NODE>
402 out << generateGridLines << generateOccupiedVoxels << visibleOccupiedVoxels
403 << generateFreeVoxels << visibleFreeVoxels;
406 template <
class OCTREE,
class OCTREE_NODE>
416 in >> generateGridLines >> generateOccupiedVoxels >>
417 visibleOccupiedVoxels >> generateFreeVoxels >>
Lightweight 3D point (float version).
virtual void load() const override
Makes sure all images and other fields which may be externally stored are loaded in memory.
size_t size() const
Returns the number of stored points in the map.
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.
bool hasPoints3D
true means the field points3D contains valid data.
virtual void setProbHit(double prob)=0
void composeFrom(const CPose3D &A, const CPose3D &B)
Makes "this = A (+) B"; this method is slightly more efficient than "this= A + B;" since it avoids th...
void getPointFast(size_t index, float &x, float &y, float &z) const
Just like getPoint() but without checking out-of-bound index and without returning the point weight,...
void insert(const CRenderizable::Ptr &newObject, const std::string &viewportName=std::string("main"))
Insert a new object into the scene, in the given viewport (by default, into the "main" viewport).
#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...
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
void readFromStream(mrpt::serialization::CArchive &in)
Binary dump to stream.
virtual void setOccupancyThres(double prob)=0
This class allows the user to create, load, save, and render 3D scenes using OpenGL primitives.
std::vector< float > points3D_z
void readFromStream(mrpt::serialization::CArchive &in)
Binary dump to stream.
virtual double getProbMiss() const =0
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form,...
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
const POINTSMAP * buildAuxPointsMap(const void *options=nullptr) const
Returns a cached points map representing this laser scan, building it upon the first call.
void writeToStream(mrpt::serialization::CArchive &out) const
Binary dump to stream.
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
std::vector< float > points3D_y
This namespace contains representation of robot actions and observations.
Virtual base class for "archives": classes abstracting I/O streams.
A three-dimensional probabilistic occupancy grid, implemented as an octo-tree with the "octomap" C++ ...
virtual double getClampingThresMin() const =0
bool castRay(const mrpt::math::TPoint3D &origin, const mrpt::math::TPoint3D &direction, mrpt::math::TPoint3D &end, bool ignoreUnknownCells=false, double maxRange=-1.0) const
Performs raycasting in 3d, similar to computeRay().
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot.
Declares a class derived from "CObservation" that encapsules a 3D range scan measurement,...
This class allows loading and storing values and vectors of different types from a configuration text...
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
double x() const
Common members of all points & poses classes.
virtual void setProbMiss(double prob)=0
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
double x
X,Y,Z coordinates.
string iniFile(myDataDir+string("benchmark-options.ini"))
#define IS_CLASS(ptrObj, class_name)
Evaluates to true if the given pointer to an object (derived from mrpt::rtti::CObject) is of the give...
std::vector< float > points3D_x
If hasPoints3D=true, the (X,Y,Z) coordinates of the 3D point cloud detected by the camera.
virtual double getClampingThresMax() const =0
virtual void setClampingThresMax(double thresProb)=0
#define LOADABLEOPTS_DUMP_VAR(variableName, variableType)
Macro for dumping a variable to a stream, within the method "dumpToTextStream(out)" (Variable types a...
std::shared_ptr< CSetOfObjects > Ptr
void writeToStream(mrpt::serialization::CArchive &out) const
Binary dump to stream.
A numeric matrix of compile-time fixed size.
virtual double getProbHit() const =0
virtual double getOccupancyThres() const =0
bool saveToFile(const std::string &fil) const
Saves the scene to a 3Dscene file, loadable by the application SceneViewer3D.
void composePoint(double lx, double ly, double lz, double &gx, double &gy, double &gz, mrpt::math::CMatrixFixedNumeric< double, 3, 3 > *out_jacobian_df_dpoint=nullptr, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dpose=nullptr, mrpt::math::CMatrixFixedNumeric< double, 3, 6 > *out_jacobian_df_dse3=nullptr, bool use_small_rot_approx=false) const
An alternative, slightly more efficient way of doing with G and L being 3D points and P this 6D pose...
void getPointsBuffer(size_t &outPointsCount, const float *&xs, const float *&ys, const float *&zs) const
Provides a direct access to points buffer, or nullptr if there is no points in the map.
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.
void dumpToTextStream(std::ostream &out) const override
This method should clearly display all the contents of the structure in textual form,...
Declares a class that represents any robot's observation.
void getHomogeneousMatrix(mrpt::math::CMatrixDouble44 &out_HM) const
Returns the corresponding 4x4 homogeneous transformation matrix for the point(translation) or pose (t...
GLsizei const GLchar ** string
#define MRPT_THROW_UNKNOWN_SERIALIZATION_VERSION(__V)
For use in CSerializable implementations.
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
TLikelihoodOptions()
Initilization of default parameters.
COctoMapBase(double resolution)
Constructor, defines the resolution of the octomap (length of each voxel side)
virtual void setClampingThresMin(double thresProb)=0
Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST | |