CameraPublishers.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include "CameraSensorDescription.h"
  10. #include <AzCore/std/containers/unordered_map.h>
  11. #include <rclcpp/publisher.hpp>
  12. #include <sensor_msgs/msg/camera_info.hpp>
  13. #include <sensor_msgs/msg/image.hpp>
  14. #include <std_msgs/msg/header.hpp>
  15. namespace ROS2
  16. {
  17. //! Handles all the ROS publishing related to a single camera.
  18. //! This includes 1-2 CameraInfo topics as well as 1-2 Image topics.
  19. class CameraPublishers
  20. {
  21. public:
  22. //! ROS2 image publisher type.
  23. using ImagePublisherPtrType = std::shared_ptr<rclcpp::Publisher<sensor_msgs::msg::Image>>;
  24. //! ROS2 camera sensor publisher type.
  25. using CameraInfoPublisherPtrType = std::shared_ptr<rclcpp::Publisher<sensor_msgs::msg::CameraInfo>>;
  26. CameraPublishers(const CameraSensorDescription& cameraDescription);
  27. ImagePublisherPtrType GetImagePublisher(CameraSensorDescription::CameraChannelType type);
  28. CameraInfoPublisherPtrType GetInfoPublisher(CameraSensorDescription::CameraChannelType type);
  29. private:
  30. AZStd::unordered_map<CameraSensorDescription::CameraChannelType, ImagePublisherPtrType> m_imagePublishers;
  31. AZStd::unordered_map<CameraSensorDescription::CameraChannelType, CameraInfoPublisherPtrType> m_infoPublishers;
  32. };
  33. } // namespace ROS2