From 21ed7947aaa39ea17750d5f9f46f8ff1d877aa9f Mon Sep 17 00:00:00 2001 From: Bence Magyar Date: Thu, 1 Feb 2024 18:15:45 +0000 Subject: [PATCH] Fix conflicts, still need to adjust InitController --- .../test/test_diff_drive_controller.cpp | 158 +----------------- 1 file changed, 1 insertion(+), 157 deletions(-) diff --git a/diff_drive_controller/test/test_diff_drive_controller.cpp b/diff_drive_controller/test/test_diff_drive_controller.cpp index b005655aad..8e860fe2c2 100644 --- a/diff_drive_controller/test/test_diff_drive_controller.cpp +++ b/diff_drive_controller/test/test_diff_drive_controller.cpp @@ -216,65 +216,29 @@ class TestDiffDriveController : public ::testing::Test TEST_F(TestDiffDriveController, init_fails_without_parameters) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); - - ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::ERROR); -======= const auto ret = controller_->init(controller_name, urdf_, 0); ASSERT_EQ(ret, controller_interface::return_type::ERROR); ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) + ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::ERROR); } TEST_F(TestDiffDriveController, init_fails_with_only_left_or_only_right_side_defined) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); -======= ASSERT_EQ(InitController(left_wheel_names, {}), controller_interface::return_type::ERROR); ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) - ASSERT_EQ(InitController({}, right_wheel_names), controller_interface::return_type::ERROR); } TEST_F(TestDiffDriveController, configure_fails_with_mismatching_wheel_side_size) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); - - controller_->get_node()->set_parameter( - rclcpp::Parameter("left_wheel_names", rclcpp::ParameterValue(left_wheel_names))); - - auto extended_right_wheel_names = right_wheel_names; - extended_right_wheel_names.push_back("extra_wheel"); - controller_->get_node()->set_parameter( - rclcpp::Parameter("right_wheel_names", rclcpp::ParameterValue(extended_right_wheel_names))); -======= ASSERT_EQ( InitController(left_wheel_names, {right_wheel_names[0], "extra_wheel"}), controller_interface::return_type::OK); ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::ERROR); } TEST_F(TestDiffDriveController, configure_succeeds_when_wheels_are_specified) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); - - controller_->get_node()->set_parameter( - rclcpp::Parameter("left_wheel_names", rclcpp::ParameterValue(left_wheel_names))); - controller_->get_node()->set_parameter( - rclcpp::Parameter("right_wheel_names", rclcpp::ParameterValue(right_wheel_names))); -======= ASSERT_EQ(InitController(), controller_interface::return_type::OK); ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) - ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); ASSERT_THAT( @@ -287,12 +251,6 @@ TEST_F(TestDiffDriveController, configure_succeeds_when_wheels_are_specified) TEST_F(TestDiffDriveController, configure_succeeds_tf_test_prefix_false_no_namespace) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); - -======= ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) std::string odom_id = "odom"; std::string base_link_id = "base_link"; std::string frame_prefix = "test_prefix"; @@ -318,12 +276,6 @@ TEST_F(TestDiffDriveController, configure_succeeds_tf_test_prefix_false_no_names TEST_F(TestDiffDriveController, configure_succeeds_tf_test_prefix_true_no_namespace) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); - -======= ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) std::string odom_id = "odom"; std::string base_link_id = "base_link"; std::string frame_prefix = "test_prefix"; @@ -351,12 +303,6 @@ TEST_F(TestDiffDriveController, configure_succeeds_tf_test_prefix_true_no_namesp TEST_F(TestDiffDriveController, configure_succeeds_tf_blank_prefix_true_no_namespace) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); - -======= ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) std::string odom_id = "odom"; std::string base_link_id = "base_link"; std::string frame_prefix = ""; @@ -384,13 +330,6 @@ TEST_F(TestDiffDriveController, configure_succeeds_tf_blank_prefix_true_no_names TEST_F(TestDiffDriveController, configure_succeeds_tf_test_prefix_false_set_namespace) { std::string test_namespace = "/test_namespace"; - -<<<<<<< HEAD - const auto ret = controller_->init(controller_name, test_namespace); - ASSERT_EQ(ret, controller_interface::return_type::OK); - -======= ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) std::string odom_id = "odom"; std::string base_link_id = "base_link"; std::string frame_prefix = "test_prefix"; @@ -418,13 +357,6 @@ TEST_F(TestDiffDriveController, configure_succeeds_tf_test_prefix_false_set_name TEST_F(TestDiffDriveController, configure_succeeds_tf_test_prefix_true_set_namespace) { std::string test_namespace = "/test_namespace"; - -<<<<<<< HEAD - const auto ret = controller_->init(controller_name, test_namespace); - ASSERT_EQ(ret, controller_interface::return_type::OK); - -======= ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) std::string odom_id = "odom"; std::string base_link_id = "base_link"; std::string frame_prefix = "test_prefix"; @@ -454,13 +386,6 @@ TEST_F(TestDiffDriveController, configure_succeeds_tf_test_prefix_true_set_names TEST_F(TestDiffDriveController, configure_succeeds_tf_blank_prefix_true_set_namespace) { std::string test_namespace = "/test_namespace"; - -<<<<<<< HEAD - const auto ret = controller_->init(controller_name, test_namespace); - ASSERT_EQ(ret, controller_interface::return_type::OK); - -======= ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) std::string odom_id = "odom"; std::string base_link_id = "base_link"; std::string frame_prefix = ""; @@ -488,31 +413,14 @@ TEST_F(TestDiffDriveController, configure_succeeds_tf_blank_prefix_true_set_name TEST_F(TestDiffDriveController, activate_fails_without_resources_assigned) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); - - controller_->get_node()->set_parameter( - rclcpp::Parameter("left_wheel_names", rclcpp::ParameterValue(left_wheel_names))); - controller_->get_node()->set_parameter( - rclcpp::Parameter("right_wheel_names", rclcpp::ParameterValue(right_wheel_names))); -======= ASSERT_EQ(InitController(), controller_interface::return_type::OK); ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) - ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); ASSERT_EQ(controller_->on_activate(rclcpp_lifecycle::State()), CallbackReturn::ERROR); } TEST_F(TestDiffDriveController, activate_succeeds_with_pos_resources_assigned) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); -======= ASSERT_EQ(InitController(), controller_interface::return_type::OK); ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) - // We implicitly test that by default position feedback is required ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); assignResourcesPosFeedback(); @@ -521,24 +429,11 @@ TEST_F(TestDiffDriveController, activate_succeeds_with_pos_resources_assigned) TEST_F(TestDiffDriveController, activate_succeeds_with_vel_resources_assigned) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); - - controller_->get_node()->set_parameter( - rclcpp::Parameter("position_feedback", rclcpp::ParameterValue(false))); - controller_->get_node()->set_parameter( - rclcpp::Parameter("left_wheel_names", rclcpp::ParameterValue(left_wheel_names))); - controller_->get_node()->set_parameter( - rclcpp::Parameter("right_wheel_names", rclcpp::ParameterValue(right_wheel_names))); -======= ASSERT_EQ( InitController( left_wheel_names, right_wheel_names, {rclcpp::Parameter("position_feedback", rclcpp::ParameterValue(false))}), controller_interface::return_type::OK); ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) - ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); assignResourcesVelFeedback(); ASSERT_EQ(controller_->on_activate(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); @@ -546,24 +441,11 @@ TEST_F(TestDiffDriveController, activate_succeeds_with_vel_resources_assigned) TEST_F(TestDiffDriveController, activate_fails_with_wrong_resources_assigned_1) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); - - controller_->get_node()->set_parameter( - rclcpp::Parameter("position_feedback", rclcpp::ParameterValue(false))); - controller_->get_node()->set_parameter( - rclcpp::Parameter("left_wheel_names", rclcpp::ParameterValue(left_wheel_names))); - controller_->get_node()->set_parameter( - rclcpp::Parameter("right_wheel_names", rclcpp::ParameterValue(right_wheel_names))); -======= ASSERT_EQ( InitController( left_wheel_names, right_wheel_names, {rclcpp::Parameter("position_feedback", rclcpp::ParameterValue(false))}), controller_interface::return_type::OK); ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) - ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); assignResourcesPosFeedback(); ASSERT_EQ(controller_->on_activate(rclcpp_lifecycle::State()), CallbackReturn::ERROR); @@ -571,24 +453,11 @@ TEST_F(TestDiffDriveController, activate_fails_with_wrong_resources_assigned_1) TEST_F(TestDiffDriveController, activate_fails_with_wrong_resources_assigned_2) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); - - controller_->get_node()->set_parameter( - rclcpp::Parameter("position_feedback", rclcpp::ParameterValue(true))); - controller_->get_node()->set_parameter( - rclcpp::Parameter("left_wheel_names", rclcpp::ParameterValue(left_wheel_names))); - controller_->get_node()->set_parameter( - rclcpp::Parameter("right_wheel_names", rclcpp::ParameterValue(right_wheel_names))); -======= ASSERT_EQ( InitController( left_wheel_names, right_wheel_names, {rclcpp::Parameter("position_feedback", rclcpp::ParameterValue(true))}), controller_interface::return_type::OK); ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) - ASSERT_EQ(controller_->on_configure(rclcpp_lifecycle::State()), CallbackReturn::SUCCESS); assignResourcesVelFeedback(); ASSERT_EQ(controller_->on_activate(rclcpp_lifecycle::State()), CallbackReturn::ERROR); @@ -596,24 +465,11 @@ TEST_F(TestDiffDriveController, activate_fails_with_wrong_resources_assigned_2) TEST_F(TestDiffDriveController, cleanup) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); - - controller_->get_node()->set_parameter( - rclcpp::Parameter("left_wheel_names", rclcpp::ParameterValue(left_wheel_names))); - controller_->get_node()->set_parameter( - rclcpp::Parameter("right_wheel_names", rclcpp::ParameterValue(right_wheel_names))); - controller_->get_node()->set_parameter(rclcpp::Parameter("wheel_separation", 0.4)); - controller_->get_node()->set_parameter(rclcpp::Parameter("wheel_radius", 0.1)); -======= ASSERT_EQ( InitController( left_wheel_names, right_wheel_names, {rclcpp::Parameter("wheel_separation", 0.4), rclcpp::Parameter("wheel_radius", 0.1)}), controller_interface::return_type::OK); ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) - rclcpp::executors::SingleThreadedExecutor executor; executor.add_node(controller_->get_node()->get_node_base_interface()); auto state = controller_->get_node()->configure(); @@ -653,23 +509,11 @@ TEST_F(TestDiffDriveController, cleanup) TEST_F(TestDiffDriveController, correct_initialization_using_parameters) { -<<<<<<< HEAD - const auto ret = controller_->init(controller_name); - ASSERT_EQ(ret, controller_interface::return_type::OK); - - controller_->get_node()->set_parameter( - rclcpp::Parameter("left_wheel_names", rclcpp::ParameterValue(left_wheel_names))); - controller_->get_node()->set_parameter( - rclcpp::Parameter("right_wheel_names", rclcpp::ParameterValue(right_wheel_names))); - controller_->get_node()->set_parameter(rclcpp::Parameter("wheel_separation", 0.4)); - controller_->get_node()->set_parameter(rclcpp::Parameter("wheel_radius", 1.0)); -======= ASSERT_EQ( InitController( left_wheel_names, right_wheel_names, {rclcpp::Parameter("wheel_separation", 0.4), rclcpp::Parameter("wheel_radius", 1.0)}), controller_interface::return_type::OK); ->>>>>>> 2705ca8 ([diff_drive] Remove unused parameter and add simple validation #abi-breaking (#958)) rclcpp::executors::SingleThreadedExecutor executor; executor.add_node(controller_->get_node()->get_node_base_interface());