ROS2TimeSource.h 1.2 KB

123456789101112131415161718192021222324252627282930313233343536
  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 "ITimeSource.h"
  10. namespace ROS2
  11. {
  12. //! The ROS2TimeSource provides the time taken from the ROS 2. By default
  13. //! this is system_time but it can be configured to provide the time from the other sources.
  14. class ROS2TimeSource : public ITimeSource
  15. {
  16. public:
  17. virtual ~ROS2TimeSource() = default;
  18. // ITimeSource overrides ...
  19. virtual void Activate() override {};
  20. virtual void Deactivate() override {};
  21. //! Get ROS 2 time as ROS2 message.
  22. //! @see ROS2Requests::GetROSTimestamp() for more details.
  23. virtual builtin_interfaces::msg::Time GetROSTimestamp() const override;
  24. //! Sets the time source to the given time.
  25. //! @param time The time to set the time source to.
  26. //! @return An outcome indicating success or failure.
  27. virtual AZ::Outcome<void, AZStd::string> AdjustTime(const builtin_interfaces::msg::Time& time) override;
  28. };
  29. } // namespace ROS2