Main MRPT website > C++ reference for MRPT 1.9.9
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions | Protected Attributes | Private Types | Private Member Functions | Static Private Member Functions | Private Attributes
mrpt::hwdrivers::CLMS100Eth Class Referenceabstract

Detailed Description

This "software driver" implements the communication protocol for interfacing a SICK LMS100 laser scanners through an ethernet controller.

This class does not need to be bind, i.e. you do not need to call C2DRangeFinderAbstract::bindIO. Connection is established when user call the turnOn() method. You can pass to the class's constructor the LMS100 's ip address and port. Device will be configured with the following parameters :

Important note: SICK LMS 1xx devices have two levels of configuration. In its present implementation, this class only handles one of them, so before using this class, you must "pre-configure" your scanner with the SICK's software "SOAP" (this software ships with the device), and set the framerate with this software. Of course, you have to pre-configure the device just once, then save that configuration in its flash memory.

     To get a laser scan you must proceed like that :
     \code
         CLMS200Eth laser(string("192.168.0.10"), 1234);
         laser.turnOn();
         bool isOutObs, hardwareError;
         CObservation2DRangeScan outObs;
         laser.doProcessSimple(isOutObs, outObs, hardwareError);
     \endcode

     The sensor pose on the vehicle could be loaded from an ini configuration

file with :

PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
-------------------------------------------------------
[supplied_section_name]
ip_address = 192.168.0.50 ;a string wich is the SICK's ip adress
*(default is 192.168.0.1)
TCP_port = 1234 ; an integer value : the tcp ip port on wich the
*sick is listening (default is 2111).
pose_x=0.21 ; Laser range scaner 3D position in the robot (meters)
pose_y=0
pose_z=0.34
pose_yaw=0 ; Angles in degrees
pose_pitch=0
pose_roll=0

This class doesn't configure the SICK LMS sensor, it is recomended to configure the sensor via the the SICK software : SOPAS.

Note
This class was contributed by Adrien Barral - Robopec (France)

Definition at line 75 of file CLMS100eth.h.

#include <mrpt/hwdrivers/CLMS100eth.h>

Inheritance diagram for mrpt::hwdrivers::CLMS100Eth:
Inheritance graph

Public Types

enum  TSensorState { ssInitializing = 0, ssWorking, ssError }
 The current state of the sensor. More...
 
using Ptr = std::shared_ptr< CGenericSensor >
 
using TListObservations = std::multimap< mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr >
 
using TListObsPair = std::pair< mrpt::system::TTimeStamp, mrpt::serialization::CSerializable::Ptr >
 

Public Member Functions

 CLMS100Eth (std::string _ip=std::string("192.168.0.1"), unsigned int _port=2111)
 Constructor. More...
 
virtual ~CLMS100Eth ()
 Destructor. More...
 
void doProcessSimple (bool &outThereIsObservation, mrpt::obs::CObservation2DRangeScan &outObservation, bool &hardwareError)
 This function acquire a laser scan from the device. More...
 
bool turnOn ()
 This method must be called before trying to get a laser scan. More...
 
bool turnOff ()
 This method could be called manually to stop communication with the device. More...
 
void setSensorPose (const mrpt::poses::CPose3D &_pose)
 A method to set the sensor pose on the robot. More...
 
void doProcess ()
 This method should be called periodically. More...
 
void initialize ()
 Initialize the sensor according to the parameters previously read in the configuration file. More...
 
void showPreview (bool enable=true)
 Enables GUI visualization in real-time. More...
 
void bindIO (mrpt::io::CStream *streamIO)
 Binds the object to a given I/O channel. More...
 
void getObservation (bool &outThereIsObservation, mrpt::obs::CObservation2DRangeScan &outObservation, bool &hardwareError)
 Get the last observation from the sensor, if available, and unmarks it as being "the last one" (thus a new scan must arrive or subsequent calls will find no new observations). More...
 
virtual const mrpt::hwdrivers::TSensorClassIdGetRuntimeClass () const =0
 
TSensorState getState () const
 The current state of the sensor
More...
 
double getProcessRate () const
 
std::string getSensorLabel () const
 
void setSensorLabel (const std::string &sensorLabel)
 
void enableVerbose (bool enabled=true)
 Enable or disable extra debug info dumped to std::cout during sensor operation. More...
 
bool isVerboseEnabled () const
 
void loadConfig (const mrpt::config::CConfigFileBase &configSource, const std::string &section)
 Loads the generic settings common to any sensor (See CGenericSensor), then call to "loadConfig_sensorSpecific". More...
 
void getObservations (TListObservations &lstObjects)
 Returns a list of enqueued objects, emptying it (thread-safe). More...
 
virtual void setPathForExternalImages (const std::string &directory)
 Set the path where to save off-rawlog image files (will be ignored in those sensors where this is not applicable). More...
 
void setExternalImageFormat (const std::string &ext)
 Set the extension ("jpg","gif","png",...) that determines the format of images saved externally The default is "jpg". More...
 
void setExternalImageJPEGQuality (const unsigned int quality)
 The quality of JPEG compression, when external images is enabled and the format is "jpg". More...
 
unsigned int getExternalImageJPEGQuality () const
 

Static Public Member Functions

static void registerClass (const TSensorClassId *pNewClass)
 Register a class into the internal list of "CGenericSensor" descendents. More...
 
static CGenericSensorcreateSensor (const std::string &className)
 Creates a sensor by a name of the class. More...
 
static CGenericSensor::Ptr createSensorPtr (const std::string &className)
 Just like createSensor, but returning a smart pointer to the newly created sensor object. More...
 

Static Public Attributes

static mrpt::system::TConsoleColor logging_levels_to_colors [NUMBER_OF_VERBOSITY_LEVELS]
 Map from VerbosityLevels to their corresponding mrpt::system::TConsoleColor. More...
 
static std::string logging_levels_to_names [NUMBER_OF_VERBOSITY_LEVELS]
 Map from VerbosityLevels to their corresponding names. More...
 

Protected Member Functions

void loadConfig_sensorSpecific (const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection)
 Load sensor pose on the robot, or keep the default sensor pose. More...
 
void loadCommonParams (const mrpt::config::CConfigFileBase &configSource, const std::string &iniSection)
 Should be call by derived classes at "loadConfig" (loads exclusion areas AND exclusion angles). More...
 
