Point Cloud Library (PCL)  1.11.0
vlp_grabber.h
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Point Cloud Library (PCL) - www.pointclouds.org
5  * Copyright (c) 2015-, Open Perception, Inc.
6  * Copyright (c) 2015 The MITRE Corporation
7  *
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted provided that the following conditions
12  * are met:
13  *
14  * * Redistributions of source code must retain the above copyright
15  * notice, this list of conditions and the following disclaimer.
16  * * Redistributions in binary form must reproduce the above
17  * copyright notice, this list of conditions and the following
18  * disclaimer in the documentation and/or other materials provided
19  * with the distribution.
20  * * Neither the name of the copyright holder(s) nor the names of its
21  * contributors may be used to endorse or promote products derived
22  * from this software without specific prior written permission.
23  *
24  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
25  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
26  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
27  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
28  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
29  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
30  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
31  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
34  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
35  * POSSIBILITY OF SUCH DAMAGE.
36  *
37  */
38 
39 #pragma once
40 
41 #include "pcl/pcl_config.h"
42 
43 #include <pcl/io/hdl_grabber.h>
44 #include <pcl/io/grabber.h>
45 #include <pcl/point_types.h>
46 #include <pcl/point_cloud.h>
47 #include <boost/asio.hpp>
48 #include <string>
49 
50 namespace pcl
51 {
52 
53  /** \brief Grabber for the Velodyne LiDAR (VLP), based on the Velodyne High Definition Laser (HDL)
54  * \author Keven Ring <keven@mitre.org>
55  * \ingroup io
56  */
58  {
59  public:
60  /** \brief Constructor taking an optional path to an vlp corrections file. The Grabber will listen on the default IP/port for data packets [192.168.3.255/2368]
61  * \param[in] pcapFile Path to a file which contains previously captured data packets. This parameter is optional
62  */
63  VLPGrabber (const std::string& pcapFile = "");
64 
65  /** \brief Constructor taking a specified IP/port
66  * \param[in] ipAddress IP Address that should be used to listen for VLP packets
67  * \param[in] port UDP Port that should be used to listen for VLP packets
68  */
69  VLPGrabber (const boost::asio::ip::address& ipAddress,
70  const std::uint16_t port);
71 
72  /** \brief virtual Destructor inherited from the Grabber interface. It never throws. */
73 
74  ~VLPGrabber () noexcept;
75 
76  /** \brief Obtains the name of this I/O Grabber
77  * \return The name of the grabber
78  */
79  std::string
80  getName () const override;
81 
82  /** \brief Allows one to customize the colors used by each laser.
83  * \param[in] color RGB color to set
84  * \param[in] laserNumber Number of laser to set color
85  */
86  void
87  setLaserColorRGB (const pcl::RGB& color,
88  const std::uint8_t laserNumber);
89 
90  /** \brief Allows one to customize the colors used for each of the lasers.
91  * \param[in] begin begin iterator of RGB color array
92  * \param[in] end end iterator of RGB color array
93  */
94  template<typename IterT> void
95  setLaserColorRGB (const IterT& begin, const IterT& end)
96  {
97  std::copy (begin, end, laser_rgb_mapping_);
98  }
99 
100  /** \brief Returns the maximum number of lasers
101  */
103  getMaximumNumberOfLasers () const override;
104 
105  protected:
106  static const std::uint8_t VLP_MAX_NUM_LASERS = 16;
107  static const std::uint8_t VLP_DUAL_MODE = 0x39;
108 
109  private:
110  pcl::RGB laser_rgb_mapping_[VLP_MAX_NUM_LASERS];
111 
112  void
113  toPointClouds (HDLDataPacket *dataPacket) override;
114 
115  boost::asio::ip::address
116  getDefaultNetworkAddress () override;
117 
118  void
119  initializeLaserMapping ();
120 
121  void
122  loadVLP16Corrections ();
123 
124  };
125 }
pcl::VLPGrabber
Grabber for the Velodyne LiDAR (VLP), based on the Velodyne High Definition Laser (HDL)
Definition: vlp_grabber.h:57
pcl
Definition: convolution.h:46
point_types.h
pcl::uint16_t
std::uint16_t uint16_t
Definition: types.h:56
pcl::HDLGrabber
Grabber for the Velodyne High-Definition-Laser (HDL)
Definition: hdl_grabber.h:61
pcl::HDLGrabber::HDLDataPacket
Definition: hdl_grabber.h:230
pcl::RGB
A structure representing RGB color information.
Definition: point_types.hpp:345
pcl::uint8_t
std::uint8_t uint8_t
Definition: types.h:54
pcl::VLPGrabber::setLaserColorRGB
void setLaserColorRGB(const IterT &begin, const IterT &end)
Allows one to customize the colors used for each of the lasers.
Definition: vlp_grabber.h:95
PCL_EXPORTS
#define PCL_EXPORTS
Definition: pcl_macros.h:331