121 double initial,
double final,
double increment)
124 throw std::logic_error(
"Invalid increment value.");
132 double initial,
double final,
size_t amount)
167 throw std::logic_error(
"Unknown range type.");
186 throw std::logic_error(
"Unknown range type.");
211 throw std::logic_error(
"Unknown range type.");
236 throw std::logic_error(
"Unknown range type.");
252 ? 1 +
static_cast<size_t>(ceil(
262 throw std::logic_error(
"Unknown range type.");
269 void values(std::vector<double>& vals)
const;
288 throw std::logic_error(
"Unknown range type.");
302 mutable std::vector<CSetOfTriangles::TTriangle>
triangles;
322 std::vector<mrpt::obs::CObservation2DRangeScan>
scanSet;
389 std::vector<mrpt::obs::CObservation2DRangeScan>& scans)
const;
394 const std::vector<mrpt::obs::CObservation2DRangeScan>& scans);
450 std::vector<char>&
v2)
459 if (
e->traceRay(pNew, dist))
482 std::vector<mrpt::obs::CObservation2DRangeScan>&
vObs;
490 std::vector<mrpt::obs::CObservation2DRangeScan>& obs,
497 std::vector<double> yValues;
503 std::vector<double>
values;
504 std::vector<char> valid;
505 size_t nY = yValues.size();
509 yValues.begin(), yValues.end(),
517 for (
size_t i = 0; i <
values.size(); i++)
539 const TDoubleRange& yaws);
553 std::vector<double> yValues;
557 size_t nV = yaws.
amount();
558 scanValues.reserve(nV);
561 yValues.begin(), yValues.end(),
568 obs.
scan = scanValues;
579 std::vector<double> pValues;
581 std::vector<mrpt::obs::CObservation2DRangeScan> vObs;
582 vObs.reserve(pValues.size());
584 pValues.begin(), pValues.end(),
585 FTrace2D<T>(e, initial, caom, yaws, vObs, initial));
586 caom->mWireframe =
false;
587 caom->mEnableTransparency =
false;
588 caom->setPitchBounds(pValues);
589 caom->setScanSet(vObs);
void getUntracedRays(CSetOfLines::Ptr &res, double dist) const
Gets a set of lines containing the untraced rays, up to a specified distance, for displaying them...
bool meshUpToDate
Mutable variable which controls if the object has suffered any change since last time the mesh was up...
std::vector< char > & valid
bool negToPos() const
Returns the direction of the scan.
void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated) ...
A mesh built from a set of 2D laser scan observations.
Internal functor class to trace a set of rays.
Internal functor class to trace a ray.
const mrpt::poses::CPose3D & pBase
FTrace2D(const T &s, const mrpt::poses::CPose3D &p, CAngularObservationMesh::Ptr &om, const CAngularObservationMesh::TDoubleRange &y, std::vector< mrpt::obs::CObservation2DRangeScan > &obs, const mrpt::poses::CPose3D &b)
GLboolean GLenum GLenum GLvoid * values
TDoubleRange(double a, size_t b, bool c)
Constructor from aperture, amount of samples and scan direction.
void setScanRange(const size_t i, const float val)
const mrpt::poses::CPose3D & initial
char rangeType
Range type.
bool traceRay(const mrpt::poses::CPose3D &o, double &dist) const override
Traces a ray to the object, returning the distance to a given pose through its X axis.
struct mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::@11 mode1
std::vector< T, mrpt::aligned_allocator_cpp11< T > > aligned_std_vector
std::vector< mrpt::obs::CObservation2DRangeScan > & vObs
bool mEnableTransparency
Whether the object may present transparencies or not.
void setWireframe(bool enabled=true)
Sets the display mode for the object.
void getTracedRays(CSetOfLines::Ptr &res) const
Gets a set of lines containing the traced rays, for displaying them.
bool isTransparencyEnabled() const
Returns whether the object may be transparent or not.
mrpt::containers::ContainerReadOnlyProxyAccessor< mrpt::aligned_std_vector< char > > validRange
It's false (=0) on no reflected rays, referenced to elements in scan.
void getScanSet(std::vector< mrpt::obs::CObservation2DRangeScan > &scans) const
Gets the scan set.
CAngularObservationMesh()
Basic constructor.
void render_dl() const override
Renderizes the object.
void values(std::vector< double > &vals) const
Gets a vector with every value in the range.
float maxRange
The maximum range allowed by the device, in meters (e.g.
A renderizable object suitable for rendering with OpenGL's display lists.
void operator()(double pitch)
double finalValue() const
Returns the last value of the range.
void getPitchBounds(double &initial, double &final) const
Gets the initial and final pitch bounds for this range.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors...
mrpt::math::CMatrixB validityMatrix
Scan validity matrix.
void generateSetOfTriangles(CSetOfTriangles::Ptr &res) const
Gets the mesh as a set of triangles, for displaying them.
mrpt::containers::ContainerReadOnlyProxyAccessor< mrpt::aligned_std_vector< float > > scan
The range values of the scan, in meters.
void getActualMesh(mrpt::math::CMatrixDynamic< mrpt::math::TPoint3D_data > &pts, mrpt::math::CMatrixBool &validity) const
Retrieves the full mesh, along with the validity matrix.
double initialValue() const
Returns the first value of the range.
size_t amount() const
Returns the total amount of values in this range.
FTrace1D(const T &s, const mrpt::poses::CPose3D &p, std::vector< double > &v, std::vector< char > &v2)
struct mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::@10 mode0
double increment() const
Returns the increment between two consecutive values of the range.
std::vector< double > & values
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
static TDoubleRange CreateFromIncrement(double initial, double final, double increment)
Creates a range of values from the initial value, the final value and the increment.
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
static void trace1DSetOfRays(const T &e, const mrpt::poses::CPose3D &initial, mrpt::obs::CObservation2DRangeScan &obs, const TDoubleRange &yaws)
2D ray tracing (will generate a vectorial mesh inside a plane).
~CAngularObservationMesh() override=default
Empty destructor.
static TDoubleRange CreateFromAmount(double initial, double final, size_t amount)
Creates a range of values from the initial value, the final value and a desired amount of samples...
const CAngularObservationMesh::TDoubleRange & yaws
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
bool mWireframe
Whether the mesh will be displayed wireframe or solid.
void resizeScan(const size_t len)
Resizes all data vectors to allocate a given number of scan rays.
void generatePointCloud(mrpt::maps::CPointsMap *out_map) const
Returns the scanned points as a 3D point cloud.
static TDoubleRange CreateFromAperture(double aperture, size_t amount, bool negToPos=true)
Creates a zero-centered range of values from an aperture, an amount of samples and a direction...
void addTriangle(const mrpt::math::TPoint3D &p1, const mrpt::math::TPoint3D &p2, const mrpt::math::TPoint3D &p3) const
Internal method to add a triangle to the mutable mesh.
double deltaPitch
If the laser gathers data by sweeping in the pitch/elevation angle, this holds the increment in "pitc...
The namespace for 3D scene representation and rendering.
union mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd rangeData
float aperture
The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180 degrees)...
double aperture() const
Returns the total aperture of the range.
std::vector< mrpt::obs::CObservation2DRangeScan > scanSet
Actual scan set which is used to generate the mesh.
Range specification type, with several uses.
TDoubleRange(double a, double b, size_t c)
Constructor from initial value, final value and amount of samples.
This class is a "CSerializable" wrapper for "CMatrixBool".
TDoubleRange(double a, double b, double c)
Constructor from initial value, final value and range.
int sign(T x)
Returns the sign of X as "1" or "-1".
mrpt::math::CMatrixDynamic< mrpt::math::TPoint3D_data > actualMesh
Mutable object with the mesh's points.
void updateMesh() const
Updates the mesh, if needed.
CAngularObservationMesh::Ptr & caom
bool setScanSet(const std::vector< mrpt::obs::CObservation2DRangeScan > &scans)
Sets the scan set.
struct mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::@12 mode2
GLfloat GLfloat GLfloat v2
void enableTransparency(bool enabled=true)
Enables or disables transparencies.
void setPitchBounds(const double initial, const double final)
Sets the pitch bounds for this range.
Union type with the actual data.
void operator()(double yaw)
static void trace2DSetOfRays(const T &e, const mrpt::poses::CPose3D &initial, CAngularObservationMesh::Ptr &caom, const TDoubleRange &pitchs, const TDoubleRange &yaws)
2D ray tracing (will generate a 3D mesh).
const mrpt::poses::CPose3D & initial
std::vector< CSetOfTriangles::TTriangle > triangles
Actual set of triangles to be displayed.
GLubyte GLubyte GLubyte a
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
std::vector< double > pitchBounds
Observation pitch range.
bool isWireframe() const
Returns whether the object is configured as wireframe or solid.
bool rightToLeft
The scanning direction: true=counterclockwise; false=clockwise.
void getBoundingBox(mrpt::math::TPoint3D &bb_min, mrpt::math::TPoint3D &bb_max) const override
Evaluates the bounding box of this object (including possible children) in the coordinate frame of th...
void setScanRangeValidity(const size_t i, const bool val)