/* * Copyright (c) Contributors to the Open 3D Engine Project. * For complete copyright and license terms please see the LICENSE at the root * of this distribution. * * SPDX-License-Identifier: Apache-2.0 OR MIT * */ #pragma once #include "GripperActionServer.h" #include #include #include #include #include #include namespace ROS2Controllers { //! GripperActionServerComponent is a component that encapsulates gripper action server. //! It is responsible for creating and managing the action server, producing feedback and result. class GripperActionServerComponent : public AZ::Component , private AZ::TickBus::Handler { public: using GripperCommand = control_msgs::action::GripperCommand; using GoalHandleGripperCommand = rclcpp_action::ServerGoalHandle; AZ_COMPONENT(GripperActionServerComponent, GripperActionServerComponentTypeId, AZ::Component); GripperActionServerComponent() = default; ~GripperActionServerComponent() = default; static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required); static void GetProvidedServices(AZ::ComponentDescriptor::DependencyArrayType& provided); static void GetIncompatibleServices(AZ::ComponentDescriptor::DependencyArrayType& incompatible); static void Reflect(AZ::ReflectContext* context); private: // AZ::Component overrides... void Activate() override; void Deactivate() override; // AZ::TickBus::Handler overrides void OnTick(float deltaTime, AZ::ScriptTimePoint time) override; std::shared_ptr ProduceFeedback() const; std::shared_ptr ProduceResult() const; AZStd::string m_gripperActionServerName{ "gripper_server" }; //! name of the GripperCommand action server AZStd::unique_ptr m_gripperActionServer; //! action server for GripperCommand }; } // namespace ROS2Controllers