18 #ifndef LSLIDAR_C16_DECODER_H 19 #define LSLIDAR_C16_DECODER_H 21 #define DEG_TO_RAD 0.017453292 22 #define RAD_TO_DEG 57.29577951 27 #include <boost/shared_ptr.hpp> 30 #include <sensor_msgs/PointCloud2.h> 31 #include <sensor_msgs/LaserScan.h> 32 #include <std_msgs/Int8.h> 35 #include <pcl/point_types.h> 37 #include <lslidar_c16_msgs/LslidarC16Packet.h> 38 #include <lslidar_c16_msgs/LslidarC16Point.h> 39 #include <lslidar_c16_msgs/LslidarC16Scan.h> 40 #include <lslidar_c16_msgs/LslidarC16Sweep.h> 41 #include <lslidar_c16_msgs/LslidarC16Layer.h> 58 (DISTANCE_MAX / DISTANCE_RESOLUTION + 1.0);
81 -0.2617993877991494, 0.017453292519943295,
82 -0.22689280275926285, 0.05235987755982989,
83 -0.19198621771937624, 0.08726646259971647,
84 -0.15707963267948966, 0.12217304763960307,
85 -0.12217304763960307, 0.15707963267948966,
86 -0.08726646259971647, 0.19198621771937624,
87 -0.05235987755982989, 0.22689280275926285,
88 -0.017453292519943295, 0.2617993877991494
92 std::cos(scan_altitude[ 0]), std::cos(scan_altitude[ 1]),
93 std::cos(scan_altitude[ 2]), std::cos(scan_altitude[ 3]),
94 std::cos(scan_altitude[ 4]), std::cos(scan_altitude[ 5]),
95 std::cos(scan_altitude[ 6]), std::cos(scan_altitude[ 7]),
96 std::cos(scan_altitude[ 8]), std::cos(scan_altitude[ 9]),
97 std::cos(scan_altitude[10]), std::cos(scan_altitude[11]),
98 std::cos(scan_altitude[12]), std::cos(scan_altitude[13]),
99 std::cos(scan_altitude[14]), std::cos(scan_altitude[15]),
103 std::sin(scan_altitude[ 0]), std::sin(scan_altitude[ 1]),
104 std::sin(scan_altitude[ 2]), std::sin(scan_altitude[ 3]),
105 std::sin(scan_altitude[ 4]), std::sin(scan_altitude[ 5]),
106 std::sin(scan_altitude[ 6]), std::sin(scan_altitude[ 7]),
107 std::sin(scan_altitude[ 8]), std::sin(scan_altitude[ 9]),
108 std::sin(scan_altitude[10]), std::sin(scan_altitude[11]),
109 std::sin(scan_altitude[12]), std::sin(scan_altitude[13]),
110 std::sin(scan_altitude[14]), std::sin(scan_altitude[15]),
122 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
167 bool loadParameters();
172 bool checkPacketValidity(
const RawPacket* packet);
173 void decodePacket(
const RawPacket* packet);
174 void layerCallback(
const std_msgs::Int8Ptr&
msg);
175 void packetCallback(
const lslidar_c16_msgs::LslidarC16PacketConstPtr&
msg);
177 void publishPointCloud();
178 void publishChannelScan();
184 return (distance >= min_range && distance <= max_range);
190 return static_cast<double>(raw_azimuth) / 100.0 *
DEG_TO_RAD;
194 point_struct getMeans(std::vector<point_struct> clusters);
212 double cos_azimuth_table[6300];
213 double sin_azimuth_table[6300];
251 (
float, x, x)(
float, y, y)(
float, z, z)(
static const double DISTANCE_RESOLUTION
uint16_t rotation
0-35999, divide by 100 to get degrees
static const int PACKET_STATUS_SIZE
LslidarC16Decoder::LslidarC16DecoderConstPtr LslidarC16DecoderConstPtr
sensor_msgs::PointCloud2 point_cloud_data
double angle3_disable_min
pcl::PointCloud< VPoint > VPointCloud
ROSCONSOLE_DECL void initialize()
static const double DISTANCE_MAX
bool isPointInRange(const double &distance)
static const int FIRINGS_PER_BLOCK
static const int BLOCK_DATA_SIZE
TFSIMD_FORCE_INLINE tfScalar distance(const Vector3 &v) const
ros::Publisher point_cloud_pub
boost::shared_ptr< const LslidarC16Decoder > LslidarC16DecoderConstPtr
static const double cos_scan_altitude[16]
static const int FIRINGS_PER_PACKET
static const double FIRING_TOFFSET
static const double DISTANCE_MAX_UNITS
double rawAzimuthToDouble(const uint16_t &raw_azimuth)
static const int SCANS_PER_BLOCK
lslidar_c16_msgs::LslidarC16LayerPtr multi_scan
static const uint16_t LOWER_BANK
boost::shared_ptr< LslidarC16Decoder > LslidarC16DecoderPtr
static const double scan_altitude[16]
static const int RAW_SCAN_SIZE
lslidar_c16_msgs::LslidarC16SweepPtr sweep_data
static const int SCANS_PER_FIRING
static const int SCANS_PER_PACKET
static const double BLOCK_TDURATION
struct lslidar_c16_decoder::PointXYZIT EIGEN_ALIGN16
static const double sin_scan_altitude[16]
LslidarC16Decoder::LslidarC16DecoderPtr LslidarC16DecoderPtr
static const double DSR_TOFFSET
double angle3_disable_max
uint16_t header
UPPER_BANK or LOWER_BANK.
static const int BLOCKS_PER_PACKET
ros::Publisher channel_scan_pub
static const int PACKET_SIZE
ros::Subscriber layer_sub
PCL_ADD_POINT4D uint8_t intensity
static const uint16_t UPPER_BANK
ros::Subscriber packet_sub
static const int SIZE_BLOCK