27 double *previous_packet_stamp,
28 uint64_t *gps_base_usec) {
29 if (current_packet_stamp < *previous_packet_stamp) {
32 if (std::abs(*previous_packet_stamp - current_packet_stamp) > 3599000000) {
33 *gps_base_usec +=
static_cast<uint64_t
>(3600 * 1e6);
35 <<
". current:" << current_packet_stamp
36 <<
", last time:" << *previous_packet_stamp;
38 AWARN <<
"Current stamp:" << std::fixed << current_packet_stamp
39 <<
" less than previous stamp:" << *previous_packet_stamp
40 <<
". GPS time stamp maybe incorrect!";
42 }
else if (*previous_packet_stamp != 0 &&
43 current_packet_stamp - *previous_packet_stamp > 100000) {
44 AERROR <<
"Current stamp:" << std::fixed << current_packet_stamp
45 <<
" ahead previous stamp:" << *previous_packet_stamp
46 <<
" over 100ms. GPS time stamp incorrect!";
49 *previous_packet_stamp = current_packet_stamp;
51 *gps_base_usec +
static_cast<uint64_t
>(current_packet_stamp);
53 gps_stamp = gps_stamp * 1000;
59 nan_point.set_timestamp(timestamp);
63 nan_point.set_intensity(0);
68 : last_time_stamp_(0), config_(config), mode_(
STRONGEST) {}
73 double tmp_min_angle = view_direction + view_width / 2;
74 double tmp_max_angle = view_direction - view_width / 2;
77 tmp_min_angle = fmod(fmod(tmp_min_angle, 2 * M_PI) + 2 * M_PI, 2 * M_PI);
78 tmp_max_angle = fmod(fmod(tmp_max_angle, 2 * M_PI) + 2 * M_PI, 2 * M_PI);
82 config_.set_min_angle(100 * (2 * M_PI - tmp_min_angle) * 180 / M_PI + 0.5);
83 config_.set_max_angle(100 * (2 * M_PI - tmp_max_angle) * 180 / M_PI + 0.5);
97 AFATAL <<
"Unable to open calibration file: "
105 ROTATION_RESOLUTION);
130 assert(rotation <= 36000);
139 double cos_rot_angle =
142 double sin_rot_angle =
152 double xx = fabs(xy_distance * sin_rot_angle -
155 double yy = fabs(xy_distance * cos_rot_angle +
161 double distance_corr_x = 0;
162 double distance_corr_y = 0;
171 (yy - 1.93) / 23.11 +
177 double distance_x = raw_distance + distance_corr_x;
183 x = xy_distance * sin_rot_angle -
186 double distance_y = raw_distance + distance_corr_y;
190 y = xy_distance * cos_rot_angle +
198 point->set_x(
static_cast<float>(y));
199 point->set_y(
static_cast<float>(-x));
200 point->set_z(
static_cast<float>(z));
204 Config config = source_config;
206 config.set_calibration_online(
false);
209 config.set_calibration_online(
false);
217 AERROR <<
"invalid model, must be 64E_S2|64E_S3S"
218 <<
"|64E_S3D_STRONGEST|64E_S3D_LAST|64E_S3D_DUAL|HDL32E|VLP16";
void read(const std::string &calibration_file)
static VelodyneParser * CreateParser(Config config)
Velodyne data conversion class
virtual void setup()
Set up for on-line operation.
float cos_rot_table_[ROTATION_MAX_UNITS]
bool is_scan_valid(int rotation, float distance)
uint64_t GetGpsStamp(double current_stamp, double *previous_stamp, uint64_t *gps_base_usec)
PointXYZIT get_nan_point(uint64_t timestamp)
void init_angle_params(double view_direction, double view_width)
bool need_two_pt_correction_
void ComputeCoords(const float &raw_distance, const LaserCorrection &corrections, const uint16_t rotation, PointXYZIT *point)
Compute coords with the data in block
float sin_rot_table_[ROTATION_MAX_UNITS]
void init_sin_cos_rot_table(float *sin_rot_table, float *cos_rot_table, uint16_t rotation, float rotation_resolution)
optional bool calibration_online
optional double view_direction
optional double min_range
optional double view_width
optional double max_range
optional string calibration_file
optional double max_angle
optional double min_angle
correction values for a single laser
float sin_rot_correction
cached sine of rot_correction
float cos_rot_correction
cached values calculated when the calibration file is read
float cos_vert_correction
cached cosine of vert_correction
float vert_offset_correction
float horiz_offset_correction
float sin_vert_correction
cached sine of vert_correction
Velodyne HDL-64E 3D LIDAR data accessors