ApplePickingRequests.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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/EBus/EBus.h>
  10. #include <AzCore/Interface/Interface.h>
  11. #include <AzCore/Math/Aabb.h>
  12. #include <AzCore/Math/Obb.h>
  13. namespace AppleKraken
  14. {
  15. //! Requests for apple picking effector (manipulator)
  16. class ApplePickingRequests
  17. {
  18. public:
  19. AZ_RTTI(ApplePickingRequests, "{E70BC163-4AE0-4660-9769-1C3C7C3493A6}");
  20. virtual ~ApplePickingRequests() = default;
  21. //! Request to prepare for incoming apple picking tasks. Could be empty if manipulator is always ready.
  22. virtual void PrepareForPicking() = 0;
  23. //! PickApple by its global bounding box.
  24. //! @param globalAppleBoundingBox global bounding box for the apple.
  25. //! @param appleId
  26. //! Note this could be changed to local Aabb for real use cases.
  27. //! Global can be queried once, local is less resilient to robot instability, mini movement.
  28. //! Note that this can get a while and result will be signalled through ApplePickingNotifications.
  29. virtual void PickApple(AZ::Aabb globalAppleBoundingBox, AZ::EntityId appleId) = 0;
  30. //! Request to store currently held apple and retrieve manipulator into a travel position.
  31. virtual void FinishPicking() = 0;
  32. //! Return area covered by effector.
  33. //! @returns an object bounding box which is a region where apples can be picked.
  34. virtual AZ::Obb GetEffectorReachArea() = 0;
  35. };
  36. class ApplePickingBusTraits : public AZ::EBusTraits
  37. {
  38. public:
  39. static constexpr AZ::EBusHandlerPolicy HandlerPolicy = AZ::EBusHandlerPolicy::Single;
  40. static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single;
  41. };
  42. using ApplePickingRequestBus = AZ::EBus<ApplePickingRequests, ApplePickingBusTraits>;
  43. using ApplePickingInterface = AZ::Interface<ApplePickingRequests>;
  44. } // namespace AppleKraken