<commit_before>// Copyright 2016 Intermodalics All Rights Reserved.
//
// 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 TANGO_ROS_NODE_H_
#define TANGO_ROS_NODE_H_
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <mutex>
#include <string>
#include <thread>
#include <time.h>

#include <tango_client_api/tango_client_api.h>

#include <opencv2/core/core.hpp>

#include <geometry_msgs/TransformStamped.h>
#include <ros/ros.h>
#include <ros/node_handle.h>
#include <sensor_msgs/CompressedImage.h>
#include <sensor_msgs/PointCloud2.h>
#include <tf/transform_broadcaster.h>
#include <tf2_ros/static_transform_broadcaster.h>

#include "tango_ros_native/PublisherConfig.h"

namespace tango_ros_native {
const std::string NODE_NAME = "tango";
const int NUMBER_OF_FIELDS_IN_POINT_CLOUD = 4;
constexpr char CV_IMAGE_COMPRESSING_FORMAT[] = ".jpg";
constexpr char ROS_IMAGE_COMPRESSING_FORMAT[] = "jpeg";
// Compressing quality for OpenCV to compress an image to JPEG format,
// can take a value from 0 to 100 (the higher is the better).
const int IMAGE_COMPRESSING_QUALITY = 50;

// Camera bitfield values.
const uint32_t CAMERA_NONE = 0;
const uint32_t CAMERA_FISHEYE = (1 << 1);
const uint32_t CAMERA_COLOR = (1 << 2);

struct PublisherConfiguration {
  // True if pose needs to be published.
  std::atomic_bool publish_device_pose;
  // True if point cloud needs to be published.
  std::atomic_bool publish_point_cloud;
  // Flag corresponding to which cameras need to be published.
  std::atomic<uint32_t> publish_camera;

  // Topic name for the point cloud publisher.
  std::string point_cloud_topic = "tango/point_cloud";
  // Topic name for the fisheye image publisher.
  std::string fisheye_camera_topic = "tango/camera/fisheye_1/image_raw/compressed";
  // Topic name for the color image publisher.
  std::string color_camera_topic = "tango/camera/color_1/image_raw/compressed";

  PublisherConfiguration() {
    publish_device_pose = false;
    publish_point_cloud = false;
    publish_camera = CAMERA_NONE;
  }
};

// Node collecting tango data and publishing it on ros topics.
class TangoRosNode {
 public:
  TangoRosNode();
  TangoRosNode(const PublisherConfiguration& publisher_config);
  ~TangoRosNode();<commit_msg>Use curly brakets initilization ofr atomic variables<commit_after>// Copyright 2016 Intermodalics All Rights Reserved.
//
// 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 TANGO_ROS_NODE_H_
#define TANGO_ROS_NODE_H_
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <mutex>
#include <string>
#include <thread>
#include <time.h>

#include <tango_client_api/tango_client_api.h>

#include <opencv2/core/core.hpp>

#include <geometry_msgs/TransformStamped.h>
#include <ros/ros.h>
#include <ros/node_handle.h>
#include <sensor_msgs/CompressedImage.h>
#include <sensor_msgs/PointCloud2.h>
#include <tf/transform_broadcaster.h>
#include <tf2_ros/static_transform_broadcaster.h>

#include "tango_ros_native/PublisherConfig.h"

namespace tango_ros_native {
const std::string NODE_NAME = "tango";
const int NUMBER_OF_FIELDS_IN_POINT_CLOUD = 4;
constexpr char CV_IMAGE_COMPRESSING_FORMAT[] = ".jpg";
constexpr char ROS_IMAGE_COMPRESSING_FORMAT[] = "jpeg";
// Compressing quality for OpenCV to compress an image to JPEG format,
// can take a value from 0 to 100 (the higher is the better).
const int IMAGE_COMPRESSING_QUALITY = 50;

// Camera bitfield values.
const uint32_t CAMERA_NONE = 0;
const uint32_t CAMERA_FISHEYE = (1 << 1);
const uint32_t CAMERA_COLOR = (1 << 2);

struct PublisherConfiguration {
  // True if pose needs to be published.
  std::atomic_bool publish_device_pose{false};
  // True if point cloud needs to be published.
  std::atomic_bool publish_point_cloud{false};
  // Flag corresponding to which cameras need to be published.
  std::atomic<uint32_t> publish_camera{CAMERA_NONE};

  // Topic name for the point cloud publisher.
  std::string point_cloud_topic = "tango/point_cloud";
  // Topic name for the fisheye image publisher.
  std::string fisheye_camera_topic = "tango/camera/fisheye_1/image_raw/compressed";
  // Topic name for the color image publisher.
  std::string color_camera_topic = "tango/camera/color_1/image_raw/compressed";
};

// Node collecting tango data and publishing it on ros topics.
class TangoRosNode {
 public:
  TangoRosNode();
  TangoRosNode(const PublisherConfiguration& publisher_config);
  ~TangoRosNode();
{'fraction_non_alphanumeric': 0.09570957095709572, 'fraction_numerical': 0.0121012101210121, 'mean_word_length': 4.840471092077088, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5631182', 'n_tokens_mistral': 1795, 'n_tokens_neox': 1712, 'n_words': 544}