41#include "pcl/pcl_config.h"
44#include <pcl/io/grabber.h>
45#include <pcl/io/impl/synchronized_queue.hpp>
47#include <pcl/point_cloud.h>
48#include <boost/asio.hpp>
52#define HDL_Grabber_toRadians(x) ((x) * M_PI / 180.0)
102 const std::string& pcapFile =
"");
110 const std::uint16_t port,
111 const std::string& correctionsFile =
"");
147 const std::uint16_t port = 443);
155 const std::uint8_t laserNumber);
161 template<typename IterT>
void
164 std::copy (begin, end, laser_rgb_mapping_);
262 const std::uint16_t endAngle);
265 std::uint16_t azimuth,
271 static double *cos_lookup_table_;
272 static double *sin_lookup_table_;
274 boost::asio::ip::udp::endpoint udp_listener_endpoint_;
275 boost::asio::ip::address source_address_filter_;
276 std::uint16_t source_port_filter_;
277 boost::asio::io_context hdl_read_socket_service_;
278 boost::asio::ip::udp::socket *hdl_read_socket_;
279 std::string pcap_file_name_;
280 std::thread *queue_consumer_thread_;
281 std::thread *hdl_read_packet_thread_;
282 bool terminate_read_packet_thread_;
284 float min_distance_threshold_;
285 float max_distance_threshold_;
290 virtual boost::asio::ip::address
291 getDefaultNetworkAddress ();
294 initialize (
const std::string& correctionsFile =
"");
297 processVelodynePackets ();
300 enqueueHDLPacket (
const std::uint8_t *data,
301 std::size_t bytesReceived);
304 loadCorrectionsFile (
const std::string& correctionsFile);
307 loadHDL32Corrections ();
310 readPacketsFromSocket ();
314 readPacketsFromPcap();
319 isAddressUnspecified (
const boost::asio::ip::address& ip_address);
Grabber()=default
Default ctor.
boost::signals2::signal< sig_cb_velodyne_hdl_scan_point_cloud_xyz > * scan_xyz_signal_
void(const pcl::PointCloud< pcl::PointXYZI >::ConstPtr &, float, float) sig_cb_velodyne_hdl_scan_point_cloud_xyzi
Signal used for a single sector Represents 1 corrected packet from the HDL Velodyne with the returned...
HDLGrabber(const boost::asio::ip::address &ipAddress, const std::uint16_t port, const std::string &correctionsFile="")
Constructor taking a specified IP/port and an optional path to an HDL corrections file.
void setMinimumDistanceThreshold(float &minThreshold)
Any returns from the HDL with a distance less than this are discarded.
pcl::PointCloud< pcl::PointXYZRGBA >::Ptr current_scan_xyzrgba_
void start() override
Starts processing the Velodyne packets, either from the network or PCAP file.
void setLaserColorRGB(const pcl::RGB &color, const std::uint8_t laserNumber)
Allows one to customize the colors used by each laser.
pcl::PointCloud< pcl::PointXYZ >::Ptr current_sweep_xyz_
boost::signals2::signal< sig_cb_velodyne_hdl_sweep_point_cloud_xyz > * sweep_xyz_signal_
~HDLGrabber() noexcept override
virtual Destructor inherited from the Grabber interface.
pcl::PointCloud< pcl::PointXYZI >::Ptr current_scan_xyzi_
virtual std::uint8_t getMaximumNumberOfLasers() const
Returns the maximum number of lasers.
boost::signals2::signal< sig_cb_velodyne_hdl_sweep_point_cloud_xyzrgba > * sweep_xyzrgba_signal_
void computeXYZI(pcl::PointXYZI &pointXYZI, std::uint16_t azimuth, HDLLaserReturn laserReturn, HDLLaserCorrection correction) const
static const std::uint16_t HDL_DATA_PORT
void setMaximumDistanceThreshold(float &maxThreshold)
Any returns from the HDL with a distance greater than this are discarded.
boost::signals2::signal< sig_cb_velodyne_hdl_sweep_point_cloud_xyzi > * sweep_xyzi_signal_
float getMinimumDistanceThreshold()
Returns the current minimum distance threshold, in meters.
void(const pcl::PointCloud< pcl::PointXYZRGBA >::ConstPtr &) sig_cb_velodyne_hdl_sweep_point_cloud_xyzrgba
Signal used for a 360 degree sweep Represents multiple corrected packets from the HDL Velodyne This s...
float getMaximumDistanceThreshold()
Returns the current maximum distance threshold, in meters.
void filterPackets(const boost::asio::ip::address &ipAddress, const std::uint16_t port=443)
Allows one to filter packets based on the SOURCE IP address and PORT This can be used,...
float getFramesPerSecond() const override
Returns the number of frames per second.
void stop() override
Stops processing the Velodyne packets, either from the network or PCAP file.
static const std::uint8_t HDL_FIRING_PER_PKT
void(const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &) sig_cb_velodyne_hdl_sweep_point_cloud_xyz
Signal used for a 360 degree sweep Represents multiple corrected packets from the HDL Velodyne This s...
HDLGrabber(const std::string &correctionsFile="", const std::string &pcapFile="")
Constructor taking an optional path to an HDL corrections file.
bool isRunning() const override
Check if the grabber is still running.
static const std::uint8_t HDL_LASER_PER_FIRING
pcl::PointCloud< pcl::PointXYZRGBA >::Ptr current_sweep_xyzrgba_
pcl::PointCloud< pcl::PointXYZI >::Ptr current_sweep_xyzi_
void(const pcl::PointCloud< pcl::PointXYZI >::ConstPtr &) sig_cb_velodyne_hdl_sweep_point_cloud_xyzi
Signal used for a 360 degree sweep Represents multiple corrected packets from the HDL Velodyne with t...
std::string getName() const override
Obtains the name of this I/O Grabber.
HDLLaserCorrection laser_corrections_[HDL_MAX_NUM_LASERS]
void fireCurrentScan(const std::uint16_t startAngle, const std::uint16_t endAngle)
void(const pcl::PointCloud< pcl::PointXYZ >::ConstPtr &, float, float) sig_cb_velodyne_hdl_scan_point_cloud_xyz
Signal used for a single sector Represents 1 corrected packet from the HDL Velodyne.
pcl::PointCloud< pcl::PointXYZ >::Ptr current_scan_xyz_
static const std::uint8_t HDL_MAX_NUM_LASERS
std::uint16_t last_azimuth_
void(const pcl::PointCloud< pcl::PointXYZRGBA >::ConstPtr &, float, float) sig_cb_velodyne_hdl_scan_point_cloud_xyzrgba
Signal used for a single sector Represents 1 corrected packet from the HDL Velodyne.
boost::signals2::signal< sig_cb_velodyne_hdl_scan_point_cloud_xyzrgba > * scan_xyzrgba_signal_
static const std::uint16_t HDL_NUM_ROT_ANGLES
boost::signals2::signal< sig_cb_velodyne_hdl_scan_point_cloud_xyzi > * scan_xyzi_signal_
shared_ptr< PointCloud< PointT > > Ptr
shared_ptr< const PointCloud< PointT > > ConstPtr
Defines all the PCL implemented PointT point type structures.
Defines all the PCL and non-PCL macros used.
HDLFiringData firingData[HDL_FIRING_PER_PKT]
std::uint32_t gpsTimestamp
HDLLaserReturn laserReturns[HDL_LASER_PER_FIRING]
std::uint16_t blockIdentifier
std::uint16_t rotationalPosition
double cosVertOffsetCorrection
double distanceCorrection
double horizontalOffsetCorrection
double sinVertOffsetCorrection
double verticalOffsetCorrection
double verticalCorrection
A structure representing RGB color information.