Skip to content

File hesai_driver.hpp

File List > include > nebula_decoders > nebula_decoders_hesai > hesai_driver.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.

#ifndef NEBULA_HESAI_DRIVER_H
#define NEBULA_HESAI_DRIVER_H

#include "nebula_common/hesai/hesai_common.hpp"
#include "nebula_common/nebula_status.hpp"
#include "nebula_common/point_types.hpp"
#include "nebula_decoders/nebula_decoders_hesai/decoders/hesai_scan_decoder.hpp"

#include <pcl_conversions/pcl_conversions.h>

#include <memory>
#include <tuple>
#include <vector>

namespace nebula
{
namespace drivers
{
class HesaiDriver
{
private:
  Status driver_status_;
  std::shared_ptr<HesaiScanDecoder> scan_decoder_;

  template <typename SensorT>
  std::shared_ptr<HesaiScanDecoder> InitializeDecoder(
    const std::shared_ptr<const drivers::HesaiSensorConfiguration> & sensor_configuration,
    const std::shared_ptr<const drivers::HesaiCalibrationConfigurationBase> &
      calibration_configuration);

public:
  HesaiDriver() = delete;
  explicit HesaiDriver(
    const std::shared_ptr<const drivers::HesaiSensorConfiguration> & sensor_configuration,
    const std::shared_ptr<const drivers::HesaiCalibrationConfigurationBase> &
      calibration_configuration);

  Status GetStatus();

  Status SetCalibrationConfiguration(
    const HesaiCalibrationConfigurationBase & calibration_configuration);

  std::tuple<drivers::NebulaPointCloudPtr, double> ParseCloudPacket(
    const std::vector<uint8_t> & packet);
};

}  // namespace drivers
}  // namespace nebula

#endif  // NEBULA_HESAI_DRIVER_H