Main MRPT website > C++ reference for MRPT 1.4.0
List of all members | Classes | 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 | Static Private Attributes
mrpt::hwdrivers::CVelodyneScanner Class Referenceabstract

Detailed Description

A C++ interface to Velodyne laser scanners (HDL-64, HDL-32, VLP-16), working on Windows and Linux.

It can receive data from real devices via an Ethernet connection or parse a WireShark PCAP file for offline processing. The choice of online vs. offline operation is taken upon calling initialize(): if a PCAP input file has been defined, offline operation takes place and network is not listened for incomming packets.

Parsing dual return scans requires a VLP-16 with firmware version 3.0.23 or newer. While converting the scan into a point cloud in mrpt::obs::CObservationVelodyneScan you can select whether to keep the strongest, the last or both laser returns.

XML calibration files are not mandatory for VLP-16 and HDL-32, but they are for HDL-64.

Grabbing live data (as a user)


Grabbing live data (programmatically)


See the source code of the example application [MRPT]/apps/velodyne-view (velodyne-view web page) for more details.

Playing back a PCAP file:


It is common to save Velodyne datasets as Wireshark's PCAP files. These files can be played back with tools like bittwist, which emit all UDP packets in the PCAP log. Then, use this class to receive the packets as if they come from the real sensor.

Alternatively, if MRPT is linked against libpcap, this class can directly parse a PCAP file to simulate reading from a device offline. See method setPCAPInputFile() and config file parameter ``

To compile with PCAP support: In Debian/Ubuntu, install libpcap-dev. In Windows, install WinPCap developer packages + the regular WinPCap driver.

Configuration and usage:


Data is returned as observations of type:

Configuration includes setting the device IP (optional) and sensor model (mandatory only if a calibration file is not provided). These parameters can be set programatically (see methods of this class), or via a configuration file with CGenericSensor::loadConfig() (see example config file section below).

About timestamps:


Each gathered observation of type mrpt::obs::CObservationVelodyneScan is populated with two timestamps, one for the local PC timestamp and, if available, another one for the GPS-stamped timestamp. Refer to the observation docs for details.

Format of parameters for loading from a .ini file


PARAMETERS IN THE ".INI"-LIKE CONFIGURATION STRINGS:
-------------------------------------------------------
[supplied_section_name]
# ---- Sensor description ----
#calibration_file = PUT_HERE_FULL_PATH_TO_CALIB_FILE.xml // Optional but recommended: put here your vendor-provided calibration file
model = VLP16 // Can be any of: `VLP16`, `HDL32`, `HDL64` (It is used to load default calibration file. Parameter not required if `calibration_file` is provided.
#pos_packets_min_period = 0.5 // (Default=0.5 seconds) Minimum period to leave between reporting position packets. Used to decimate the large number of packets of this type.
# How long to wait, after loss of GPS signal, to report timestamps as "not based on satellite time". 30 secs, with typical velodyne clock drifts, means a ~1.7 ms typical drift.
#pos_packets_timing_timeout = 30 // (Default=30 seconds)
# ---- Online operation ----
# IP address of the device. UDP packets from other IPs will be ignored. Leave commented or blank
# if only one scanner is present (no IP filtering)
#device_ip = XXX.XXX.XXX.XXX
# ---- Offline operation ----
# If uncommented, this class will read from the PCAP instead of connecting and listeling
# for online network packets.
# pcap_input = PUT_FULL_PATH_TO_PCAP_LOG_FILE.pcap
# pcap_read_once = false // Do not loop
# pcap_read_fast = false // fast forward skipping non-velodyne packets
# pcap_read_full_scan_delay_ms = 100 // Used to simulate a reasonable number of full scans / second
# pcap_repeat_delay = 0.0 // seconds
# ---- Save to PCAP file ----
# If uncommented, a PCAP file named `[pcap_output_prefix]_[DATE_TIME].pcap` will be
# written simultaneously to the normal operation of this class.
# pcap_output = velodyne_log
# 3D position of the sensor on the vehicle:
pose_x = 0 // 3D position (meters)
pose_y = 0
pose_z = 0
pose_yaw = 0 // 3D orientation (degrees)
pose_pitch = 0
pose_roll = 0

