RigidBodyTwistControlComponent.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  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/RobotControl/Twist/TwistBus.h>
  11. namespace ROS2
  12. {
  13. //! A component with a simple handler for Twist type of control (linear and angular velocities).
  14. //! Velocities are directly applied to a selected body.
  15. class RigidBodyTwistControlComponent
  16. : public AZ::Component
  17. , private TwistNotificationBus::Handler
  18. {
  19. public:
  20. AZ_COMPONENT(RigidBodyTwistControlComponent, "{D994FE1A-AA6A-42B9-8B8E-B3B375891F5B}", AZ::Component);
  21. RigidBodyTwistControlComponent() = default;
  22. //////////////////////////////////////////////////////////////////////////
  23. // Component overrides
  24. void Activate() override;
  25. void Deactivate() override;
  26. //////////////////////////////////////////////////////////////////////////
  27. static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
  28. static void Reflect(AZ::ReflectContext* context);
  29. private:
  30. //////////////////////////////////////////////////////////////////////////
  31. // TwistNotificationBus::Handler overrides
  32. void TwistReceived(const AZ::Vector3& linear, const AZ::Vector3& angular) override;
  33. //////////////////////////////////////////////////////////////////////////
  34. };
  35. } // namespace ROS2