ROS2CameraSensorEditorComponent.h 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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/Component/Component.h>
  10. #include <ROS2/Frame/NamespaceConfiguration.h>
  11. #include <ROS2/Frame/ROS2Transform.h>
  12. #include <ROS2/Sensor/SensorConfiguration.h>
  13. #include <AzToolsFramework/API/ComponentEntitySelectionBus.h>
  14. #include <AzToolsFramework/ToolsComponents/EditorComponentBase.h>
  15. #include "CameraSensor.h"
  16. namespace ROS2
  17. {
  18. //! ROS2 Camera Editor sensor component class
  19. //! Allows turning an entity into a camera sensor in Editor
  20. //! Component draws camera frustrum in the Editor
  21. class ROS2CameraSensorEditorComponent
  22. : public AzToolsFramework::Components::EditorComponentBase
  23. , protected AzFramework::EntityDebugDisplayEventBus::Handler
  24. {
  25. public:
  26. ROS2CameraSensorEditorComponent();
  27. ~ROS2CameraSensorEditorComponent() override = default;
  28. AZ_EDITOR_COMPONENT(ROS2CameraSensorEditorComponent, "{3C2A86B2-AD58-4BF1-A5EF-71E0F94A2B42}");
  29. static void Reflect(AZ::ReflectContext* context);
  30. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  31. static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible);
  32. static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  33. static void GetPr(AZ::ComponentDescriptor::DependencyArrayType& required);
  34. void Activate() override;
  35. void Deactivate() override;
  36. // AzToolsFramework::Components::EditorComponentBase override
  37. void BuildGameEntity(AZ::Entity* gameEntity) override;
  38. private:
  39. // EntityDebugDisplayEventBus::Handler overrides
  40. void DisplayEntityViewport(const AzFramework::ViewportInfo& viewportInfo, AzFramework::DebugDisplayRequests& debugDisplay) override;
  41. AZStd::pair<AZStd::string, TopicConfiguration> MakeTopicConfigurationPair(
  42. const AZStd::string& topic, const AZStd::string& messageType, const AZStd::string& configName) const;
  43. SensorConfiguration m_sensorConfiguration;
  44. float m_VerticalFieldOfViewDeg = 90.0f;
  45. int m_width = 640;
  46. int m_height = 480;
  47. bool m_colorCamera = true;
  48. bool m_depthCamera = true;
  49. };
  50. } // namespace ROS2