Go to the documentation of this file.
123 double initial,
double final,
double increment)
126 throw std::logic_error(
"Invalid increment value.");
134 double initial,
double final,
size_t amount)
169 throw std::logic_error(
"Unknown range type.");
188 throw std::logic_error(
"Unknown range type.");
213 throw std::logic_error(
"Unknown range type.");
238 throw std::logic_error(
"Unknown range type.");
254 ? 1 +
static_cast<size_t>(ceil(
264 throw std::logic_error(
"Unknown range type.");
271 void values(std::vector<double>& vals)
const;
290 throw std::logic_error(
"Unknown range type.");
325 std::vector<mrpt::obs::CObservation2DRangeScan>
scanSet;
369 void render(
const RenderContext& rc)
const override;
407 std::vector<mrpt::obs::CObservation2DRangeScan>& scans)
const;
412 const std::vector<mrpt::obs::CObservation2DRangeScan>& scans);
468 std::vector<char>& v2)
477 if (
e->traceRay(pNew, dist))
500 std::vector<mrpt::obs::CObservation2DRangeScan>&
vObs;
508 std::vector<mrpt::obs::CObservation2DRangeScan>& obs,
515 std::vector<double> yValues;
521 std::vector<double> values;
522 std::vector<char> valid;
523 size_t nY = yValues.size();
527 yValues.begin(), yValues.end(),
535 for (
size_t i = 0; i < values.size(); i++)
557 const TDoubleRange& yaws);
571 std::vector<double> yValues;
575 size_t nV = yaws.
amount();
576 scanValues.reserve(nV);
579 yValues.begin(), yValues.end(),
586 for (
size_t i = 0; i < nV; i++)
600 std::vector<double> pValues;
602 std::vector<mrpt::obs::CObservation2DRangeScan> vObs;
603 vObs.reserve(pValues.size());
605 pValues.begin(), pValues.end(),
606 FTrace2D<T>(e, initial, caom, yaws, vObs, initial));
607 caom->m_Wireframe =
false;
608 caom->mEnableTransparency =
false;
609 caom->setPitchBounds(pValues);
610 caom->setScanSet(vObs);
std::vector< double > pitchBounds
Observation pitch range.
void setScanRange(const size_t i, const float val)
int sign(T x)
Returns the sign of X as "1" or "-1".
void generatePointCloud(mrpt::maps::CPointsMap *out_map) const
Returns the scanned points as a 3D point cloud.
std::vector< mrpt::opengl::TTriangle > triangles
Actual set of triangles to be displayed.
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.
void onUpdateBuffers_Triangles() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
void notifyChange() const
Call to enable calling renderUpdateBuffers() before the next render() rendering iteration.
bool isTransparencyEnabled() const
Returns whether the object may be transparent or not.
double initialValue() const
Returns the first value of the range.
struct mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::@6 mode0
#define DEFINE_SERIALIZABLE(class_name, NS)
This declaration must be inserted in all CSerializable classes definition, within the class declarati...
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
double finalValue() const
Returns the last value of the range.
void getActualMesh(mrpt::math::CMatrixDynamic< mrpt::math::TPoint3D_data< double >> &pts, mrpt::math::CMatrixBool &validity) const
Retrieves the full mesh, along with the validity matrix.
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).
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.
Union type with the actual data.
Renderizable generic renderer for objects using the wireframe shader.
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.
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.
double increment() const
Returns the increment between two consecutive values of the range.
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)
void freeOpenGLResources() override
Free opengl buffers.
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.
void updateMesh() const
Updates the mesh, if needed.
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
void freeOpenGLResources() override
Free opengl buffers.
Range specification type, with several uses.
std::vector< double > & values
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.
static constexpr shader_id_t WIREFRAME
~CAngularObservationMesh() override=default
Empty destructor.
char rangeType
Range type.
static constexpr shader_id_t TRIANGLES
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...
float aperture
The "aperture" or field-of-view of the range finder, in radians (typically M_PI = 180 degrees).
virtual shader_list_t requiredShaders() const override
Returns the ID of the OpenGL shader program required to render this class.
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.
std::shared_ptr< mrpt::opengl ::CSetOfLines > Ptr
This class is a "CSerializable" wrapper for "CMatrixBool".
void render(const RenderContext &rc) const override
Implements the rendering of 3D objects in each class derived from CRenderizable.
void generateSetOfTriangles(CSetOfTriangles::Ptr &res) const
Gets the mesh as a set of triangles, for displaying them.
std::shared_ptr< mrpt::opengl ::CAngularObservationMesh > Ptr
struct mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::@8 mode2
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.
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
bool setScanSet(const std::vector< mrpt::obs::CObservation2DRangeScan > &scans)
Sets the scan set.
Internal functor class to trace a ray.
Internal functor class to trace a set of rays.
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.
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 onUpdateBuffers_Wireframe() override
Must be implemented in derived classes to update the geometric entities to be drawn in "m_*_buffer" f...
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.
struct mrpt::opengl::CAngularObservationMesh::TDoubleRange::rd::@7 mode1
std::shared_ptr< mrpt::opengl ::CSetOfTriangles > Ptr
std::vector< shader_id_t > shader_list_t
A list of shader IDs.
void freeOpenGLResources() override
Free opengl buffers.
Renderizable generic renderer for objects using the triangles shader.
bool m_Wireframe
Whether the mesh will be displayed wireframe or solid.
mrpt::math::CMatrixB validityMatrix
Scan validity matrix.
void renderUpdateBuffers() const override
Called whenever m_outdatedBuffers is true: used to re-generate OpenGL vertex buffers,...
void operator()(double yaw)
mrpt::poses::CPose3D sensorPose
The 6D pose of the sensor on the robot at the moment of starting the scan.
mrpt::math::CMatrixDynamic< mrpt::math::TPoint3D_data< double > > actualMesh
Mutable object with the mesh's points.
The namespace for 3D scene representation and rendering.
This template class provides the basic functionality for a general 2D any-size, resizable container o...
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.
Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Fri May 29 13:06:46 UTC 2020 | |