ros2_ouster/include/ros2_ouster/OS1/processors/scan_processor.hpp
/**
   * @brief A constructor for OS1::ScanProcessor
   * @param node Node for creating interfaces
   * @param mdata metadata about the sensor
   * @param frame frame_id to use for messages
   */
@brief A constructor for OS1::ScanProcessor
@param node Node for creating interfaces
@param mdata metadata about the sensor
@param frame frame_id to use for messages
@brief A constructor for OS1 :: ScanProcessor @param node Node for creating interfaces @param mdata metadata about the sensor @param frame frame_id to use for messages
ScanProcessor(
    const rclcpp_lifecycle::LifecycleNode::SharedPtr node,
    const ros2_ouster::Metadata & mdata,
    const std::string & frame)
  : DataProcessorInterface(), _node(node), _frame(frame)
  {
    _mdata = mdata;
    _pub = _node->create_publisher<sensor_msgs::msg::LaserScan>(
      "scan", rclcpp::SensorDataQoS());
    _height = OS1::pixels_per_column;
    _width = OS1::n_cols_of_lidar_mode(
      OS1::lidar_mode_of_string(mdata.mode));
    _xyz_lut = OS1::make_xyz_lut(_width, _height, mdata.beam_azimuth_angles,
        mdata.beam_altitude_angles);
    _aggregated_scans.resize(_width * _height);
    double zero_angle = 9999.0;
    _ring = 0;
    for (uint i = 0; i != _mdata.beam_altitude_angles.size(); i++) {
      if (fabs(_mdata.beam_altitude_angles[i]) < zero_angle) {
        _ring = static_cast<uint8_t>(i);
        zero_angle = fabs(_mdata.beam_altitude_angles[i]);
      }
    }
    _batch_and_publish =
      OS1::batch_to_iter<OSScanIt>(
      _xyz_lut, _width, _height, {}, &scan_os::ScanOS::make,
      [&](uint64_t scan_ts) mutable
      {
        if (_pub->get_subscription_count() > 0 && _pub->is_activated()) {
          sensor_msgs::msg::LaserScan msg = ros2_ouster::toMsg(_aggregated_scans,
          std::chrono::nanoseconds(scan_ts), _frame, _mdata, _ring);
          _pub->publish(msg);
        }
      });
  }
ScanProcessor ( const rclcpp_lifecycle :: LifecycleNode :: SharedPtr node , const ros2_ouster :: Metadata & mdata , const std :: string & frame ) : DataProcessorInterface ( ) , _node ( node ) , _frame ( frame ) { _mdata = mdata ; _pub = _node -> create_publisher < sensor_msgs :: msg :: LaserScan > ( " " , rclcpp :: SensorDataQoS ( ) ) ; _height = OS1 :: pixels_per_column ; _width = OS1 :: n_cols_of_lidar_mode ( OS1 :: lidar_mode_of_string ( mdata . mode ) ) ; _xyz_lut = OS1 :: make_xyz_lut ( _width , _height , mdata . beam_azimuth_angles , mdata . beam_altitude_angles ) ; _aggregated_scans . resize ( _width * _height ) ; double zero_angle = 9999.0 ; _ring = 0 ; for ( uint i = 0 ; i != _mdata . beam_altitude_angles . size ( ) ; i ++ ) { if ( fabs ( _mdata . beam_altitude_angles [ i ] ) < zero_angle ) { _ring = static_cast < uint8_t > ( i ) ; zero_angle = fabs ( _mdata . beam_altitude_angles [ i ] ) ; } } _batch_and_publish = OS1 :: batch_to_iter < OSScanIt > ( _xyz_lut , _width , _height , { } , & scan_os :: ScanOS :: make , [ & ] ( uint64_t scan_ts ) mutable { if ( _pub -> get_subscription_count ( ) > 0 && _pub -> is_activated ( ) ) { sensor_msgs :: msg :: LaserScan msg = ros2_ouster :: toMsg ( _aggregated_scans , std :: chrono :: nanoseconds ( scan_ts ) , _frame , _mdata , _ring ) ; _pub -> publish ( msg ) ; } } ) ; }
@brief A constructor for OS1::ScanProcessor
 @param node Node for creating interfaces
 @param mdata metadata about the sensor
 @param frame frame_id to use for messages
@brief A constructor for OS1 :: ScanProcessor @param node Node for creating interfaces @param mdata metadata about the sensor @param frame frame_id to use for messages