class mrpt::obs::CObservationRGBD360

Overview

Declares a class derived from “CObservation” that encapsules an omnidirectional RGBD measurement from a set of RGBD sensors.

This kind of observations can carry one or more of these data fields:

  • 3D point cloud (as float’s).

  • 2D range image (as a matrix): Each entry in the matrix “rangeImage(ROW,COLUMN)” contains a distance or a depth (in meters), depending on range_is_depth.

  • 2D intensity (grayscale or RGB) image (as a mrpt::img::CImage): For SwissRanger cameras, a logarithmic A-law compression is used to convert the original 16bit intensity to a more standard 8bit graylevel.

The coordinates of the 3D point cloud are in millimeters with respect to the RGB camera origin of coordinates

The 2D images and matrices are stored as common images, with an up->down rows order and left->right, as usual. Optionally, the intensity and confidence channels can be set to delayed-load images for off-rawlog storage so it saves memory by having loaded in memory just the needed images. See the methods load() and unload(). Due to the intensive storage requirements of this kind of observations, this observation is the only one in MRPT for which it’s recommended to always call “load()” and “unload()” before and after using the observation, ONLY when the observation was read from a rawlog dataset, in order to make sure that all the externally stored data fields are loaded and ready in memory.

Classes that grab observations of this type are:

3D point clouds can be generated at any moment after grabbing with CObservationRGBD360::unprojectInto() and CObservationRGBD360::unprojectInto(), provided the correct calibration parameters.

Starting at serialization version 3 (MRPT 0.9.1+), the 3D point cloud and the rangeImage can both be stored externally to save rawlog space.

Starting at serialization version 5 (MRPT 0.9.5+), the new field range_is_depth

Starting at serialization version 6 (MRPT 0.9.5+), the new field intensityImageChannel

See also:

mrpt::hwdrivers::CSwissRanger3DCamera, mrpt::hwdrivers::COpenNI2_RGBD360, CObservation

#include <mrpt/obs/CObservationRGBD360.h>

class CObservationRGBD360: public mrpt::obs::CObservation
{
public:
    // typedefs

    typedef std::shared_ptr<mrpt::obs ::CObservationRGBD360> Ptr;
    typedef std::shared_ptr<const mrpt::obs ::CObservationRGBD360> ConstPtr;
    typedef std::unique_ptr<mrpt::obs ::CObservationRGBD360> UniquePtr;
    typedef std::unique_ptr<const mrpt::obs ::CObservationRGBD360> ConstUniquePtr;

    // fields

    static constexpr const char* className = "mrpt::obs" "::" "CObservationRGBD360";
    static const unsigned int NUM_SENSORS = 2;
    mrpt::system::TTimeStamp timestamps[NUM_SENSORS];
    bool hasRangeImage {false};
    mrpt::math::CMatrix_u16 rangeImages[NUM_SENSORS];
    float rangeUnits = 0.001f;
    bool hasIntensityImage {false};
    mrpt::img::CImage intensityImages[NUM_SENSORS];
    mrpt::img::TCamera sensorParamss[NUM_SENSORS];
    float maxRange {10.0f};
    mrpt::poses::CPose3D sensorPose;
    float stdError {0.01f};

    // construction

    CObservationRGBD360();

    // methods

    static constexpr auto getClassName();
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    static std::shared_ptr<CObject> CreateObject();

    template <typename... Args>
    static Ptr Create(Args&&... args);

    template <typename Alloc, typename... Args>
    static Ptr CreateAlloc(
        const Alloc& alloc,
        Args&&... args
        );

    template <typename... Args>
    static UniquePtr CreateUnique(Args&&... args);

    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    virtual mrpt::rtti::CObject* clone() const;
    void rangeImage_setSize(const int HEIGHT, const int WIDTH, const unsigned sensor_id);
    virtual mrpt::poses::CPose3D getSensorPose() const;
    virtual void setSensorPose(const mrpt::poses::CPose3D& newSensorPose);
    virtual void getDescriptionAsText(std::ostream& o) const;
};

Inherited Members

