TwistSubscriptionHandler.cpp 841 B

123456789101112131415161718192021
  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. #include "TwistSubscriptionHandler.h"
  9. #include <ROS2/Utilities/ROS2Conversions.h>
  10. #include <ROS2Controllers/RobotControl/Twist/TwistBus.h>
  11. namespace ROS2Controllers
  12. {
  13. void TwistSubscriptionHandler::SendToBus(const geometry_msgs::msg::Twist& message)
  14. {
  15. const AZ::Vector3 linearVelocity = ROS2::ROS2Conversions::FromROS2Vector3(message.linear);
  16. const AZ::Vector3 angularVelocity = ROS2::ROS2Conversions::FromROS2Vector3(message.angular);
  17. TwistNotificationBus::Event(GetEntityId(), &TwistNotifications::TwistReceived, linearVelocity, angularVelocity);
  18. }
  19. } // namespace ROS2Controllers