Go to the documentation of this file.
9 #ifndef opengl_CAngularObservationMesh_H
10 #define opengl_CAngularObservationMesh_H
124 double initial,
double final,
double increment)
127 throw std::logic_error(
"Invalid increment value.");
135 double initial,
double final,
size_t amount)
170 throw std::logic_error(
"Unknown range type.");
189 throw std::logic_error(
"Unknown range type.");
214 throw std::logic_error(
"Unknown range type.");
239 throw std::logic_error(
"Unknown range type.");
255 ? 1 +
static_cast<size_t>(
266 throw std::logic_error(
"Unknown range type.");
273 void values(std::vector<double>& vals)
const;
292 throw std::logic_error(
"Unknown range type.");
306 mutable std::vector<CSetOfTriangles::TTriangle>
triangles;
326 std::vector<mrpt::obs::CObservation2DRangeScan>
scanSet;
399 std::vector<mrpt::obs::CObservation2DRangeScan>& scans)
const;
404 const std::vector<mrpt::obs::CObservation2DRangeScan>& scans);
460 std::vector<char>&
v2)
469 if (
e->traceRay(pNew, dist))
492 std::vector<mrpt::obs::CObservation2DRangeScan>&
vObs;
500 std::vector<mrpt::obs::CObservation2DRangeScan>& obs,
507 std::vector<double> yValues;
513 std::vector<double>
values;
514 std::vector<char> valid;
515 size_t nY = yValues.size();
519 yValues.begin(), yValues.end(),
527 for (
size_t i = 0; i <
values.size(); i++)
549 const TDoubleRange& yaws);
563 std::vector<double> yValues;
567 size_t nV = yaws.
amount();
568 scanValues.reserve(nV);
571 yValues.begin(), yValues.end(),
578 obs.
scan = scanValues;
589 std::vector<double> pValues;
591 std::vector<mrpt::obs::CObservation2DRangeScan> vObs;
592 vObs.reserve(pValues.size());
594 pValues.begin(), pValues.end(),
595 FTrace2D<T>(e, initial, caom, yaws, vObs, initial));
596 caom->mWireframe =
false;
597 caom->mEnableTransparency =
false;
598 caom->setPitchBounds(pValues);
599 caom->setScanSet(vObs);
std::vector< double > pitchBounds
Observation pitch range.
std::shared_ptr< CSetOfLines > Ptr
void setScanRange(const size_t i, const float val)
void generatePointCloud(mrpt::maps::CPointsMap *out_map) const
Returns the scanned points as a 3D point cloud.
float maxRange
The maximum range allowed by the device, in meters (e.g.
size_t amount() const
Returns the total amount of values in this range.
bool rightToLeft
The scanning direction: true=counterclockwise; false=clockwise.
std::vector< mrpt::obs::CObservation2DRangeScan > scanSet
Actual scan set which is used to generate the mesh.
bool isTransparencyEnabled() const
Returns whether the object may be transparent or not.
double initialValue() const
Returns the first value of the range.
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.
std::vector< mrpt::obs::CObservation2DRangeScan > & vObs
A "CObservation"-derived class that represents a 2D range scan measurement (typically from a laser sc...
void operator()(double pitch)
const mrpt::poses::CPose3D & initial
Declares a matrix of booleans (non serializable).
double finalValue() const
Returns the last value of the range.
virtual void render_dl() const override
Renderizes the object.
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).
Union type with the actual data.
A renderizable object suitable for rendering with OpenGL's display lists.
std::vector< char > & valid
static TDoubleRange CreateFromIncrement(double initial, double final, double increment)
Creates a range of values from the initial value, the final value and the increment.
EIGEN_STRONG_INLINE void notifyChange() const
Must be called to notify that the object has changed (so, the display list must be updated)
CAngularObservationMesh()
Basic constructor.
A cloud of points in 2D or 3D, which can be built from a sequence of laser scans or other sensors.
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.
TDoubleRange(double a, double b, size_t c)
Constructor from initial value, final value and amount of samples.
TDoubleRange(double a, double b, double c)
Constructor from initial value, final value and range.
This is the global namespace for all Mobile Robot Programming Toolkit (MRPT) libraries.
double increment() const
Returns the increment between two consecutive values of the range.
std::shared_ptr< CAngularObservationMesh > Ptr
void getScanSet(std::vector< mrpt::obs::CObservation2DRangeScan > &scans) const
Gets the scan set.
void resizeScan(const size_t len)
Resizes all data vectors to allocate a given number of scan rays.
void setScanRangeValidity(const size_t i, const bool val)
CAngularObservationMesh::Ptr & caom
const CAngularObservationMesh::TDoubleRange & yaws
FTrace1D(const T &s, const mrpt::poses::CPose3D &p, std::vector< double > &v, std::vector< char > &v2)
double deltaPitch
If the laser gathers data by sweeping in the pitch/elevation angle, this holds the increment in "pitc...
double aperture() const
Returns the total aperture of the range.
bool setScanSet(const std::vector< mrpt::obs::CObservation2DRangeScan > &scans)
Sets the scan set.
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)
const mrpt::poses::CPose3D & initial
Range specification type, with several uses.
std::vector< CSetOfTriangles::TTriangle > triangles
Actual set of triangles to be displayed.
std::vector< double > & values
void getActualMesh(mrpt::math::CMatrixTemplate< mrpt::math::TPoint3D > &pts, mrpt::math::CMatrixBool &validity) const
Retrieves the full mesh, along with the validity matrix.
void enableTransparency(bool enabled=true)
Enables or disables transparencies.
std::vector< T, mrpt::aligned_allocator_cpp11< T > > aligned_std_vector
bool negToPos() const
Returns the direction of the scan.
char rangeType
Range type.
struct mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::@10 mode0
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 updateMesh() const
Updates the mesh, if needed.
float aperture
The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180 degrees).
struct mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::@12 mode2
GLfloat GLfloat GLfloat v2
virtual ~CAngularObservationMesh()
Empty destructor.
A class used to store a 3D pose (a 3D translation + a rotation in 3D).
bool mEnableTransparency
Whether the object may present transparencies or not.
void setWireframe(bool enabled=true)
Sets the display mode for the object.
A mesh built from a set of 2D laser scan observations.
This class is a "CSerializable" wrapper for "CMatrixBool".
void generateSetOfTriangles(CSetOfTriangles::Ptr &res) const
Gets the mesh as a set of triangles, for displaying them.
GLboolean GLenum GLenum GLvoid * values
std::shared_ptr< CSetOfTriangles > Ptr
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.
bool meshUpToDate
Mutable variable which controls if the object has suffered any change since last time the mesh was up...
const mrpt::poses::CPose3D & pBase
struct mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::@11 mode1
Internal functor class to trace a ray.
Internal functor class to trace a set of rays.
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.
bool mWireframe
Whether the mesh will be displayed wireframe or solid.
mrpt::containers::ContainerReadOnlyProxyAccessor< mrpt::aligned_std_vector< float > > scan
The range values of the scan, in meters.
TDoubleRange(double a, size_t b, bool c)
Constructor from aperture, amount of samples and scan direction.
union mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd rangeData
bool isWireframe() const
Returns whether the object is configured as wireframe or solid.
#define DEFINE_SERIALIZABLE(class_name)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
void setPitchBounds(const double initial, const double final)
Sets the pitch bounds for this range.
void getTracedRays(CSetOfLines::Ptr &res) const
Gets a set of lines containing the traced rays, for displaying them.
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.
void values(std::vector< double > &vals) const
Gets a vector with every value in the range.
mrpt::math::CMatrixB validityMatrix
Scan validity matrix.
void operator()(double yaw)
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
int sign(T x)
Returns the sign of X as "1" or "-1".
mrpt::containers::ContainerReadOnlyProxyAccessor< mrpt::aligned_std_vector< char > > validRange
It's false (=0) on no reflected rays, referenced to elements in scan.
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).
void getPitchBounds(double &initial, double &final) const
Gets the initial and final pitch bounds for this range.
mrpt::math::CMatrixTemplate< mrpt::math::TPoint3D > actualMesh
Mutable object with the mesh's points.
GLubyte GLubyte GLubyte a
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 | |