Skip to content

Commit

Permalink
fix build errors in ros2 controller package setup (#232)
Browse files Browse the repository at this point in the history
  • Loading branch information
YaraShahin authored Oct 17, 2024
1 parent 7167a7a commit 608a4d3
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions scripts/ros2_control/setup-controller-package.bash
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,8 @@ for DEP_PKG in "${TEST_DEP_PKGS[@]}"; do
if `grep -q " find_package(${DEP_PKG} REQUIRED)" CMakeLists.txt`; then
echo "'$DEP_PKG' is already listed in CMakeLists.txt"
else
append_to_string="ament_lint_auto_find_test_dependencies()"
sed -i "s/$append_to_string/$append_to_string\\n find_package(${DEP_PKG} REQUIRED)/g" CMakeLists.txt
append_to_string="find_package(generate_parameter_library REQUIRED)"
sed -i "s/$append_to_string/$append_to_string\\nfind_package(${DEP_PKG} REQUIRED)/g" CMakeLists.txt
fi

# package.xml
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
//

#include "test_dummy_controller.hpp"
#include "rclcpp/rclcpp.hpp"

#include <limits>
#include <memory>
Expand Down
5 changes: 4 additions & 1 deletion templates/ros2_control/controller/test_dummy_controller.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "hardware_interface/loaned_command_interface.hpp"
#include "hardware_interface/loaned_state_interface.hpp"
#include "hardware_interface/types/hardware_interface_return_values.hpp"
#include "rclcpp/executor.hpp"
#include "rclcpp/parameter_value.hpp"
#include "rclcpp/time.hpp"
#include "rclcpp/utilities.hpp"
Expand Down Expand Up @@ -132,7 +133,9 @@ class DummyClassNameFixture : public ::testing::Test
protected:
void SetUpController(const std::string controller_name = "test_dummy_controller")
{
ASSERT_EQ(controller_->init(controller_name), controller_interface::return_type::OK);
ASSERT_EQ(
controller_->init(controller_name, "", 0, "", controller_->define_custom_node_options()),
controller_interface::return_type::OK);

std::vector<hardware_interface::LoanedCommandInterface> command_ifs;
command_itfs_.reserve(joint_command_values_.size());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ TEST(TestLoadDummyClassName, load_controller)
std::make_shared<rclcpp::executors::SingleThreadedExecutor>();

controller_manager::ControllerManager cm(
std::make_unique<hardware_interface::ResourceManager>(
ros2_control_test_assets::minimal_robot_urdf),
executor, "test_controller_manager");
executor, ros2_control_test_assets::minimal_robot_urdf, true, "test_controller_manager");

ASSERT_NO_THROW(
cm.load_controller("test_dummy_package_namespace", "dummy_package_namespace/DummyClassName"));
Expand Down

0 comments on commit 608a4d3

Please sign in to comment.