StepSimulationServiceHandler.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/TickBus.h>
  10. #include <AzCore/std/string/string_view.h>
  11. #include <Interfaces/ISimulationFeaturesBase.h>
  12. #include <ROS2/Handlers/ROS2ServiceBase.h>
  13. #include <simulation_interfaces/srv/step_simulation.hpp>
  14. namespace ROS2SimulationInterfaces
  15. {
  16. class StepSimulationServiceHandler
  17. : public ROS2::ROS2ServiceBase<simulation_interfaces::srv::StepSimulation>
  18. , public ISimulationFeaturesBase
  19. , private AZ::TickBus::Handler
  20. {
  21. public:
  22. AZStd::string_view GetTypeName() const override
  23. {
  24. return "StepSimulation";
  25. }
  26. AZStd::string_view GetDefaultName() const override
  27. {
  28. return "step_simulation";
  29. }
  30. AZStd::unordered_set<SimulationFeatureType> GetProvidedFeatures() override;
  31. AZStd::optional<Response> HandleServiceRequest(const std::shared_ptr<rmw_request_id_t> header, const Request& request) override;
  32. private:
  33. // AZ::TickBus::Handler overrides
  34. void OnTick(float deltaTime, AZ::ScriptTimePoint time) override;
  35. };
  36. } // namespace ROS2SimulationInterfaces