Copyright notice


Portions of this class are based on code from velodyne ROS node in https://github.com/ros-drivers/velodyne Copyright (C) 2007 Austin Robot Technology, Patrick Beeson Copyright (C) 2009, 2010 Austin Robot Technology, Jack O'Quin License: Modified BSD Software License Agreement

Note
New in MRPT 1.4.0

Definition at line 117 of file CVelodyneScanner.h.

#include <mrpt/hwdrivers/CVelodyneScanner.h>

Inheritance diagram for mrpt::hwdrivers::CVelodyneScanner:
Inheritance graph

Classes

struct  TModelProperties
 Hard-wired properties of LIDARs depending on the model. More...
 
struct  TModelPropertiesFactory
 Access to default sets of parameters for Velodyne LIDARs. More...
 

Public Types

enum  model_t { VLP16 = 1 , HDL32 = 2 , HDL64 = 3 }
 LIDAR model types. More...
 
typedef std::map< model_t, TModelPropertiesmodel_properties_list_t
 
enum  TSensorState { ssInitializing = 0 , ssWorking , ssError }
 The current state of the sensor. More...
 
typedef std::multimap< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > TListObservations
 
typedef std::pair< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > TListObsPair
 

Public Member Functions

 CVelodyneScanner ()
 
virtual ~CVelodyneScanner ()
 
bool getNextObservation (mrpt::obs::CObservationVelodyneScanPtr &outScan, mrpt::obs::CObservationGPSPtr &outGPS)
 Polls the UDP port for incoming data packets. More...
 
void doProcess ()
 This method will be invoked at a minimum rate of "process_rate" (Hz) More...
 
virtual void initialize ()
 Tries to initialize the sensor driver, after setting all the parameters with a call to loadConfig. More...
 
void close ()
 Close the UDP sockets set-up in initialize(). More...
 
bool receivePackets (mrpt::system::TTimeStamp &data_pkt_timestamp, mrpt::obs::CObservationVelodyneScan::TVelodyneRawPacket &out_data_pkt, mrpt::system::TTimeStamp &pos_pkt_timestamp, mrpt::obs::CObservationVelodyneScan::TVelodynePositionPacket &out_pos_pkt)
 Users normally would prefer calling getNextObservation() instead. 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::utils::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
 
Change configuration parameters; to be called BEFORE initialize(); see above for the list of parameters and their meaning
void setModelName (const model_t model)
 See supported model names in the general discussion docs for mrpt::hwdrivers::CVelodyneScanner. More...
 
model_t getModelName () const
 
void setPosPacketsMinPeriod (double period_seconds)
 Set the minimum period between the generation of mrpt::obs::CObservationGPS observations from Velodyne Position RMC GPS packets. More...
 
double getPosPacketsMinPeriod () const
 
void setPosPacketsTimingTimeout (double timeout)
 Set how long to wait, after loss of GPS signal, to report timestamps as "not based on satellite time". More...
 
double getPosPacketsTimingTimeout () const
 
void setDeviceIP (const std::string &ip)
 UDP packets from other IPs will be ignored. More...
 
const std::string & getDeviceIP () const
 
void setPCAPVerbosity (const bool verbose)
 Enables/disables PCAP info messages to console (default: true) More...
 
void setPCAPInputFile (const std::string &pcap_file)
 Enables reading from a PCAP file instead of live UDP packet listening. More...
 
const std::string & getPCAPInputFile () const
 
void setPCAPOutputFile (const std::string &out_pcap_file)
 Enables dumping to a PCAP file in parallel to returning regular MRPT objects. More...
 
const std::string & getPCAPOutputFile () const
 
void setPCAPInputFileReadOnce (bool read_once)
 
bool getPCAPInputFileReadOnce () const
 
const mrpt::obs::VelodyneCalibrationgetCalibration () const
 
void setCalibration (const mrpt::obs::VelodyneCalibration &calib)
 
