AckermannSubscriptionHandler.cpp 966 B

12345678910111213141516171819202122232425
  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 "AckermannSubscriptionHandler.h"
  9. #include <ROS2Controllers/RobotControl/Ackermann/AckermannBus.h>
  10. #include <ROS2Controllers/RobotControl/Ackermann/AckermannCommandStruct.h>
  11. namespace ROS2Controllers
  12. {
  13. void AckermannSubscriptionHandler::SendToBus(const ackermann_msgs::msg::AckermannDrive& message)
  14. {
  15. AckermannCommandStruct acs;
  16. acs.m_acceleration = message.acceleration;
  17. acs.m_jerk = message.jerk;
  18. acs.m_speed = message.speed;
  19. acs.m_steeringAngle = message.steering_angle;
  20. acs.m_steeringAngleVelocity = message.steering_angle_velocity;
  21. AckermannNotificationBus::Event(GetEntityId(), &AckermannNotifications::AckermannReceived, acs);
  22. }
  23. } // namespace ROS2Controllers