class mrpt::viz::CPlanarLaserScan

Overview

This object renders a 2D laser scan by means of three elements: the points, the line along end-points and the 2D scanned surface.

By default, all those three elements are drawn, but you can individually switch them on/off with:

To change the final result, more methods allow further customization of the 3D object (color of each element, etc.).

The scan is passed or updated through CPlanarLaserScan::setScan()

The laser points are projected at the sensor pose as given in the “scan” object, so this CPlanarLaserScan object should be placed at the exact pose of the robot coordinates origin.

See also:

mrpt::viz::CPointCloud, viz::Scene

#include <mrpt/viz/CPlanarLaserScan.h>

class CPlanarLaserScan:
    public mrpt::viz::CVisualObject,
    public mrpt::viz::VisualObjectParams_Triangles,
    public mrpt::viz::VisualObjectParams_Lines,
    public mrpt::viz::VisualObjectParams_Points
{
public:
    // construction

    CPlanarLaserScan();

    // methods

    void clear();
    void enablePoints(bool enable = true);
    void enableLine(bool enable = true);
    void enableSurface(bool enable = true);

    void setLineColor(
        float R,
        float G,
        float B,
        float A = 1.0f
        );

    void setPointsColor(
        float R,
        float G,
        float B,
        float A = 1.0f
        );

    void setSurfaceColor(
        float R,
        float G,
        float B,
        float A = 1.0f
        );

    void setScan(const mrpt::obs::CObservation2DRangeScan& scan);
    virtual auto internalBoundingBoxLocal() const;
    virtual auto getLocalRepresentativePoint() const;
};

Inherited Members

public:
    // typedefs

    typedef std::shared_ptr<CObject> Ptr;
    typedef std::shared_ptr<const CObject> ConstPtr;
    typedef std::unique_ptr<CObject> UniquePtr;
    typedef std::unique_ptr<const CObject> ConstUniquePtr;

    // structs

    struct OutdatedState;
    struct State;

    // methods

    const auto& shaderTrianglesBuffer() const;
    auto& shaderTrianglesBufferMutex() const;
    virtual CVisualObject& setColor_u8(const mrpt::img::TColor& c);
    bool isLightEnabled() const;
    void enableLight(bool enable = true);
    TCullFace cullFaces() const;
    void notifyBBoxChange() const;
    auto getBoundingBoxLocalf() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    void setLineWidth(float w);
    float getLineWidth() const;
    void enableAntiAliasing(bool enable = true);
    bool isAntiAliasingEnabled() const;
    const auto& shaderPointsVertexPointBuffer() const;
    const auto& shaderPointsVertexColorBuffer() const;
    auto& shaderPointsBuffersMutex() const;
    float getPointSize() const;
    bool isEnabledVariablePointSize() const;
    float getVariablePointSize_k() const;
    float getVariablePointSize_DepthScale() const;

Methods

void clear()

Clear the scan.

void enablePoints(bool enable = true)

Show or hides the scanned points.

See also:

sePointsWidth, setPointsColor

void enableLine(bool enable = true)

Show or hides lines along all scanned points.

See also:

setLineWidth, setLineColor

void enableSurface(bool enable = true)

Show or hides the scanned area as a 2D surface.

See also:

setSurfaceColor

virtual auto internalBoundingBoxLocal() const

Must be implemented by derived classes to provide the updated bounding box in the object local frame of coordinates.

This will be called only once after each time the derived class reports to notifyChange() that the object geometry changed.

See also:

getBoundingBox(), getBoundingBoxLocal(), getBoundingBoxLocalf()

virtual auto getLocalRepresentativePoint() const

Provide a representative point (in object local coordinates), used to sort objects by eye-distance while rendering with transparencies (Default=[0,0,0])