bool loadCalibrationFile (const std::string &velodyne_xml_calib_file_path)
 Returns false on error. More...
 

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 CGenericSensorPtr createSensorPtr (const std::string &className)
 Just like createSensor, but returning a smart pointer to the newly created sensor object. More...
 

Static Public Attributes

static short int VELODYNE_DATA_UDP_PORT
 Default: 2368. Change it if required. More...
 
static short int VELODYNE_POSITION_UDP_PORT
 Default: 8308. Change it if required. More...
 

Protected Member Functions

void loadConfig_sensorSpecific (const mrpt::utils::CConfigFileBase &configSource, const std::string &section)
 See the class documentation at the top for expected parameters. More...
 
void appendObservations (const std::vector< mrpt::utils::CSerializablePtr > &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::utils::CSerializablePtr &obj)
 Like appendObservations() but for just one observation. More...
 

Protected Attributes

bool m_initialized
 
model_t m_model
 Default: "VLP16". More...
 
double m_pos_packets_min_period
 Default: 0.5 seconds. More...
 
double m_pos_packets_timing_timeout
 Default: 30 seconds. More...
 
std::string m_device_ip
 Default: "" (no IP-based filtering) More...
 
bool m_pcap_verbose
 Default: true Output PCAP Info msgs. More...
 
std::string m_pcap_input_file
 Default: "" (do not operate from an offline file) More...
 
std::string m_pcap_output_file
 Default: "" (do not dump to an offline file) More...
 
mrpt::poses::CPose3D m_sensorPose
 
mrpt::obs::VelodyneCalibration m_velodyne_calib
 Device calibration file (supplied by vendor in an XML file) More...
 
mrpt::system::TTimeStamp m_last_pos_packet_timestamp
 
void * m_pcap
 opaque ptr: "pcap_t*" More...
 
void * m_pcap_out
 opaque ptr: "pcap_t*" More...
 
void * m_pcap_dumper
 opaque ptr: "pcap_dumper_t *" More...
 
void * m_pcap_bpf_program
 opaque ptr: bpf_program* More...
 
bool m_pcap_file_empty
 
unsigned int m_pcap_read_count
 number of pkts read from the file so far (for debugging) More...
 
bool m_pcap_read_once
 Default: false. More...
 
bool m_pcap_read_fast
 (Default: false) If false, will use m_pcap_read_full_scan_delay_ms More...
 
double m_pcap_read_full_scan_delay_ms
 (Default:100 ms) delay after each full scan read from a PCAP log More...
 
double m_pcap_repeat_delay
 Default: 0 (in seconds) 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...
 
Common settings to any sensor, loaded in "loadConfig"
double m_process_rate
 See CGenericSensor. More...
 
size_t m_max_queue_len
 See CGenericSensor. More...
 
size_t m_grab_decimation
 If set to N>=2, only 1 out of N observations will be saved to m_objList. More...
 
std::string m_sensorLabel
 See CGenericSensor. More...
 

Private Types

typedef int platform_socket_t
 Handles for the UDP sockets, or INVALID_SOCKET (-1) More...
 

Private Member Functions

bool internal_read_PCAP_packet (mrpt::system::TTimeStamp &data_pkt_time, uint8_t *out_data_buffer, mrpt::system::TTimeStamp &pos_pkt_time, uint8_t *out_pos_buffer)
 

Static Private Member Functions

static mrpt::system::TTimeStamp internal_receive_UDP_packet (platform_socket_t hSocket, uint8_t *out_buffer, const size_t expected_packet_size, const std::string &filter_only_from_IP)
 

Private Attributes

platform_socket_t m_hDataSock
 
platform_socket_t m_hPositionSock
 
mrpt::obs::CObservationVelodyneScanPtr m_rx_scan
 In progress RX scan. More...
 
mrpt::obs::gnss::Message_NMEA_RMC m_last_gps_rmc
 
mrpt::system::TTimeStamp m_last_gps_rmc_age
 
synch::CCriticalSection m_csObjList
 The critical section for m_objList. More...
 
TListObservations m_objList
 The queue of objects to be returned by getObservations. More...
 

Static Private Attributes

