Skip to content

File velodyne_calibration_decoder.hpp

File List > include > nebula_common > velodyne > velodyne_calibration_decoder.hpp

Go to the documentation of this file

#ifndef NEBULA_VELODYNE_CALIBRATION_DECODER_H
#define NEBULA_VELODYNE_CALIBRATION_DECODER_H

#include <yaml-cpp/yaml.h>

#include <cmath>
#include <map>
#include <string>
#include <vector>

namespace nebula::drivers
{
struct VelodyneLaserCorrection
{
  float rot_correction;
  float vert_correction;
  float dist_correction;
  bool two_pt_correction_available;
  float dist_correction_x;
  float dist_correction_y;
  float vert_offset_correction;
  float horiz_offset_correction;
  int max_intensity;
  int min_intensity;
  float focal_distance;
  float focal_slope;

  float cos_rot_correction;   
  float sin_rot_correction;   
  float cos_vert_correction;  
  float sin_vert_correction;  

  int laser_ring;  
};

class VelodyneCalibration
{
public:
  float distance_resolution_m;
  std::map<int, VelodyneLaserCorrection> laser_corrections_map;
  std::vector<VelodyneLaserCorrection> laser_corrections;
  int num_lasers{};
  bool initialized;

public:
  VelodyneCalibration() : distance_resolution_m(0.002f), initialized(false) {}
  explicit VelodyneCalibration(const std::string & calibration_file) : distance_resolution_m(0.002f)
  {
    read(calibration_file);
  }

  void read(const std::string & calibration_file);
  void write(const std::string & calibration_file);
};

}  // namespace nebula::drivers

#endif  // NEBULA_VELODYNE_CALIBRATION_DECODER_H