From 8923c5f2c7f387f33f4f3d1368d948613343ac3b Mon Sep 17 00:00:00 2001 From: Mukunda Bharatheesha Date: Fri, 10 Nov 2023 22:25:35 +0100 Subject: [PATCH] Generic controller state msg instead of Ackermann msg. --- .../test/test_ackermann_steering_controller.hpp | 2 +- .../test/test_bicycle_steering_controller.hpp | 2 +- steering_controllers_library/CMakeLists.txt | 1 - .../steering_controllers_library.hpp | 11 ++++------- steering_controllers_library/package.xml | 1 - .../src/steering_controllers_library.cpp | 2 +- .../test/test_steering_controllers_library.hpp | 2 +- .../test/test_tricycle_steering_controller.hpp | 2 +- 8 files changed, 9 insertions(+), 14 deletions(-) diff --git a/ackermann_steering_controller/test/test_ackermann_steering_controller.hpp b/ackermann_steering_controller/test/test_ackermann_steering_controller.hpp index 80258258c2..13e33c6e36 100644 --- a/ackermann_steering_controller/test/test_ackermann_steering_controller.hpp +++ b/ackermann_steering_controller/test/test_ackermann_steering_controller.hpp @@ -34,7 +34,7 @@ #include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp" using ControllerStateMsg = - steering_controllers_library::SteeringControllersLibrary::AckermanControllerState; + steering_controllers_library::SteeringControllersLibrary::SteeringControllerStateMsg; using ControllerReferenceMsg = steering_controllers_library::SteeringControllersLibrary::ControllerTwistReferenceMsg; diff --git a/bicycle_steering_controller/test/test_bicycle_steering_controller.hpp b/bicycle_steering_controller/test/test_bicycle_steering_controller.hpp index 065f9e1a0d..eb5d3b4ec1 100644 --- a/bicycle_steering_controller/test/test_bicycle_steering_controller.hpp +++ b/bicycle_steering_controller/test/test_bicycle_steering_controller.hpp @@ -34,7 +34,7 @@ #include "rclcpp_lifecycle/node_interfaces/lifecycle_node_interface.hpp" using ControllerStateMsg = - steering_controllers_library::SteeringControllersLibrary::AckermanControllerState; + steering_controllers_library::SteeringControllersLibrary::SteeringControllerStateMsg; using ControllerReferenceMsg = steering_controllers_library::SteeringControllersLibrary::ControllerTwistReferenceMsg; diff --git a/steering_controllers_library/CMakeLists.txt b/steering_controllers_library/CMakeLists.txt index 4a98dbf320..9f59b2b6bb 100644 --- a/steering_controllers_library/CMakeLists.txt +++ b/steering_controllers_library/CMakeLists.txt @@ -21,7 +21,6 @@ set(THIS_PACKAGE_INCLUDE_DEPENDS tf2 tf2_msgs tf2_geometry_msgs - ackermann_msgs ) find_package(ament_cmake REQUIRED) diff --git a/steering_controllers_library/include/steering_controllers_library/steering_controllers_library.hpp b/steering_controllers_library/include/steering_controllers_library/steering_controllers_library.hpp index 095db7674b..3a606fb51d 100644 --- a/steering_controllers_library/include/steering_controllers_library/steering_controllers_library.hpp +++ b/steering_controllers_library/include/steering_controllers_library/steering_controllers_library.hpp @@ -35,7 +35,6 @@ #include "steering_controllers_library_parameters.hpp" // TODO(anyone): Replace with controller specific messages -#include "ackermann_msgs/msg/ackermann_drive_stamped.hpp" #include "control_msgs/msg/steering_controller_status.hpp" #include "geometry_msgs/msg/twist.hpp" #include "geometry_msgs/msg/twist_stamped.hpp" @@ -81,11 +80,10 @@ class SteeringControllersLibrary : public controller_interface::ChainableControl STEERING_CONTROLLERS__VISIBILITY_PUBLIC controller_interface::return_type update_and_write_commands(const rclcpp::Time & time, const rclcpp::Duration & period) override; - using ControllerAckermannReferenceMsg = ackermann_msgs::msg::AckermannDriveStamped; using ControllerTwistReferenceMsg = geometry_msgs::msg::TwistStamped; using ControllerStateMsgOdom = nav_msgs::msg::Odometry; using ControllerStateMsgTf = tf2_msgs::msg::TFMessage; - using AckermanControllerState = control_msgs::msg::SteeringControllerStatus; + using SteeringControllerStateMsg = control_msgs::msg::SteeringControllerStatus; protected: controller_interface::CallbackReturn set_interface_numbers( @@ -96,7 +94,6 @@ class SteeringControllersLibrary : public controller_interface::ChainableControl // Command subscribers and Controller State publisher rclcpp::Subscription::SharedPtr ref_subscriber_twist_ = nullptr; - rclcpp::Subscription::SharedPtr ref_subscriber_ackermann_ = nullptr; rclcpp::Subscription::SharedPtr ref_subscriber_unstamped_ = nullptr; realtime_tools::RealtimeBuffer> input_ref_; rclcpp::Duration ref_timeout_ = rclcpp::Duration::from_seconds(0.0); // 0ms @@ -118,10 +115,10 @@ class SteeringControllersLibrary : public controller_interface::ChainableControl /// Odometry: steering_odometry::SteeringOdometry odometry_; - AckermanControllerState published_state_; + SteeringControllerStateMsg published_state_; - using ControllerStatePublisher = realtime_tools::RealtimePublisher; - rclcpp::Publisher::SharedPtr controller_s_publisher_; + using ControllerStatePublisher = realtime_tools::RealtimePublisher; + rclcpp::Publisher::SharedPtr controller_s_publisher_; std::unique_ptr controller_state_publisher_; // name constants for state interfaces diff --git a/steering_controllers_library/package.xml b/steering_controllers_library/package.xml index ecd1dd8e30..375725c893 100644 --- a/steering_controllers_library/package.xml +++ b/steering_controllers_library/package.xml @@ -31,7 +31,6 @@ tf2 tf2_msgs tf2_geometry_msgs - ackermann_msgs ament_cmake_gmock controller_manager diff --git a/steering_controllers_library/src/steering_controllers_library.cpp b/steering_controllers_library/src/steering_controllers_library.cpp index 26207d54b7..b265a3df0c 100644 --- a/steering_controllers_library/src/steering_controllers_library.cpp +++ b/steering_controllers_library/src/steering_controllers_library.cpp @@ -192,7 +192,7 @@ controller_interface::CallbackReturn SteeringControllersLibrary::on_configure( try { // State publisher - controller_s_publisher_ = get_node()->create_publisher( + controller_s_publisher_ = get_node()->create_publisher( "~/controller_state", rclcpp::SystemDefaultsQoS()); controller_state_publisher_ = std::make_unique(controller_s_publisher_); diff --git a/steering_controllers_library/test/test_steering_controllers_library.hpp b/steering_controllers_library/test/test_steering_controllers_library.hpp index c72c61257a..a9f8e1d3a4 100644 --- a/steering_controllers_library/test/test_steering_controllers_library.hpp +++ b/steering_controllers_library/test/test_steering_controllers_library.hpp @@ -34,7 +34,7 @@ #include "steering_controllers_library/steering_controllers_library.hpp" using ControllerStateMsg = - steering_controllers_library::SteeringControllersLibrary::AckermanControllerState; + steering_controllers_library::SteeringControllersLibrary::SteeringControllerStateMsg; using ControllerReferenceMsg = steering_controllers_library::SteeringControllersLibrary::ControllerTwistReferenceMsg; diff --git a/tricycle_steering_controller/test/test_tricycle_steering_controller.hpp b/tricycle_steering_controller/test/test_tricycle_steering_controller.hpp index 422f399ad4..dceedf64ea 100644 --- a/tricycle_steering_controller/test/test_tricycle_steering_controller.hpp +++ b/tricycle_steering_controller/test/test_tricycle_steering_controller.hpp @@ -34,7 +34,7 @@ #include "tricycle_steering_controller/tricycle_steering_controller.hpp" using ControllerStateMsg = - steering_controllers_library::SteeringControllersLibrary::AckermanControllerState; + steering_controllers_library::SteeringControllersLibrary::SteeringControllerStateMsg; using ControllerReferenceMsg = steering_controllers_library::SteeringControllersLibrary::ControllerTwistReferenceMsg;