public:
    // typedefs

    typedef std::shared_ptr<CObject> Ptr;
    typedef std::shared_ptr<const CObject> ConstPtr;
    typedef std::shared_ptr<CSerializable> Ptr;
    typedef std::shared_ptr<const CSerializable> ConstPtr;
    typedef std::shared_ptr<CObservation> Ptr;
    typedef std::shared_ptr<const CObservation> ConstPtr;

    // fields

    mrpt::system::TTimeStamp timestamp {mrpt::Clock::now()};
    std::string sensorLabel;

    // methods

    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const;
    static const mrpt::rtti::TRuntimeClassId& GetRuntimeClassIdStatic();
    mrpt::system::TTimeStamp getTimeStamp() const;
    virtual mrpt::system::TTimeStamp getOriginalReceivedTimeStamp() const;
    void load() const;
    virtual void unload() const;
    virtual bool exportTxtSupported() const;
    virtual std::string exportTxtHeader() const;
    virtual std::string exportTxtDataRow() const;

    template <class METRICMAP>
    bool insertObservationInto(
        METRICMAP& theMap,
        const std::optional<const mrpt::poses::CPose3D>& robotPose = std::nullopt
        ) const;

    virtual mrpt::poses::CPose3D getSensorPose() const = 0;
    void getSensorPose(mrpt::poses::CPose3D& out_sensorPose) const;
    void getSensorPose(mrpt::math::TPose3D& out_sensorPose) const;
    mrpt::math::TPose3D sensorPose() const;
    virtual void setSensorPose(const mrpt::poses::CPose3D& newSensorPose) = 0;
    void setSensorPose(const mrpt::math::TPose3D& newSensorPose);
    virtual void getDescriptionAsText(std::ostream& o) const;
    virtual std::string asString() const;

Typedefs

typedef std::shared_ptr<mrpt::obs ::CObservationRGBD360> Ptr

A type for the associated smart pointer.

Fields

bool hasRangeImage {false}

true means the field rangeImage contains valid data

mrpt::math::CMatrix_u16 rangeImages[NUM_SENSORS]

If hasRangeImage=true, a matrix of floats with the range data as captured by the camera (in meters)

See also:

range_is_depth

float rangeUnits = 0.001f

Units for integer depth values in rangeImages.

bool hasIntensityImage {false}

true means the field intensityImage contains valid data

mrpt::img::CImage intensityImages[NUM_SENSORS]

If hasIntensityImage=true, a color or gray-level intensity image of the same size than “rangeImage”.

mrpt::img::TCamera sensorParamss[NUM_SENSORS]

Projection parameters of the 8 RGBD sensor.

float maxRange {10.0f}

The maximum range allowed by the device, in meters (e.g.

8.0m, 5.0m,…)

mrpt::poses::CPose3D sensorPose

The 6D pose of the sensor on the robot.

float stdError {0.01f}

The “sigma” error of the device in meters, used while inserting the scan in an occupancy grid.

Construction

CObservationRGBD360()

Default constructor.

Methods

virtual const mrpt::rtti::TRuntimeClassId* GetRuntimeClass() const

Returns information about the class of an object in runtime.

virtual mrpt::rtti::CObject* clone() const

Returns a deep copy (clone) of the object, indepently of its class.

void rangeImage_setSize(
    const int HEIGHT,
    const int WIDTH,
    const unsigned sensor_id
    )

Similar to calling “rangeImage.setSize(H,W)” but this method provides memory pooling to speed-up the memory allocation.

virtual mrpt::poses::CPose3D getSensorPose() const

A general method to retrieve the sensor pose on the robot.

Note that most sensors will return a full (6D) CPose3D, but see the derived classes for more details or special cases.

See also:

setSensorPose A general method to retrieve the sensor pose on the robot, returning it by value.

setSensorPose

virtual void setSensorPose(const mrpt::poses::CPose3D& newSensorPose)

A general method to change the sensor pose on the robot.

Note that most sensors will use the full (6D) CPose3D, but see the derived classes for more details or special cases.

See also:

getSensorPose

virtual void getDescriptionAsText(std::ostream& o) const

Build a detailed, multi-line textual description of the observation contents and dump it to the output stream.

If overried by derived classes, call base CObservation::getDescriptionAsText() first to show common information.

This is the text that appears in RawLogViewer when selecting an object in the dataset