30 const size_t size_x = dem_get_size_x();
31 const size_t size_y = dem_get_size_y();
35 for (
size_t x = 0; x < size_x; x++)
36 for (
size_t y = 0; y < size_y; y++)
39 if (dem_get_z_by_cell(x, y, z))
49 mrpt::keep_max<float>(z_max, z);
50 mrpt::keep_min<float>(z_min, z);
66 const double resolution = dem_get_resolution();
68 if (!getMinMaxHeight(z_min, z_max))
return false;
71 const TPlane horz_plane_above(
74 const TPlane horz_plane_below(
90 const double totalDist = Apt.
norm();
91 if (totalDist == 0)
return false;
93 Apt *= resolution * 0.99 / totalDist;
98 const size_t N =
mrpt::round(ceil(totalDist / resolution));
100 for (
size_t i = 0; i < N; i++)
103 const TPoint3D testPt = pt + Apt_half;
106 if (dem_get_z(testPt.
x, testPt.
y, pt_z))
109 if (pt_z >= std::min(pt.
z, pt.
z + Apt.
z) &&
110 pt_z < std::max(pt.
z, pt.
z + Apt.
z))
138 if (robotPose) robotPose3D = (*robotPose);
152 const auto* thePoints =
170 if (!thePointsMoved.
empty())
176 const size_t N = thePointsMoved.
size();
177 for (
size_t i = 0; i < N; i++)
180 thePointsMoved.
getPoint(i, x, y, z);
181 insertIndividualPoint(x, y, z, pt_params);
183 this->dem_update_map();
void getPoint(size_t index, float &x, float &y, float &z) const
Access to a given point from map, as a 2D point.
bool empty() const
STL-like method to check whether the map is empty:
Extra params for insertIndividualPoint()
A CObservation-derived class for RAW DATA (and optionally, point cloud) of scans from 3D Velodyne LID...
void changeCoordinatesReference(const mrpt::poses::CPose2D &b)
Replace each point by (pose compounding operator).
void loadFromVelodyneScan(const mrpt::obs::CObservationVelodyneScan &scan, const mrpt::poses::CPose3D *robotPose=nullptr)
Like loadFromRangeScan() for Velodyne 3D scans.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans. ...
Standard object for storing any 3D lightweight object.
With this struct options are provided to the observation insertion process.
float d2f(const double d)
shortcut for static_cast<float>(double)
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...
This base provides a set of functions for maths stuff.
This namespace contains representation of robot actions and observations.
3D Plane, represented by its equation
#define IS_CLASS(obj, class_name)
True if the given reference to object (derived from mrpt::rtti::CObject) is of the given class...
TPoint3D_< double > TPoint3D
Lightweight 3D point.
bool update_map_after_insertion
(default: true) run any required operation to ensure the map reflects the changes caused by this poin...
Classes for 2D/3D geometry representation, both of single values and probability density distribution...
bool getPoint(TPoint3D &p) const
Gets the content as a point, returning false if the type is not adequate.
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
Declares a class that represents any robot's observation.
bool dem_internal_insertObservation(const mrpt::obs::CObservation &obs, const mrpt::poses::CPose3D *robotPose=nullptr)
Internal method called by internal_insertObservation()
bool intersectLine3D(const mrpt::math::TLine3D &r1, mrpt::math::TObject3D &obj) const
Gets the intersection between a 3D line and a Height Grid map (taking into account the different heig...
T norm() const
Point norm: |v| = sqrt(x^2+y^2+z^2)
bool getMinMaxHeight(float &z_min, float &z_max) const
Computes the minimum and maximum height in the grid.
size_t size() const
Save the point cloud as a PCL PCD file, in either ASCII or binary format.
bool intersect(const TSegment3D &s1, const TSegment3D &s2, TObject3D &obj)
Gets the intersection between two 3D segments.
virtual ~CHeightGridMap2D_Base()
3D line, represented by a base point and a director vector.
int round(const T value)
Returns the closer integer (int) to x.