TopicConfiguration.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 <AzCore/RTTI/RTTI.h>
  10. #include <AzCore/Serialization/SerializeContext.h>
  11. #include <AzCore/std/string/string.h>
  12. #include <ROS2/Communication/QoS.h>
  13. #include <ROS2/ROS2TypeIds.h>
  14. namespace ROS2
  15. {
  16. //! A structure for a single ROS2 topic, a part of publisher or subscriber configuration.
  17. struct TopicConfiguration
  18. {
  19. public:
  20. AZ_TYPE_INFO(TopicConfiguration, TopicConfigurationTypeId);
  21. static void Reflect(AZ::ReflectContext* context);
  22. TopicConfiguration() = default;
  23. TopicConfiguration(const QoS& qos)
  24. : m_qos(qos)
  25. {
  26. }
  27. AZStd::string m_type = "std_msgs::msg::Empty"; //!< descriptive topic type for identification.
  28. AZStd::string m_topic = "default_topic"; //!< Topic to publish. Final topic will have a namespace added.
  29. //! Get topic QoS (Quality of Service) settings.
  30. //! @see ROS2::QoS.
  31. rclcpp::QoS GetQoS() const
  32. {
  33. return m_qos.GetQoS();
  34. }
  35. private:
  36. QoS m_qos = rclcpp::SensorDataQoS();
  37. };
  38. } // namespace ROS2