void filterByExclusionAreas (mrpt::obs::CObservation2DRangeScan &obs) const
 Mark as invalid those points which (x,y) coordinates fall within the exclusion polygons. More...
 
void filterByExclusionAngles (mrpt::obs::CObservation2DRangeScan &obs) const
 Mark as invalid those ranges in a set of forbiden angle ranges. More...
 
void processPreview (const mrpt::obs::CObservation2DRangeScan &obs)
 Must be called inside the capture method to allow optional GUI preview of scans. More...
 
void appendObservations (const std::vector< mrpt::serialization::CSerializable::Ptr > &obj)
 This method must be called by derived classes to enqueue a new observation in the list to be returned by getObservations. More...
 
void appendObservation (const mrpt::serialization::CSerializable::Ptr &obj)
 Like appendObservations() but for just one observation. More...
 

Protected Attributes

mrpt::io::CStreamm_stream
 The I/O channel (will be nullptr if not bound). More...
 
VerbosityLevel m_min_verbosity_level
 Provided messages with VerbosityLevel smaller than this value shall be ignored. More...
 
size_t m_grab_decimation_counter
 Used when "m_grab_decimation" is enabled. More...
 
TSensorState m_state
 
bool m_verbose
 
std::string m_path_for_external_images
 The path where to save off-rawlog images: empty means save images embedded in the rawlog. More...
 
std::string m_external_images_format
 The extension ("jpg","gif","png",...) that determines the format of images saved externally. More...
 
unsigned int m_external_images_jpeg_quality
 For JPEG images, the quality (default=95%). More...
 

Private Types

using registered_sensor_classes_t = std::map< std::string, const TSensorClassId * >
 Used in registerClass. More...
 

Private Member Functions

void generateCmd (const char *cmd)
 Add the start and end character. More...
 
bool checkIsConnected ()
 
bool decodeLogIn (char *msg)
 
bool decodeScanCfg (std::istringstream &stream)
 
bool decodeScanDataCfg (std::istringstream &stream)
 
bool decodeScan (char *buf, mrpt::obs::CObservation2DRangeScan &outObservation)
 
void sendCommand (const char *cmd)
 
void roughPrint (char *msg)
 
std::string generateStringFromFormat (const char *fmt, va_list argp) const
 Helper method for generating a std::string instance from printf-like arguments. More...
 

Static Private Member Functions

static registered_sensor_classes_tget_registered_sensor_classes ()
 Access to singleton. More...
 

Private Attributes

std::string m_ip
 
unsigned int m_port
 
mrpt::comms::CClientTCPSocket m_client
 
bool m_turnedOn
 
std::string m_cmd
 
bool m_connected
 
unsigned int m_scanFrequency
 
double m_angleResolution
 
double m_startAngle
 
double m_stopAngle
 
mrpt::poses::CPose3D m_sensorPose
 
double m_maxRange
 
double m_beamApperture
 
mrpt::obs::CObservation2DRangeScan m_lastObservation
 
bool m_lastObservationIsNew
 
bool m_hardwareError
 
std::mutex m_csChangeStream
 For being thread-safe. More...
 
std::mutex m_csLastObservation
 
mrpt::obs::CObservation2DRangeScan::Ptr m_nextObservation
 A dynamic object used as buffer in doProcess. More...
 
mrpt::obs::CObservation2DRangeScan::TListExclusionAreasWithRanges m_lstExclusionPolys
 A list of optional exclusion polygons, in coordinates relative to the vehicle, that is, taking into account the "sensorPose". More...
 
std::vector< std::pair< double, double > > m_lstExclusionAngles
 A list of pairs of angles <init,end> such as all sensor ranges falling in those forbiden angles will be marked as invalid. More...
 
bool m_showPreview
 If true, shows a 3D window with a preview of the grabber data. More...
 
mrpt::gui::CDisplayWindow3D::Ptr m_win
 
std::string m_logger_name
 
std::deque< TMsgm_history
 
std::deque< output_logger_callback_t > m_listCallbacks
 
std::mutex m_csObjList
 The critical section for m_objList. More...
 
TListObservations m_objList
 The queue of objects to be returned by getObservations. More...
 

Logging methods

void logStr (const VerbosityLevel level, const std::string &msg_str) const
 Main method to add the specified message string to the logger. More...
 
