class mrpt::hwdrivers::CRoboPeakLidar

Interfaces a Robo Peak LIDAR laser scanner.

See the example “samples/RoboPeakLidar_laser_test” and the application “rawlog-grabber” for a ready-to-use application to gather data from the scanner.

 PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
-------------------------------------------------------
  [supplied_section_name]
   COM_port_WIN = COM3
   COM_port_LIN = ttyS0
   pose_x=0 // Laser range scaner 3D position in the robot (meters)
   pose_y=0
   pose_z=0
   pose_yaw=0   // Angles in degrees
   pose_pitch=0
   pose_roll=0

   //preview = true // Enable GUI visualization of captured data

   // Optional: Exclusion zones to avoid the robot seeing itself:
   //exclusionZone1_x = 0.20 0.30 0.30 0.20
   //exclusionZone1_y = 0.20 0.30 0.30 0.20

   // Optional: Exclusion zones to avoid the robot seeing itself:
   //exclusionAngles1_ini = 20  // Deg
   //exclusionAngles1_end = 25  // Deg

Class introduced in MRPT 1.2.2

#include <mrpt/hwdrivers/CRoboPeakLidar.h>

class CRoboPeakLidar: public mrpt::hwdrivers::C2DRangeFinderAbstract
{
public:
    // construction

    CRoboPeakLidar();

    //
methods

    virtual void initialize();

    virtual void doProcessSimple(
        bool& outThereIsObservation,
        mrpt::obs::CObservation2DRangeScan& outObservation,
        bool& hardwareError
        );

    void setSerialPort(const std::string& port_name);
    const std::string getSerialPort();
    virtual bool turnOn();
    virtual bool turnOff();
    bool getDeviceHealth() const;
    void disconnect();
};

Inherited Members

public:
    // enums

    enum TSensorState;

    // structs

    struct TMsg;

    //
fields

    bool logging_enable_console_output {true};
    bool logging_enable_keep_record {false};

    //
methods

    CGenericSensor& operator = (const CGenericSensor&);
    virtual void doProcess() = 0;
    void logStr(const VerbosityLevel level, std::string_view msg_str) const;
    void logFmt(const VerbosityLevel level, const char* fmt, ...) const;
    void void logCond(const VerbosityLevel level, bool cond, const std::string& msg_str) const;
    void setLoggerName(const std::string& name);
    std::string getLoggerName() const;
    void setVerbosityLevel(const VerbosityLevel level);
    void setVerbosityLevelForCallbacks(const VerbosityLevel level);
    void setMinLoggingLevel(const VerbosityLevel level);
    VerbosityLevel getMinLoggingLevel() const;
    VerbosityLevel getMinLoggingLevelForCallbacks() const;
    void getLogAsString(std::string& log_contents) const;
    std::string getLogAsString() const;
    void writeLogToFile(const std::optional<std::string> fname_in = std::nullopt) const;
    void dumpLogToConsole() const;
    std::string getLoggerLastMsg() const;
    void getLoggerLastMsg(std::string& msg_str) const;
    void loggerReset();
    bool logDeregisterCallback(output_logger_callback_t userFunc);
    void showPreview(bool enable = true);
    void bindIO(const std::shared_ptr<mrpt::io::CStream>& streamIO);
    void getObservation(bool& outThereIsObservation, mrpt::obs::CObservation2DRangeScan& outObservation, bool& hardwareError);
    virtual void doProcess();

    virtual void doProcessSimple(
        bool& outThereIsObservation,
        mrpt::obs::CObservation2DRangeScan& outObservation,
        bool& hardwareError
        ) = 0;

    virtual bool turnOn() = 0;
    virtual bool turnOff() = 0;
    double getEstimatedScanPeriod() const;
    TSensorState getState() const;
    void enableVerbose(bool enabled = true);
    virtual void loadConfig(const mrpt::config::CConfigFileBase& configSource, const std::string& section);
    virtual void initialize();
    virtual TListObservations getObservations();
    virtual void setPathForExternalImages(] const std::string& directory);
    virtual void setExternalImageFormat(const std::string& ext);
    virtual void setExternalImageJPEGQuality(const unsigned int quality);
    static std::array<mrpt::system::ConsoleForegroundColor, NUMBER_OF_VERBOSITY_LEVELS>& logging_levels_to_colors();
    static std::array<std::string, NUMBER_OF_VERBOSITY_LEVELS>& logging_levels_to_names();
    static void registerClass(const TSensorClassId* pNewClass);
    static CGenericSensor* createSensor(const std::string& className);
    static Ptr createSensorPtr(const std::string& className);

Construction

CRoboPeakLidar()

Constructor.

Methods

virtual void initialize()

Attempts to connect and turns the laser on.

Raises an exception on error.

virtual void doProcessSimple(
    bool& outThereIsObservation,
    mrpt::obs::CObservation2DRangeScan& outObservation,
    bool& hardwareError
    )

Specific laser scanner “software drivers” must process here new data from the I/O stream, and, if a whole scan has arrived, return it.

This method MUST BE CALLED in a timely fashion by the user to allow the proccessing of incoming data. It can be run in a different thread safely.

void setSerialPort(const std::string& port_name)

If set to non-empty, the serial port will be attempted to be opened automatically when this class is first used to request data from the laser.

const std::string getSerialPort()

Returns the currently set serial port.

See also:

setSerialPort

virtual bool turnOn()

See base class docs.

virtual bool turnOff()

See base class docs.

bool getDeviceHealth() const

Returns true if the device is connected & operative.

void disconnect()

Closes the comms with the laser.

Shouldn’t have to be directly needed by the user