static std::map< std::string, const TSensorClassId * > m_knownClasses
 Used in registerClass. More...
 

Member Typedef Documentation

◆ model_properties_list_t

Definition at line 134 of file CVelodyneScanner.h.

◆ platform_socket_t

Handles for the UDP sockets, or INVALID_SOCKET (-1)

Definition at line 261 of file CVelodyneScanner.h.

◆ TListObservations

typedef std::multimap< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > mrpt::hwdrivers::CGenericSensor::TListObservations
inherited

Definition at line 68 of file CGenericSensor.h.

◆ TListObsPair

typedef std::pair< mrpt::system::TTimeStamp, mrpt::utils::CSerializablePtr > mrpt::hwdrivers::CGenericSensor::TListObsPair
inherited

Definition at line 69 of file CGenericSensor.h.

Member Enumeration Documentation

◆ model_t

LIDAR model types.

Enumerator
VLP16 
HDL32 
HDL64 

Definition at line 125 of file CVelodyneScanner.h.

◆ TSensorState

The current state of the sensor.

See also
CGenericSensor::getState
Enumerator
ssInitializing 
ssWorking 
ssError 

Definition at line 74 of file CGenericSensor.h.

Constructor & Destructor Documentation

◆ CVelodyneScanner()

mrpt::hwdrivers::CVelodyneScanner::CVelodyneScanner ( )

◆ ~CVelodyneScanner()

virtual mrpt::hwdrivers::CVelodyneScanner::~CVelodyneScanner ( )
virtual

Member Function Documentation

◆ appendObservation()

void mrpt::hwdrivers::CGenericSensor::appendObservation ( const mrpt::utils::CSerializablePtr &  obj)
inlineprotectedinherited

Like appendObservations() but for just one observation.

Definition at line 146 of file CGenericSensor.h.

◆ appendObservations()

