AppleDetectionGroundTruth.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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 "PickingStructs.h"
  10. #include <AzCore/std/containers/vector.h>
  11. #include <rclcpp/rclcpp.hpp>
  12. #include <vision_msgs/msg/detection2_d_array.hpp>
  13. #include <vision_msgs/msg/detection3_d_array.hpp>
  14. namespace AppleKraken
  15. {
  16. //! A class which provides ground truth for apples. For now it is only for debug.
  17. class AppleDetectionGroundTruth
  18. {
  19. public:
  20. AppleDetectionGroundTruth(const AZStd::string& rosNamespace, const AZStd::string& namespacedFrameId);
  21. void UpdateGroundTruth(const AZStd::vector<PickAppleTask>& apples);
  22. void Publish();
  23. private:
  24. // TODO - templates would improve it here (code is similar)
  25. vision_msgs::msg::Detection3D Construct3DDetection(const PickAppleTask& apple);
  26. void ConstructROS2Detection3DMessage(const AZStd::vector<PickAppleTask>& apples);
  27. vision_msgs::msg::Detection2D Construct2DDetection(const PickAppleTask& apple);
  28. void ConstructROS2Detection2DMessage(const AZStd::vector<PickAppleTask>& apples);
  29. AZStd::string m_frameId; //!< includes namespace
  30. std::shared_ptr<rclcpp::Publisher<vision_msgs::msg::Detection3DArray>> m_detection3DPublisher;
  31. std::shared_ptr<rclcpp::Publisher<vision_msgs::msg::Detection2DArray>> m_detection2DPublisher;
  32. vision_msgs::msg::Detection3DArray m_appleDetections3DMessage;
  33. vision_msgs::msg::Detection2DArray m_appleDetections2DMessage;
  34. };
  35. } // namespace AppleKraken