Skip to content

File angle_corrector.hpp

File List > decoders > angle_corrector.hpp

Go to the documentation of this file

// Copyright 2024 TIER IV, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#include "nebula_robosense_common/robosense_common.hpp"

#include <rclcpp/rclcpp.hpp>

#include <cstdint>
#include <memory>

namespace nebula::drivers
{

struct CorrectedAngleData
{
  float azimuth_rad;
  float elevation_rad;
  float sin_azimuth;
  float cos_azimuth;
  float sin_elevation;
  float cos_elevation;
  uint16_t corrected_channel_id;
};

class AngleCorrector
{
protected:
  const std::shared_ptr<const RobosenseCalibrationConfiguration> sensor_calibration_;

public:
  explicit AngleCorrector(
    const std::shared_ptr<const RobosenseCalibrationConfiguration> & sensor_calibration)
  : sensor_calibration_(sensor_calibration)
  {
  }

  virtual CorrectedAngleData get_corrected_angle_data(
    uint32_t block_azimuth, uint32_t channel_id) = 0;

  virtual bool has_scanned(int current_azimuth, int last_azimuth) = 0;
};

}  // namespace nebula::drivers