ROS2SpawnPointComponentController.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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. #ifndef WITH_GAZEBO_MSGS
  10. static_assert(false, "This file should not be included in the build, without WITH_GAZEBO_MSGS defined.");
  11. #endif
  12. #include <AzCore/Component/Component.h>
  13. #include <AzCore/Component/ComponentBus.h>
  14. #include <AzCore/Math/Transform.h>
  15. #include <ROS2/Spawner/SpawnerInfo.h>
  16. namespace ROS2
  17. {
  18. class ROS2SpawnPointComponentConfig final : public AZ::ComponentConfig
  19. {
  20. public:
  21. AZ_RTTI(ROS2SpawnPointComponentConfig, "{eb3e6937-0d1d-4a31-87d7-6d6663e3cf35}");
  22. ROS2SpawnPointComponentConfig() = default;
  23. ~ROS2SpawnPointComponentConfig() = default;
  24. static void Reflect(AZ::ReflectContext* context);
  25. AZStd::string m_name;
  26. AZStd::string m_info;
  27. AZ::EntityId m_editorEntityId;
  28. };
  29. //! SpawnPoint indicates a place which is suitable to spawn a robot.
  30. class ROS2SpawnPointComponentController
  31. {
  32. public:
  33. AZ_TYPE_INFO(ROS2SpawnPointComponentController, "{cd29d626-0205-4ca0-ac0f-5377e4fd84dd}");
  34. ROS2SpawnPointComponentController() = default;
  35. explicit ROS2SpawnPointComponentController(const ROS2SpawnPointComponentConfig& config);
  36. ~ROS2SpawnPointComponentController() = default;
  37. static void Reflect(AZ::ReflectContext* context);
  38. //////////////////////////////////////////////////////////////////////////
  39. // Controller component
  40. void Activate(AZ::EntityId entityId);
  41. void Deactivate();
  42. void SetConfiguration(const ROS2SpawnPointComponentConfig& config);
  43. const ROS2SpawnPointComponentConfig& GetConfiguration() const;
  44. //////////////////////////////////////////////////////////////////////////
  45. AZStd::pair<AZStd::string, SpawnPointInfo> GetInfo() const;
  46. private:
  47. ROS2SpawnPointComponentConfig m_config;
  48. };
  49. } // namespace ROS2