SensorConfigurationRequestBus.h 1.9 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 <AzCore/Component/ComponentBus.h>
  10. #include <AzCore/Component/EntityId.h>
  11. #include <AzCore/EBus/EBus.h>
  12. #include <ROS2/ROS2TypeIds.h>
  13. #include <ROS2/Sensor/SensorConfiguration.h>
  14. namespace ROS2
  15. {
  16. //! Interface that allows to get sensor configuration and switch publish state.
  17. class SensorConfigurationRequest : public AZ::EBusTraits
  18. {
  19. public:
  20. AZ_RTTI(SensorConfigurationRequest, SensorConfigurationRequestTypeId);
  21. using BusIdType = AZ::EntityComponentIdPair;
  22. static constexpr AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::ById;
  23. //! Get the configuration of the sensor.
  24. virtual SensorConfiguration GetSensorConfiguration() const = 0;
  25. //! Enable or disable the sensor, completely stopping the sensor from running.
  26. virtual void SetSensorEnabled(bool enable) = 0;
  27. //! Enable or disable publishing of the sensor to ROS 2.
  28. //! The sensor implementation will still be running, but the data will not be published.
  29. virtual void SetPublishingEnabled(bool publishingEnabled) = 0;
  30. //! Enable or disable visualization of the sensor.
  31. //! The sensor implementation will still be running, but the data will not be visualized in the viewport.
  32. virtual void SetVisualizeEnabled(bool visualizeEnabled) = 0;
  33. //! Get the the current frequency of the sensor in hertz.
  34. virtual float GetEffectiveFrequency() const = 0;
  35. //! Sets desired frequency of the sensor in hertz.
  36. virtual void SetDesiredFrequency(float frequency) = 0;
  37. };
  38. using SensorConfigurationRequestBus = AZ::EBus<SensorConfigurationRequest>;
  39. } // namespace ROS2