void mrpt::hwdrivers::CGenericSensor::appendObservations ( const std::vector< mrpt::utils::CSerializablePtr > &  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::CObservationGPSPtr o = CObservationGPSPtr( new CObservationGPS() );
o-> .... // Set data
void appendObservation(const mrpt::utils::CSerializablePtr &obj)
Like appendObservations() but for just one observation.
struct OBS_IMPEXP CObservationGPSPtr

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

◆ close()

void mrpt::hwdrivers::CVelodyneScanner::close ( )

Close the UDP sockets set-up in initialize().

This is called automatically upon destruction

◆ createSensor()

static CGenericSensor * mrpt::hwdrivers::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:

static CGenericSensor * createSensor(const std::string &className)
Creates a sensor by a name of the class.
stlplus::smart_ptr< CGenericSensor > CGenericSensorPtr
Returns
A pointer to a new class, or NULL if class name is unknown.

◆ createSensorPtr()

static CGenericSensorPtr 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 179 of file CGenericSensor.h.

◆ doProcess()

void mrpt::hwdrivers::CVelodyneScanner::doProcess ( )
virtual

This method will be invoked at a minimum rate of "process_rate" (Hz)

Exceptions
Thismethod must throw an exception with a descriptive message if some critical error is found.

Implements mrpt::hwdrivers::CGenericSensor.

◆ 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 92 of file CGenericSensor.h.

◆ getCalibration()

const mrpt::obs::VelodyneCalibration & mrpt::hwdrivers::CVelodyneScanner::getCalibration ( ) const
inline

Definition at line 208 of file CVelodyneScanner.h.

◆ getDeviceIP()

const std::string & mrpt::hwdrivers::CVelodyneScanner::getDeviceIP ( ) const
inline

Definition at line 192 of file CVelodyneScanner.h.

◆ getExternalImageJPEGQuality()

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

Definition at line 233 of file CGenericSensor.h.

◆ getModelName()

model_t mrpt::hwdrivers::CVelodyneScanner::getModelName ( ) const
inline

Definition at line 180 of file CVelodyneScanner.h.

◆ getNextObservation()

bool mrpt::hwdrivers::CVelodyneScanner::getNextObservation ( mrpt::obs::CObservationVelodyneScanPtr outScan,
mrpt::obs::CObservationGPSPtr outGPS 
)

Polls the UDP port for incoming data packets.

The user must call this method in a timely fashion to grab data as it it generated by the device. The minimum call rate should be the expected number of data packets/second (!=scans/second). Checkout Velodyne user manual if in doubt.

Parameters
[out]outScanUpon return, an empty smart pointer will be found here if no new data was available. Otherwise, a valid scan.
[out]outGPSUpon return, an empty smart pointer will be found here if no new GPS data was available. Otherwise, a valid GPS reading.
Returns
true if no error ocurred (even if there was no new observation). false if any communication error occurred.

◆ getObservations()

void mrpt::hwdrivers::CGenericSensor::getObservations ( TListObservations lstObjects)
inherited

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

The objects must be freed by the invoker.

◆ getPCAPInputFile()

const std::string & mrpt::hwdrivers::CVelodyneScanner::getPCAPInputFile ( ) const
inline

Definition at line 199 of file CVelodyneScanner.h.

◆ getPCAPInputFileReadOnce()

bool mrpt::hwdrivers::CVelodyneScanner::getPCAPInputFileReadOnce ( ) const
inline

Definition at line 206 of file CVelodyneScanner.h.

◆ getPCAPOutputFile()

const std::string & mrpt::hwdrivers::CVelodyneScanner::getPCAPOutputFile ( ) const
inline

Definition at line 203 of file CVelodyneScanner.h.

◆ getPosPacketsMinPeriod()

double mrpt::hwdrivers::CVelodyneScanner::getPosPacketsMinPeriod ( ) const
inline

Definition at line 184 of file CVelodyneScanner.h.

◆ getPosPacketsTimingTimeout()

double mrpt::hwdrivers::CVelodyneScanner::getPosPacketsTimingTimeout ( ) const
inline

Definition at line 188 of file CVelodyneScanner.h.

◆ getProcessRate()

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

Definition at line 84 of file CGenericSensor.h.

◆ 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 86 of file CGenericSensor.h.

◆ getState()

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

The current state of the sensor

Definition at line 82 of file CGenericSensor.h.

◆ initialize()

virtual void mrpt::hwdrivers::CVelodyneScanner::initialize ( )
virtual

Tries to initialize the sensor driver, after setting all the parameters with a call to loadConfig.

Velodyne specifics: this method sets up the UDP listening sockets, so all relevant params MUST BE SET BEFORE calling this.

Exceptions
Thismethod must throw an exception with a descriptive message if some critical error is found.

Reimplemented from mrpt::hwdrivers::CGenericSensor.

◆ internal_read_PCAP_packet()

bool mrpt::hwdrivers::CVelodyneScanner::internal_read_PCAP_packet ( mrpt::system::TTimeStamp data_pkt_time,
uint8_t out_data_buffer,
mrpt::system::TTimeStamp pos_pkt_time,
uint8_t out_pos_buffer 
)
private

◆ internal_receive_UDP_packet()

static mrpt::system::TTimeStamp mrpt::hwdrivers::CVelodyneScanner::internal_receive_UDP_packet ( platform_socket_t  hSocket,
uint8_t out_buffer,
const size_t  expected_packet_size,
const std::string &  filter_only_from_IP 
)
staticprivate

◆ isVerboseEnabled()

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

Definition at line 93 of file CGenericSensor.h.

◆ loadCalibrationFile()

bool mrpt::hwdrivers::CVelodyneScanner::loadCalibrationFile ( const std::string &  velodyne_xml_calib_file_path)

Returns false on error.

See also
mrpt::obs::VelodyneCalibration::loadFromXMLFile()

◆ loadConfig()

void mrpt::hwdrivers::CGenericSensor::loadConfig ( const mrpt::utils::CConfigFileBase configSource,
const std::string &  section 
)
inherited

Loads the generic settings common to any sensor (See CGenericSensor), then call to "loadConfig_sensorSpecific".

Exceptions
Thismethod throws an exception with a descriptive message if some critical parameter is missing or has an invalid value.

◆ loadConfig_sensorSpecific()

void mrpt::hwdrivers::CVelodyneScanner::loadConfig_sensorSpecific ( const mrpt::utils::CConfigFileBase configSource,
const std::string &  section 
)
protectedvirtual

See the class documentation at the top for expected parameters.

Implements mrpt::hwdrivers::CGenericSensor.

◆ receivePackets()

bool mrpt::hwdrivers::CVelodyneScanner::receivePackets ( mrpt::system::TTimeStamp data_pkt_timestamp,
mrpt::obs::CObservationVelodyneScan::TVelodyneRawPacket out_data_pkt,
mrpt::system::TTimeStamp pos_pkt_timestamp,
mrpt::obs::CObservationVelodyneScan::TVelodynePositionPacket out_pos_pkt 
)

Users normally would prefer calling getNextObservation() instead.

This method polls the UDP data port and returns one Velodyne DATA packet (1206 bytes) and/or one POSITION packet. Refer to Velodyne users manual. Approximate timestamps (based on this computer clock) are returned for each kind of packets, or INVALID_TIMESTAMP if timeout ocurred waiting for a packet.

Returns
true on all ok. false only for pcap reading EOF

◆ registerClass()

static void mrpt::hwdrivers::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.

◆ setCalibration()

void mrpt::hwdrivers::CVelodyneScanner::setCalibration ( const mrpt::obs::VelodyneCalibration calib)
inline

Definition at line 209 of file CVelodyneScanner.h.

◆ setDeviceIP()

void mrpt::hwdrivers::CVelodyneScanner::setDeviceIP ( const std::string &  ip)
inline

UDP packets from other IPs will be ignored.

Default: empty string, means do not filter by IP

Definition at line 191 of file CVelodyneScanner.h.

◆ 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 225 of file CGenericSensor.h.

◆ 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 230 of file CGenericSensor.h.

◆ setModelName()

void mrpt::hwdrivers::CVelodyneScanner::setModelName ( const model_t  model)
inline

See supported model names in the general discussion docs for mrpt::hwdrivers::CVelodyneScanner.

Definition at line 179 of file CVelodyneScanner.h.

◆ 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::COpenNI2_RGBD360, mrpt::hwdrivers::COpenNI2Sensor, and mrpt::hwdrivers::CSwissRanger3DCamera.

Definition at line 216 of file CGenericSensor.h.

References MRPT_UNUSED_PARAM.

◆ setPCAPInputFile()

void mrpt::hwdrivers::CVelodyneScanner::setPCAPInputFile ( const std::string &  pcap_file)
inline

Enables reading from a PCAP file instead of live UDP packet listening.

Definition at line 198 of file CVelodyneScanner.h.

◆ setPCAPInputFileReadOnce()

void mrpt::hwdrivers::CVelodyneScanner::setPCAPInputFileReadOnce ( bool  read_once)
inline

Definition at line 205 of file CVelodyneScanner.h.

◆ setPCAPOutputFile()

void mrpt::hwdrivers::CVelodyneScanner::setPCAPOutputFile ( const std::string &  out_pcap_file)
inline

Enables dumping to a PCAP file in parallel to returning regular MRPT objects.

Default="": no pcap log.

Definition at line 202 of file CVelodyneScanner.h.

◆ setPCAPVerbosity()

void mrpt::hwdrivers::CVelodyneScanner::setPCAPVerbosity ( const bool  verbose)
inline

Enables/disables PCAP info messages to console (default: true)

Definition at line 195 of file CVelodyneScanner.h.

◆ setPosPacketsMinPeriod()

void mrpt::hwdrivers::CVelodyneScanner::setPosPacketsMinPeriod ( double  period_seconds)
inline

Set the minimum period between the generation of mrpt::obs::CObservationGPS observations from Velodyne Position RMC GPS packets.

Definition at line 183 of file CVelodyneScanner.h.

◆ setPosPacketsTimingTimeout()

void mrpt::hwdrivers::CVelodyneScanner::setPosPacketsTimingTimeout ( double  timeout)
inline

Set how long to wait, after loss of GPS signal, to report timestamps as "not based on satellite time".

30 secs, with typical velodyne clock drifts, means a ~1.7 ms typical drift.

Definition at line 187 of file CVelodyneScanner.h.

◆ setSensorLabel()

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

Definition at line 87 of file CGenericSensor.h.

Member Data Documentation

◆ m_csObjList

synch::CCriticalSection mrpt::hwdrivers::CGenericSensor::m_csObjList
privateinherited

The critical section for m_objList.

Definition at line 104 of file CGenericSensor.h.

◆ m_device_ip

std::string mrpt::hwdrivers::CVelodyneScanner::m_device_ip
protected

Default: "" (no IP-based filtering)

Definition at line 146 of file CVelodyneScanner.h.

◆ 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 130 of file CGenericSensor.h.

◆ m_external_images_jpeg_quality

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

For JPEG images, the quality (default=95%).

Definition at line 131 of file CGenericSensor.h.

◆ 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 117 of file CGenericSensor.h.

◆ m_grab_decimation_counter

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

Used when "m_grab_decimation" is enabled.

Definition at line 122 of file CGenericSensor.h.

◆ m_hDataSock

platform_socket_t mrpt::hwdrivers::CVelodyneScanner::m_hDataSock
private

Definition at line 263 of file CVelodyneScanner.h.

◆ m_hPositionSock

platform_socket_t mrpt::hwdrivers::CVelodyneScanner::m_hPositionSock
private

Definition at line 263 of file CVelodyneScanner.h.

◆ m_initialized

bool mrpt::hwdrivers::CVelodyneScanner::m_initialized
protected

Definition at line 142 of file CVelodyneScanner.h.

◆ m_knownClasses

std::map< std::string , const TSensorClassId *> mrpt::hwdrivers::CGenericSensor::m_knownClasses
staticprivateinherited

Used in registerClass.

Definition at line 108 of file CGenericSensor.h.

◆ m_last_gps_rmc

mrpt::obs::gnss::Message_NMEA_RMC mrpt::hwdrivers::CVelodyneScanner::m_last_gps_rmc
private

Definition at line 274 of file CVelodyneScanner.h.

◆ m_last_gps_rmc_age

mrpt::system::TTimeStamp mrpt::hwdrivers::CVelodyneScanner::m_last_gps_rmc_age
private

Definition at line 275 of file CVelodyneScanner.h.

◆ m_last_pos_packet_timestamp

mrpt::system::TTimeStamp mrpt::hwdrivers::CVelodyneScanner::m_last_pos_packet_timestamp
protected

Definition at line 152 of file CVelodyneScanner.h.

◆ m_max_queue_len

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

See CGenericSensor.

Definition at line 116 of file CGenericSensor.h.

◆ m_model

model_t mrpt::hwdrivers::CVelodyneScanner::m_model
protected

Default: "VLP16".

Definition at line 143 of file CVelodyneScanner.h.

◆ m_objList

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

The queue of objects to be returned by getObservations.

Definition at line 105 of file CGenericSensor.h.

◆ 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 129 of file CGenericSensor.h.

◆ m_pcap

void* mrpt::hwdrivers::CVelodyneScanner::m_pcap
protected

opaque ptr: "pcap_t*"

Definition at line 155 of file CVelodyneScanner.h.

◆ m_pcap_bpf_program

void* mrpt::hwdrivers::CVelodyneScanner::m_pcap_bpf_program
protected

opaque ptr: bpf_program*

Definition at line 158 of file CVelodyneScanner.h.

◆ m_pcap_dumper

void* mrpt::hwdrivers::CVelodyneScanner::m_pcap_dumper
protected

opaque ptr: "pcap_dumper_t *"

Definition at line 157 of file CVelodyneScanner.h.

◆ m_pcap_file_empty

bool mrpt::hwdrivers::CVelodyneScanner::m_pcap_file_empty
protected

Definition at line 159 of file CVelodyneScanner.h.

◆ m_pcap_input_file

std::string mrpt::hwdrivers::CVelodyneScanner::m_pcap_input_file
protected

Default: "" (do not operate from an offline file)

Definition at line 148 of file CVelodyneScanner.h.

◆ m_pcap_out

void* mrpt::hwdrivers::CVelodyneScanner::m_pcap_out
protected

opaque ptr: "pcap_t*"

Definition at line 156 of file CVelodyneScanner.h.

◆ m_pcap_output_file

std::string mrpt::hwdrivers::CVelodyneScanner::m_pcap_output_file
protected

Default: "" (do not dump to an offline file)

Definition at line 149 of file CVelodyneScanner.h.

◆ m_pcap_read_count

unsigned int mrpt::hwdrivers::CVelodyneScanner::m_pcap_read_count
protected

number of pkts read from the file so far (for debugging)

Definition at line 160 of file CVelodyneScanner.h.

◆ m_pcap_read_fast

bool mrpt::hwdrivers::CVelodyneScanner::m_pcap_read_fast
protected

(Default: false) If false, will use m_pcap_read_full_scan_delay_ms

Definition at line 162 of file CVelodyneScanner.h.

◆ m_pcap_read_full_scan_delay_ms

double mrpt::hwdrivers::CVelodyneScanner::m_pcap_read_full_scan_delay_ms
protected

(Default:100 ms) delay after each full scan read from a PCAP log

Definition at line 163 of file CVelodyneScanner.h.

◆ m_pcap_read_once

bool mrpt::hwdrivers::CVelodyneScanner::m_pcap_read_once
protected

Default: false.

Definition at line 161 of file CVelodyneScanner.h.

◆ m_pcap_repeat_delay

double mrpt::hwdrivers::CVelodyneScanner::m_pcap_repeat_delay
protected

Default: 0 (in seconds)

Definition at line 164 of file CVelodyneScanner.h.

◆ m_pcap_verbose

bool mrpt::hwdrivers::CVelodyneScanner::m_pcap_verbose
protected

Default: true Output PCAP Info msgs.

Definition at line 147 of file CVelodyneScanner.h.

◆ m_pos_packets_min_period

double mrpt::hwdrivers::CVelodyneScanner::m_pos_packets_min_period
protected

Default: 0.5 seconds.

Definition at line 144 of file CVelodyneScanner.h.

◆ m_pos_packets_timing_timeout

double mrpt::hwdrivers::CVelodyneScanner::m_pos_packets_timing_timeout
protected

Default: 30 seconds.

Definition at line 145 of file CVelodyneScanner.h.

◆ m_process_rate

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

See CGenericSensor.

Definition at line 115 of file CGenericSensor.h.

◆ m_rx_scan

mrpt::obs::CObservationVelodyneScanPtr mrpt::hwdrivers::CVelodyneScanner::m_rx_scan
private

In progress RX scan.

Definition at line 272 of file CVelodyneScanner.h.

◆ m_sensorLabel

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

See CGenericSensor.

Definition at line 118 of file CGenericSensor.h.

◆ m_sensorPose

mrpt::poses::CPose3D mrpt::hwdrivers::CVelodyneScanner::m_sensorPose
protected

Definition at line 150 of file CVelodyneScanner.h.

◆ m_state

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

Definition at line 124 of file CGenericSensor.h.

◆ m_velodyne_calib

mrpt::obs::VelodyneCalibration mrpt::hwdrivers::CVelodyneScanner::m_velodyne_calib
protected

Device calibration file (supplied by vendor in an XML file)

Definition at line 151 of file CVelodyneScanner.h.

◆ m_verbose

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

Definition at line 125 of file CGenericSensor.h.

◆ VELODYNE_DATA_UDP_PORT

short int mrpt::hwdrivers::CVelodyneScanner::VELODYNE_DATA_UDP_PORT
static

Default: 2368. Change it if required.

Definition at line 121 of file CVelodyneScanner.h.

◆ VELODYNE_POSITION_UDP_PORT

short int mrpt::hwdrivers::CVelodyneScanner::VELODYNE_POSITION_UDP_PORT
static

Default: 8308. Change it if required.

Definition at line 122 of file CVelodyneScanner.h.




Page generated by Doxygen 1.9.5 for MRPT 1.4.0 SVN: at Sun Dec 25 21:25:12 UTC 2022