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 CRenderizableShaderPoints,
    public CRenderizableShaderTriangles,
    public CRenderizableShaderWireFrame
{
public:
    // construction

    CPlanarLaserScan();

    // methods

    void render(const RenderContext& rc) const;
    void renderUpdateBuffers() const;
    void freeOpenGLResources();
    virtual shader_list_t requiredShaders() const;
    void onUpdateBuffers_Wireframe();
    void onUpdateBuffers_Triangles();
    void onUpdateBuffers_Points();
    mrpt::math::TPoint3Df getLocalRepresentativePoint() const;
    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);
    auto internalBoundingBoxLocal() 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