void logFmt (const VerbosityLevel level, const char *fmt,...) const MRPT_printf_format_check(3
 Alternative logging method, which mimics the printf behavior. More...
 
void void logCond (const VerbosityLevel level, bool cond, const std::string &msg_str) const
 Log the given message only if the condition is satisfied. More...
 
void setLoggerName (const std::string &name)
 Set the name of the COutputLogger instance. More...
 
std::string getLoggerName () const
 Return the name of the COutputLogger instance. More...
 
void setMinLoggingLevel (const VerbosityLevel level)
 Set the minimum logging level for which the incoming logs are going to be taken into account. More...
 
void setVerbosityLevel (const VerbosityLevel level)
 alias of setMinLoggingLevel() More...
 
VerbosityLevel getMinLoggingLevel () const
 
bool isLoggingLevelVisible (VerbosityLevel level) const
 
void getLogAsString (std::string &log_contents) const
 Fill the provided string with the contents of the logger's history in std::string representation. More...
 
std::string getLogAsString () const
 Get the history of COutputLogger instance in a string representation. More...
 
void writeLogToFile (const std::string *fname_in=NULL) const
 Write the contents of the COutputLogger instance to an external file. More...
 
void dumpLogToConsole () const
 Dump the current contents of the COutputLogger instance in the terminal window. More...
 
std::string getLoggerLastMsg () const
 Return the last Tmsg instance registered in the logger history. More...
 
void getLoggerLastMsg (std::string &msg_str) const
 Fill inputtted string with the contents of the last message in history. More...
 
void loggerReset ()
 Reset the contents of the logger instance. More...
 
void logRegisterCallback (output_logger_callback_t userFunc)
 
bool logDeregisterCallback (output_logger_callback_t userFunc)
 
bool logging_enable_console_output
 [Default=true] Set it to false in case you don't want the logged messages to be dumped to the output automatically. More...
 
bool logging_enable_keep_record
 [Default=false] Enables storing all messages into an internal list. More...
 

Member Typedef Documentation

◆ Ptr

using mrpt::hwdrivers::CGenericSensor::Ptr = std::shared_ptr<CGenericSensor>
inherited

Definition at line 73 of file CGenericSensor.h.

◆ registered_sensor_classes_t

Used in registerClass.

Definition at line 124 of file CGenericSensor.h.

◆ TListObservations

Definition at line 77 of file CGenericSensor.h.

◆ TListObsPair

Definition at line 79 of file CGenericSensor.h.

Member Enumeration Documentation

◆ TSensorState

The current state of the sensor.

See also
CGenericSensor::getState
Enumerator
ssInitializing 
ssWorking 
ssError 

Definition at line 84 of file CGenericSensor.h.

Constructor & Destructor Documentation

◆ CLMS100Eth()

CLMS100Eth::CLMS100Eth ( std::string  _ip = std::string("192.168.0.1"),
unsigned int  _port = 2111 
)

Constructor.

Note that there is default arguments, here you can customize IP Adress and TCP Port of your device.

Definition at line 30 of file CLMS100eth.cpp.

References mrpt::system::LVL_DEBUG.

◆ ~CLMS100Eth()

CLMS100Eth::~CLMS100Eth ( )
virtual

Destructor.

Close communcation with the device, and free memory.

Definition at line 44 of file CLMS100eth.cpp.

Member Function Documentation

◆ appendObservation()

void mrpt::hwdrivers::CGenericSensor::appendObservation ( const mrpt::serialization::CSerializable::Ptr obj)
inlineprotectedinherited

◆ appendObservations()

void CGenericSensor::appendObservations ( const std::vector< mrpt::serialization::CSerializable::Ptr > &  obj)
protectedinherited

This method must be called by derived classes to enqueue a new observation in the list to be returned by getObservations.

Passed objects must be created in dynamic memory and a smart pointer passed. Example of creation:

mrpt::obs::CObservationGPS::Ptr o = CObservationGPS::Ptr( new
CObservationGPS() );
o-> .... // Set data

If several observations are passed at once in the vector, they'll be considered as a block regarding the grabbing decimation factor.

Definition at line 53 of file CGenericSensor.cpp.

References CLASS_ID, mrpt::hwdrivers::CGenericSensor::m_csObjList, mrpt::hwdrivers::CGenericSensor::m_grab_decimation, mrpt::hwdrivers::CGenericSensor::m_grab_decimation_counter, mrpt::hwdrivers::CGenericSensor::m_objList, and THROW_EXCEPTION.

Referenced by mrpt::hwdrivers::CGenericSensor::appendObservation(), mrpt::hwdrivers::CNationalInstrumentsDAQ::doProcess(), and mrpt::hwdrivers::CKinect::doProcess().

◆ bindIO()

void C2DRangeFinderAbstract::bindIO ( mrpt::io::CStream streamIO)
inherited

Binds the object to a given I/O channel.

The stream object must not be deleted before the destruction of this class.

See also
comms::CSerialPort

Definition at line 43 of file C2DRangeFinderAbstract.cpp.

References mrpt::hwdrivers::C2DRangeFinderAbstract::m_csChangeStream, and mrpt::hwdrivers::C2DRangeFinderAbstract::m_stream.

Referenced by mrpt::hwdrivers::CHokuyoURG::ensureStreamIsOpen().

◆ checkIsConnected()

bool CLMS100Eth::checkIsConnected ( )
private

Definition at line 87 of file CLMS100eth.cpp.

References MRPT_LOG_ERROR_FMT.

◆ createSensor()

CGenericSensor * CGenericSensor::createSensor ( const std::string className)
staticinherited

Creates a sensor by a name of the class.

Typically the user may want to create a smart pointer around the returned pointer, whis is made with:

Returns
A pointer to a new class, or nullptr if class name is unknown.

Definition at line 103 of file CGenericSensor.cpp.

References mrpt::hwdrivers::CGenericSensor::get_registered_sensor_classes().

Referenced by mrpt::hwdrivers::CGenericSensor::createSensorPtr().

◆ createSensorPtr()

static CGenericSensor::Ptr mrpt::hwdrivers::CGenericSensor::createSensorPtr ( const std::string className)
inlinestaticinherited

Just like createSensor, but returning a smart pointer to the newly created sensor object.

Definition at line 219 of file CGenericSensor.h.

References mrpt::hwdrivers::CGenericSensor::createSensor().

◆ decodeLogIn()

bool mrpt::hwdrivers::CLMS100Eth::decodeLogIn ( char *  msg)
private

◆ decodeScan()

bool CLMS100Eth::decodeScan ( char *  buf,
mrpt::obs::CObservation2DRangeScan outObservation 
)
private

◆ decodeScanCfg()

bool mrpt::hwdrivers::CLMS100Eth::decodeScanCfg ( std::istringstream &  stream)
private

◆ decodeScanDataCfg()

bool mrpt::hwdrivers::CLMS100Eth::decodeScanDataCfg ( std::istringstream &  stream)
private

◆ doProcess()

void CLMS100Eth::doProcess ( )
virtual

This method should be called periodically.

Period depend on the process_rate in the configuration file.

Reimplemented from mrpt::hwdrivers::C2DRangeFinderAbstract.

Definition at line 354 of file CLMS100eth.cpp.

References THROW_EXCEPTION.

◆ doProcessSimple()

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

This function acquire a laser scan from the device.

If an error occured, hardwareError will be set to true. The new laser scan will be stored in the outObservation argument.

Exceptions
Thismethod throw exception if the frame received from the LMS 100 contain the following bad parameters :
  • Status is not OK
  • Data in the scan aren't DIST1 (may be RSSIx or DIST2).

Implements mrpt::hwdrivers::C2DRangeFinderAbstract.

Definition at line 312 of file CLMS100eth.cpp.

References MRPT_LOG_ERROR.

◆ dumpLogToConsole()

void COutputLogger::dumpLogToConsole ( ) const
inherited

Dump the current contents of the COutputLogger instance in the terminal window.

See also
writeToFile

Definition at line 179 of file COutputLogger.cpp.

◆ enableVerbose()

void mrpt::hwdrivers::CGenericSensor::enableVerbose ( bool  enabled = true)
inlineinherited

Enable or disable extra debug info dumped to std::cout during sensor operation.

Default: disabled unless the environment variable "MRPT_HWDRIVERS_VERBOSE" is set to "1" during object creation.

Definition at line 105 of file CGenericSensor.h.

References mrpt::hwdrivers::CGenericSensor::m_verbose.

◆ filterByExclusionAngles()

void C2DRangeFinderAbstract::filterByExclusionAngles ( mrpt::obs::CObservation2DRangeScan obs) const
protectedinherited

◆ filterByExclusionAreas()

void C2DRangeFinderAbstract::filterByExclusionAreas ( mrpt::obs::CObservation2DRangeScan obs) const
protectedinherited

◆ generateCmd()

void CLMS100Eth::generateCmd ( const char *  cmd)
private

Add the start and end character.

Definition at line 222 of file CLMS100eth.cpp.

References mrpt::format(), and MRPT_LOG_ERROR.

◆ generateStringFromFormat()

std::string COutputLogger::generateStringFromFormat ( const char *  fmt,
va_list  argp 
) const
privateinherited

Helper method for generating a std::string instance from printf-like arguments.

Definition at line 99 of file COutputLogger.cpp.

References mrpt::system::os::vsnprintf().

◆ get_registered_sensor_classes()

CGenericSensor::registered_sensor_classes_t & CGenericSensor::get_registered_sensor_classes ( )
staticprivateinherited

◆ getExternalImageJPEGQuality()

unsigned int mrpt::hwdrivers::CGenericSensor::getExternalImageJPEGQuality ( ) const
inlineinherited

◆ getLogAsString() [1/2]

std::string COutputLogger::getLogAsString ( ) const
inherited

Get the history of COutputLogger instance in a string representation.

Definition at line 148 of file COutputLogger.cpp.

Referenced by mrpt::graphslam::deciders::CICPCriteriaNRD< GRAPH_T >::getDescriptiveReport().

◆ getLogAsString() [2/2]

void COutputLogger::getLogAsString ( std::string log_contents) const
inherited

Fill the provided string with the contents of the logger's history in std::string representation.

Definition at line 143 of file COutputLogger.cpp.

◆ getLoggerLastMsg() [1/2]

std::string COutputLogger::getLoggerLastMsg ( ) const
inherited

Return the last Tmsg instance registered in the logger history.

Definition at line 184 of file COutputLogger.cpp.

References mrpt::system::COutputLogger::TMsg::getAsString().

◆ getLoggerLastMsg() [2/2]

void COutputLogger::getLoggerLastMsg ( std::string msg_str) const
inherited

Fill inputtted string with the contents of the last message in history.

Definition at line 190 of file COutputLogger.cpp.

◆ getLoggerName()

std::string COutputLogger::getLoggerName ( ) const
inherited

Return the name of the COutputLogger instance.

See also
setLoggerName

Definition at line 132 of file COutputLogger.cpp.

Referenced by mrpt::system::COutputLogger::TMsg::TMsg().

◆ getMinLoggingLevel()

VerbosityLevel mrpt::system::COutputLogger::getMinLoggingLevel ( ) const
inlineinherited

◆ getObservation()

void C2DRangeFinderAbstract::getObservation ( bool &  outThereIsObservation,
mrpt::obs::CObservation2DRangeScan outObservation,
bool &  hardwareError 
)
inherited

Get the last observation from the sensor, if available, and unmarks it as being "the last one" (thus a new scan must arrive or subsequent calls will find no new observations).

Definition at line 53 of file C2DRangeFinderAbstract.cpp.

References mrpt::hwdrivers::C2DRangeFinderAbstract::m_csLastObservation, mrpt::hwdrivers::C2DRangeFinderAbstract::m_hardwareError, mrpt::hwdrivers::C2DRangeFinderAbstract::m_lastObservation, and mrpt::hwdrivers::C2DRangeFinderAbstract::m_lastObservationIsNew.

◆ getObservations()

void CGenericSensor::getObservations ( TListObservations lstObjects)
inherited

Returns a list of enqueued objects, emptying it (thread-safe).

The objects must be freed by the invoker.

Definition at line 91 of file CGenericSensor.cpp.

References mrpt::hwdrivers::CGenericSensor::m_csObjList, and mrpt::hwdrivers::CGenericSensor::m_objList.

◆ getProcessRate()

double mrpt::hwdrivers::CGenericSensor::getProcessRate ( ) const
inlineinherited

Definition at line 93 of file CGenericSensor.h.

References mrpt::hwdrivers::CGenericSensor::m_process_rate.

◆ GetRuntimeClass()

virtual const mrpt::hwdrivers::TSensorClassId* mrpt::hwdrivers::CGenericSensor::GetRuntimeClass ( ) const
pure virtualinherited

◆ getSensorLabel()

std::string mrpt::hwdrivers::CGenericSensor::getSensorLabel ( ) const
inlineinherited

Definition at line 94 of file CGenericSensor.h.

References mrpt::hwdrivers::CGenericSensor::m_sensorLabel.

◆ getState()

TSensorState mrpt::hwdrivers::CGenericSensor::getState ( ) const
inlineinherited

The current state of the sensor

Definition at line 92 of file CGenericSensor.h.

References mrpt::hwdrivers::CGenericSensor::m_state.

◆ initialize()

void CLMS100Eth::initialize ( )
virtual

Initialize the sensor according to the parameters previously read in the configuration file.

Reimplemented from mrpt::hwdrivers::CGenericSensor.

Definition at line 51 of file CLMS100eth.cpp.

References THROW_EXCEPTION.

◆ isLoggingLevelVisible()

bool mrpt::system::COutputLogger::isLoggingLevelVisible ( VerbosityLevel  level) const
inlineinherited

◆ isVerboseEnabled()

bool mrpt::hwdrivers::CGenericSensor::isVerboseEnabled ( ) const
inlineinherited

Definition at line 106 of file CGenericSensor.h.

References mrpt::hwdrivers::CGenericSensor::m_verbose.

◆ loadCommonParams()

void C2DRangeFinderAbstract::loadCommonParams ( const mrpt::config::CConfigFileBase configSource,
const std::string iniSection 
)
protectedinherited

Should be call by derived classes at "loadConfig" (loads exclusion areas AND exclusion angles).

This loads a sequence of vertices of a polygon given by its (x,y) coordinates relative to the vehicle, that is, taking into account the "sensorPose".

  • exclusionZoneu_x
  • exclusionZoneu_y for u=1,2,3,... All points within the 2D polygon will be ignored, for any Z, unless an optional entry is found:
  • exclusionZoneu_z=[z_min z_max] In that case, only the points within the 2D polygon AND the given range in Z will be ignored.

The number of zones is variable, but they must start at 1 and be consecutive.

This also loads any other common params (e.g. 'preview')

See also
filterByExclusionAreas

Definition at line 98 of file C2DRangeFinderAbstract.cpp.

References ASSERT_, ASSERTMSG_, mrpt::DEG2RAD(), mrpt::format(), mrpt::hwdrivers::C2DRangeFinderAbstract::m_lstExclusionAngles, mrpt::hwdrivers::C2DRangeFinderAbstract::m_lstExclusionPolys, M_PI, mrpt::hwdrivers::C2DRangeFinderAbstract::m_showPreview, mrpt::config::CConfigFileBase::read_bool(), mrpt::config::CConfigFileBase::read_double(), and mrpt::config::CConfigFileBase::read_vector().

Referenced by mrpt::hwdrivers::CSickLaserUSB::loadConfig_sensorSpecific(), mrpt::hwdrivers::CRoboPeakLidar::loadConfig_sensorSpecific(), mrpt::hwdrivers::CSickLaserSerial::loadConfig_sensorSpecific(), and mrpt::hwdrivers::CHokuyoURG::loadConfig_sensorSpecific().

◆ loadConfig()

void CGenericSensor::loadConfig ( const mrpt::config::CConfigFileBase cfg,
const std::string sect 
)
inherited

◆ loadConfig_sensorSpecific()

void CLMS100Eth::loadConfig_sensorSpecific ( const mrpt::config::CConfigFileBase configSource,
const std::string iniSection 
)
protectedvirtual

Load sensor pose on the robot, or keep the default sensor pose.

Implements mrpt::hwdrivers::CGenericSensor.

Definition at line 62 of file CLMS100eth.cpp.

References mrpt::DEG2RAD(), mrpt::config::CConfigFileBase::read_float(), mrpt::config::CConfigFileBase::read_int(), and mrpt::config::CConfigFileBase::read_string().

◆ logCond()

void COutputLogger::logCond ( const VerbosityLevel  level,
bool  cond,
const std::string msg_str 
) const
inherited

Log the given message only if the condition is satisfied.

See also
log, logFmt

Definition at line 120 of file COutputLogger.cpp.

◆ logDeregisterCallback()

bool COutputLogger::logDeregisterCallback ( output_logger_callback_t  userFunc)
inherited
Returns
true if an entry was found and deleted.

Definition at line 287 of file COutputLogger.cpp.

References getAddress().

◆ logFmt()

void COutputLogger::logFmt ( const VerbosityLevel  level,
const char *  fmt,
  ... 
) const
inherited

◆ loggerReset()

void COutputLogger::loggerReset ( )
inherited

Reset the contents of the logger instance.

Called upon construction.

Definition at line 195 of file COutputLogger.cpp.

References mrpt::system::LVL_INFO.

◆ logRegisterCallback()

void COutputLogger::logRegisterCallback ( output_logger_callback_t  userFunc)
inherited

Definition at line 274 of file COutputLogger.cpp.

◆ logStr()

void COutputLogger::logStr ( const VerbosityLevel  level,
const std::string msg_str 
) const
inherited

◆ processPreview()

void C2DRangeFinderAbstract::processPreview ( const mrpt::obs::CObservation2DRangeScan obs)
protectedinherited

◆ registerClass()

void CGenericSensor::registerClass ( const TSensorClassId pNewClass)
staticinherited

Register a class into the internal list of "CGenericSensor" descendents.

Used internally in the macros DEFINE_GENERIC_SENSOR, etc...

Can be used as "CGenericSensor::registerClass( SENSOR_CLASS_ID(CMySensor) );" if building custom sensors outside mrpt libraries in user code.

Definition at line 121 of file CGenericSensor.cpp.

References mrpt::hwdrivers::TSensorClassId::className, and mrpt::hwdrivers::CGenericSensor::get_registered_sensor_classes().

Referenced by mrpt::hwdrivers::CGenericSensor::CLASSINIT_GENERIC_SENSOR::CLASSINIT_GENERIC_SENSOR().

◆ roughPrint()

void mrpt::hwdrivers::CLMS100Eth::roughPrint ( char *  msg)
private

◆ sendCommand()

void CLMS100Eth::sendCommand ( const char *  cmd)
private

Definition at line 213 of file CLMS100eth.cpp.

◆ setExternalImageFormat()

void mrpt::hwdrivers::CGenericSensor::setExternalImageFormat ( const std::string ext)
inlineinherited

Set the extension ("jpg","gif","png",...) that determines the format of images saved externally The default is "jpg".

See also
setPathForExternalImages, setExternalImageJPEGQuality

Definition at line 278 of file CGenericSensor.h.

References mrpt::hwdrivers::CGenericSensor::m_external_images_format.

◆ setExternalImageJPEGQuality()

void mrpt::hwdrivers::CGenericSensor::setExternalImageJPEGQuality ( const unsigned int  quality)
inlineinherited

The quality of JPEG compression, when external images is enabled and the format is "jpg".

See also
setExternalImageFormat

Definition at line 285 of file CGenericSensor.h.

References mrpt::hwdrivers::CGenericSensor::m_external_images_jpeg_quality.

◆ setLoggerName()

void COutputLogger::setLoggerName ( const std::string name)
inherited

◆ setMinLoggingLevel()

void COutputLogger::setMinLoggingLevel ( const VerbosityLevel  level)
inherited

Set the minimum logging level for which the incoming logs are going to be taken into account.

String messages with specified VerbosityLevel smaller than the min, will not be outputted to the screen and neither will a record of them be stored in by the COutputLogger instance

Definition at line 133 of file COutputLogger.cpp.

Referenced by mrpt::maps::CRandomFieldGridMap2D::enableVerbose(), mrpt::math::CLevenbergMarquardtTempl< VECTORTYPE, USERPARAM >::execute(), mrpt::hwdrivers::CHokuyoURG::initialize(), and mrpt::graphslam::deciders::CICPCriteriaNRD< GRAPH_T >::loadParams().

◆ setPathForExternalImages()

virtual void mrpt::hwdrivers::CGenericSensor::setPathForExternalImages ( const std::string directory)
inlinevirtualinherited

Set the path where to save off-rawlog image files (will be ignored in those sensors where this is not applicable).

An empty string (the default value at construction) means to save images embedded in the rawlog, instead of on separate files.

Exceptions
std::exceptionIf the directory doesn't exists and cannot be created.

Reimplemented in mrpt::hwdrivers::CCameraSensor, mrpt::hwdrivers::CKinect, mrpt::hwdrivers::COpenNI2Sensor, mrpt::hwdrivers::COpenNI2_RGBD360, and mrpt::hwdrivers::CSwissRanger3DCamera.

Definition at line 267 of file CGenericSensor.h.

References MRPT_UNUSED_PARAM.

◆ setSensorLabel()

void mrpt::hwdrivers::CGenericSensor::setSensorLabel ( const std::string sensorLabel)
inlineinherited

Definition at line 95 of file CGenericSensor.h.

References mrpt::hwdrivers::CGenericSensor::m_sensorLabel.

◆ setSensorPose()

void CLMS100Eth::setSensorPose ( const mrpt::poses::CPose3D _pose)

A method to set the sensor pose on the robot.

Equivalent to setting the sensor pose via loading it from a config file.

Definition at line 381 of file CLMS100eth.cpp.

◆ setVerbosityLevel()

void COutputLogger::setVerbosityLevel ( const VerbosityLevel  level)
inherited

◆ showPreview()

void mrpt::hwdrivers::C2DRangeFinderAbstract::showPreview ( bool  enable = true)
inlineinherited

Enables GUI visualization in real-time.

Definition at line 120 of file C2DRangeFinderAbstract.h.

References mrpt::hwdrivers::C2DRangeFinderAbstract::m_showPreview.

◆ turnOff()

bool CLMS100Eth::turnOff ( )
virtual

This method could be called manually to stop communication with the device.

Method is also called by destructor.

Implements mrpt::hwdrivers::C2DRangeFinderAbstract.

Definition at line 109 of file CLMS100eth.cpp.

◆ turnOn()

bool CLMS100Eth::turnOn ( )
virtual

This method must be called before trying to get a laser scan.

From the LMS100 datasheet : :

  • Login sMN SetAccessMode 03 F4724744F4724744
  • Set Scanarea and Resolution
  • sMN mLMPsetscancfg
  • SWN LMDscandatacfg 01 00 0 1 0 00 00 0 0 0 0 1
  • SMN mEEwriteall Je ne le fais pas, car ca Ć©crit en mĆ©moire non volatile...
  • Request scan : sRN LMDscandata OR sEN LMDscandata

Implements mrpt::hwdrivers::C2DRangeFinderAbstract.

Definition at line 117 of file CLMS100eth.cpp.

References MRPT_LOG_DEBUG_FMT, and MRPT_LOG_ERROR_FMT.

◆ writeLogToFile()

void COutputLogger::writeLogToFile ( const std::string fname_in = NULL) const
inherited

Write the contents of the COutputLogger instance to an external file.

Upon call to this method, COutputLogger dumps the contents of all the logged commands so far to the specified external file. By default the filename is set to ${LOGGERNAME}.log except if the fname parameter is provided

See also
dumpToConsole, getAsString

Definition at line 154 of file COutputLogger.cpp.

References ASSERTMSG_, and mrpt::format().

Member Data Documentation

◆ logging_enable_console_output

bool mrpt::system::COutputLogger::logging_enable_console_output
inherited

[Default=true] Set it to false in case you don't want the logged messages to be dumped to the output automatically.

Definition at line 239 of file system/COutputLogger.h.

◆ logging_enable_keep_record

bool mrpt::system::COutputLogger::logging_enable_keep_record
inherited

[Default=false] Enables storing all messages into an internal list.

See also
writeLogToFile, getLogAsString

Definition at line 242 of file system/COutputLogger.h.

◆ logging_levels_to_colors

mrpt::system::TConsoleColor COutputLogger::logging_levels_to_colors
staticinherited
Initial value:

Map from VerbosityLevels to their corresponding mrpt::system::TConsoleColor.

Implementation file for the COutputLogger header class.

Handy for coloring the input based on the verbosity of the message

Definition at line 124 of file system/COutputLogger.h.

Referenced by mrpt::system::COutputLogger::TMsg::dumpToConsole().

◆ logging_levels_to_names

std::string COutputLogger::logging_levels_to_names
staticinherited
Initial value:
=
{
"DEBUG",
"INFO ",
"WARN ",
"ERROR"
}

Map from VerbosityLevels to their corresponding names.

Handy for printing the current message VerbosityLevel along with the actual content

Definition at line 129 of file system/COutputLogger.h.

Referenced by mrpt::system::COutputLogger::TMsg::getAsString().

◆ m_angleResolution

double mrpt::hwdrivers::CLMS100Eth::m_angleResolution
private

Definition at line 136 of file CLMS100eth.h.

◆ m_beamApperture

double mrpt::hwdrivers::CLMS100Eth::m_beamApperture
private

Definition at line 141 of file CLMS100eth.h.

◆ m_client

mrpt::comms::CClientTCPSocket mrpt::hwdrivers::CLMS100Eth::m_client
private

Definition at line 131 of file CLMS100eth.h.

◆ m_cmd

std::string mrpt::hwdrivers::CLMS100Eth::m_cmd
private

Definition at line 133 of file CLMS100eth.h.

◆ m_connected

bool mrpt::hwdrivers::CLMS100Eth::m_connected
private

Definition at line 134 of file CLMS100eth.h.

◆ m_csChangeStream

std::mutex mrpt::hwdrivers::C2DRangeFinderAbstract::m_csChangeStream
privateinherited

For being thread-safe.

Definition at line 53 of file C2DRangeFinderAbstract.h.

Referenced by mrpt::hwdrivers::C2DRangeFinderAbstract::bindIO().

◆ m_csLastObservation

std::mutex mrpt::hwdrivers::C2DRangeFinderAbstract::m_csLastObservation
privateinherited

◆ m_csObjList

std::mutex mrpt::hwdrivers::CGenericSensor::m_csObjList
privateinherited

The critical section for m_objList.

Definition at line 118 of file CGenericSensor.h.

Referenced by mrpt::hwdrivers::CGenericSensor::appendObservations(), and mrpt::hwdrivers::CGenericSensor::getObservations().

◆ m_external_images_format

std::string mrpt::hwdrivers::CGenericSensor::m_external_images_format
protectedinherited

The extension ("jpg","gif","png",...) that determines the format of images saved externally.

See also
setPathForExternalImages

Definition at line 157 of file CGenericSensor.h.

Referenced by mrpt::hwdrivers::CSwissRanger3DCamera::getNextObservation(), mrpt::hwdrivers::CSwissRanger3DCamera::loadConfig_sensorSpecific(), and mrpt::hwdrivers::CGenericSensor::setExternalImageFormat().

◆ m_external_images_jpeg_quality

unsigned int mrpt::hwdrivers::CGenericSensor::m_external_images_jpeg_quality
protectedinherited

◆ m_grab_decimation

size_t mrpt::hwdrivers::CGenericSensor::m_grab_decimation
protectedinherited

If set to N>=2, only 1 out of N observations will be saved to m_objList.

Definition at line 138 of file CGenericSensor.h.

Referenced by mrpt::hwdrivers::CGenericSensor::appendObservations(), and mrpt::hwdrivers::CGenericSensor::loadConfig().

◆ m_grab_decimation_counter

size_t mrpt::hwdrivers::CGenericSensor::m_grab_decimation_counter
protectedinherited

Used when "m_grab_decimation" is enabled.

Definition at line 145 of file CGenericSensor.h.

Referenced by mrpt::hwdrivers::CGenericSensor::appendObservations(), and mrpt::hwdrivers::CGenericSensor::loadConfig().

◆ m_hardwareError

bool mrpt::hwdrivers::C2DRangeFinderAbstract::m_hardwareError
privateinherited

◆ m_history

std::deque<TMsg> mrpt::system::COutputLogger::m_history
mutableprivateinherited

Definition at line 312 of file system/COutputLogger.h.

◆ m_ip

std::string mrpt::hwdrivers::CLMS100Eth::m_ip
private

Definition at line 129 of file CLMS100eth.h.

◆ m_lastObservation

mrpt::obs::CObservation2DRangeScan mrpt::hwdrivers::C2DRangeFinderAbstract::m_lastObservation
privateinherited

◆ m_lastObservationIsNew

bool mrpt::hwdrivers::C2DRangeFinderAbstract::m_lastObservationIsNew
privateinherited

◆ m_listCallbacks

std::deque<output_logger_callback_t> mrpt::system::COutputLogger::m_listCallbacks
privateinherited

Definition at line 314 of file system/COutputLogger.h.

◆ m_logger_name

std::string mrpt::system::COutputLogger::m_logger_name
privateinherited

Definition at line 310 of file system/COutputLogger.h.

◆ m_lstExclusionAngles

std::vector<std::pair<double, double> > mrpt::hwdrivers::C2DRangeFinderAbstract::m_lstExclusionAngles
privateinherited

A list of pairs of angles <init,end> such as all sensor ranges falling in those forbiden angles will be marked as invalid.

Definition at line 64 of file C2DRangeFinderAbstract.h.

Referenced by mrpt::hwdrivers::C2DRangeFinderAbstract::filterByExclusionAngles(), and mrpt::hwdrivers::C2DRangeFinderAbstract::loadCommonParams().

◆ m_lstExclusionPolys

mrpt::obs::CObservation2DRangeScan::TListExclusionAreasWithRanges mrpt::hwdrivers::C2DRangeFinderAbstract::m_lstExclusionPolys
privateinherited

A list of optional exclusion polygons, in coordinates relative to the vehicle, that is, taking into account the "sensorPose".

Definition at line 61 of file C2DRangeFinderAbstract.h.

Referenced by mrpt::hwdrivers::C2DRangeFinderAbstract::filterByExclusionAreas(), and mrpt::hwdrivers::C2DRangeFinderAbstract::loadCommonParams().

◆ m_max_queue_len

size_t mrpt::hwdrivers::CGenericSensor::m_max_queue_len
protectedinherited

See CGenericSensor.

Definition at line 135 of file CGenericSensor.h.

Referenced by mrpt::hwdrivers::CGenericSensor::loadConfig().

◆ m_maxRange

double mrpt::hwdrivers::CLMS100Eth::m_maxRange
private

Definition at line 140 of file CLMS100eth.h.

◆ m_min_verbosity_level

VerbosityLevel mrpt::system::COutputLogger::m_min_verbosity_level
protectedinherited

Provided messages with VerbosityLevel smaller than this value shall be ignored.

Definition at line 252 of file system/COutputLogger.h.

Referenced by mrpt::system::COutputLogger::getMinLoggingLevel(), and mrpt::system::COutputLogger::isLoggingLevelVisible().

◆ m_nextObservation

mrpt::obs::CObservation2DRangeScan::Ptr mrpt::hwdrivers::C2DRangeFinderAbstract::m_nextObservation
privateinherited

A dynamic object used as buffer in doProcess.

Definition at line 56 of file C2DRangeFinderAbstract.h.

Referenced by mrpt::hwdrivers::C2DRangeFinderAbstract::doProcess().

◆ m_objList

TListObservations mrpt::hwdrivers::CGenericSensor::m_objList
privateinherited

◆ m_path_for_external_images

std::string mrpt::hwdrivers::CGenericSensor::m_path_for_external_images
protectedinherited

The path where to save off-rawlog images: empty means save images embedded in the rawlog.

Definition at line 154 of file CGenericSensor.h.

Referenced by mrpt::hwdrivers::CSwissRanger3DCamera::getNextObservation(), and mrpt::hwdrivers::CSwissRanger3DCamera::setPathForExternalImages().

◆ m_port

unsigned int mrpt::hwdrivers::CLMS100Eth::m_port
private

Definition at line 130 of file CLMS100eth.h.

◆ m_process_rate

double mrpt::hwdrivers::CGenericSensor::m_process_rate
protectedinherited

◆ m_scanFrequency

unsigned int mrpt::hwdrivers::CLMS100Eth::m_scanFrequency
private

Definition at line 135 of file CLMS100eth.h.

◆ m_sensorLabel

std::string mrpt::hwdrivers::CGenericSensor::m_sensorLabel
protectedinherited

See CGenericSensor.

Definition at line 140 of file CGenericSensor.h.

Referenced by mrpt::hwdrivers::CCANBusReader::CCANBusReader(), mrpt::hwdrivers::CGPSInterface::CGPSInterface(), mrpt::hwdrivers::CGyroKVHDSP3000::CGyroKVHDSP3000(), mrpt::hwdrivers::CHokuyoURG::CHokuyoURG(), mrpt::hwdrivers::CIMUIntersense::CIMUIntersense(), mrpt::hwdrivers::CIMUXSens::CIMUXSens(), mrpt::hwdrivers::CIMUXSens_MT4::CIMUXSens_MT4(), mrpt::hwdrivers::CKinect::CKinect(), mrpt::hwdrivers::CNationalInstrumentsDAQ::CNationalInstrumentsDAQ(), mrpt::hwdrivers::CRoboPeakLidar::CRoboPeakLidar(), mrpt::hwdrivers::CSickLaserSerial::CSickLaserSerial(), mrpt::hwdrivers::CSickLaserUSB::CSickLaserUSB(), mrpt::hwdrivers::CSkeletonTracker::CSkeletonTracker(), mrpt::hwdrivers::CSwissRanger3DCamera::CSwissRanger3DCamera(), mrpt::hwdrivers::CVelodyneScanner::CVelodyneScanner(), mrpt::hwdrivers::CIMUXSens_MT4::doProcess(), mrpt::hwdrivers::CIMUXSens::doProcess(), mrpt::hwdrivers::CGyroKVHDSP3000::doProcess(), mrpt::hwdrivers::CIMUIntersense::doProcess(), mrpt::hwdrivers::CSkeletonTracker::doProcess(), mrpt::hwdrivers::CRoboPeakLidar::doProcessSimple(), mrpt::hwdrivers::CSickLaserUSB::doProcessSimple(), mrpt::hwdrivers::CCANBusReader::doProcessSimple(), mrpt::hwdrivers::CSickLaserSerial::doProcessSimple(), mrpt::hwdrivers::CHokuyoURG::doProcessSimple(), mrpt::hwdrivers::CGPSInterface::flushParsedMessagesNow(), mrpt::hwdrivers::CSwissRanger3DCamera::getNextObservation(), mrpt::hwdrivers::CKinect::getNextObservation(), mrpt::hwdrivers::CVelodyneScanner::getNextObservation(), mrpt::hwdrivers::CGenericSensor::getSensorLabel(), mrpt::hwdrivers::CNationalInstrumentsDAQ::grabbing_thread(), mrpt::hwdrivers::CGenericSensor::loadConfig(), mrpt::hwdrivers::CSkeletonTracker::processPreview(), mrpt::hwdrivers::C2DRangeFinderAbstract::processPreview(), mrpt::hwdrivers::CSkeletonTracker::processPreviewNone(), and mrpt::hwdrivers::CGenericSensor::setSensorLabel().

◆ m_sensorPose

mrpt::poses::CPose3D mrpt::hwdrivers::CLMS100Eth::m_sensorPose
private

Definition at line 139 of file CLMS100eth.h.

◆ m_showPreview

bool mrpt::hwdrivers::C2DRangeFinderAbstract::m_showPreview
privateinherited

◆ m_startAngle

double mrpt::hwdrivers::CLMS100Eth::m_startAngle
private

Definition at line 137 of file CLMS100eth.h.

◆ m_state

TSensorState mrpt::hwdrivers::CGenericSensor::m_state
protectedinherited

◆ m_stopAngle

double mrpt::hwdrivers::CLMS100Eth::m_stopAngle
private

Definition at line 138 of file CLMS100eth.h.

◆ m_stream

mrpt::io::CStream* mrpt::hwdrivers::C2DRangeFinderAbstract::m_stream
protectedinherited

◆ m_turnedOn

bool mrpt::hwdrivers::CLMS100Eth::m_turnedOn
private

Definition at line 132 of file CLMS100eth.h.

◆ m_verbose

bool mrpt::hwdrivers::CGenericSensor::m_verbose
protectedinherited

◆ m_win

mrpt::gui::CDisplayWindow3D::Ptr mrpt::hwdrivers::C2DRangeFinderAbstract::m_win
privateinherited
mrpt::hwdrivers::CGenericSensor::Ptr
std::shared_ptr< CGenericSensor > Ptr
Definition: CGenericSensor.h:73
mrpt::system::COutputLogger::logStr
void logStr(const VerbosityLevel level, const std::string &msg_str) const
Main method to add the specified message string to the logger.
Definition: COutputLogger.cpp:61
mrpt::system::CONCOL_GREEN
@ CONCOL_GREEN
Definition: os.h:179
mrpt::system::CONCOL_BLUE
@ CONCOL_BLUE
Definition: os.h:178
mrpt::system::CONCOL_RED
@ CONCOL_RED
Definition: os.h:180
mrpt::hwdrivers::CGenericSensor::createSensor
static CGenericSensor * createSensor(const std::string &className)
Creates a sensor by a name of the class.
Definition: CGenericSensor.cpp:103
mrpt::system::COutputLogger::logFmt
void logFmt(const VerbosityLevel level, const char *fmt,...) const MRPT_printf_format_check(3
Alternative logging method, which mimics the printf behavior.
Definition: COutputLogger.cpp:80
mrpt::format
std::string format(const char *fmt,...) MRPT_printf_format_check(1
A std::string version of C sprintf.
Definition: format.cpp:16
mrpt::obs::CObservationGPS::Ptr
std::shared_ptr< CObservationGPS > Ptr
Definition: CObservationGPS.h:72
mrpt::hwdrivers::CGenericSensor::appendObservation
void appendObservation(const mrpt::serialization::CSerializable::Ptr &obj)
Like appendObservations() but for just one observation.
Definition: CGenericSensor.h:179
mrpt::system::CONCOL_NORMAL
@ CONCOL_NORMAL
Definition: os.h:177
a
GLubyte GLubyte GLubyte a
Definition: glext.h:6279



Page generated by Doxygen 1.8.17 for MRPT 1.9.9 Git: ad3a9d8ae Tue May 1 23:10:22 2018 -0700 at miƩ 12 jul 2023 10:03:34 CEST