ApplePickerComponent.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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 "ApplePickingNotifications.h"
  10. #include "ApplePickingRequests.h"
  11. #include <AzCore/Component/Component.h>
  12. // #include <vision_msgs/msgs/detection_3d_array.h>
  13. namespace AppleKraken
  14. {
  15. //! The component also acts as a ground-truth detector
  16. // using DetectionsMessage = vision_msgs::msgs::Detection3DArray;
  17. struct AppleTask
  18. {
  19. AZ::EntityId m_appleEntityId;
  20. AZ::Aabb m_appleBoundingBox;
  21. };
  22. //! Demo component handling orchestration of apple picking
  23. class ApplePickerComponent
  24. : public AZ::Component
  25. , private ApplePickingNotificationBus::Handler // Probably could use TickBus as well for timeouts
  26. {
  27. public:
  28. AZ_COMPONENT(ApplePickerComponent, "{E9E83A4A-31A4-4E7A-AF88-7565AC8B9F27}", AZ::Component);
  29. ApplePickerComponent() = default;
  30. void Activate() override;
  31. void Deactivate() override;
  32. static void Reflect(AZ::ReflectContext* context);
  33. void StartAutomatedOperation();
  34. private:
  35. void ApplePicked(AZ::EntityId appleId) override;
  36. void AppleRetrieved() override;
  37. void PickingFailed(AZ::EntityId appleId, const AZStd::string& reason) override;
  38. AZ::Obb m_gatheringArea;
  39. AZStd::queue<AppleTask> m_currentAppleTasks;
  40. };
  41. } // namespace AppleKraken