From 8d6817cfb8d87bcfc5ceba5b6f92e2b01176e0c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mart=C3=ADn=20Rico?= Date: Tue, 29 Oct 2024 06:27:35 +0100 Subject: [PATCH 1/2] Name for cognitive module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Francisco Martín Rico --- cs4home_simple_project/src/YoloModule.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cs4home_simple_project/src/YoloModule.cpp b/cs4home_simple_project/src/YoloModule.cpp index baebda4..b2af029 100644 --- a/cs4home_simple_project/src/YoloModule.cpp +++ b/cs4home_simple_project/src/YoloModule.cpp @@ -28,15 +28,15 @@ int main(int argc, char ** argv) rclcpp::NodeOptions options; options.arguments( - {"--ros-args", "-r", "__node:=yolo_module", "--params-file", config_file}); + {"--ros-args", "--params-file", config_file}); - auto node = cs4home_core::CognitiveModule::make_shared(options); + auto node = cs4home_core::CognitiveModule::make_shared("yolo_module", options); - // node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_CONFIGURE); - // node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); - // rclcpp::spin(node->get_node_base_interface()); + node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_CONFIGURE); + node->trigger_transition(lifecycle_msgs::msg::Transition::TRANSITION_ACTIVATE); + rclcpp::spin(node->get_node_base_interface()); rclcpp::shutdown(); return 0; -} \ No newline at end of file +} From cc1e69d5dbf515b87c46c6ff111a048f300b228d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Francisco=20Mart=C3=ADn=20Rico?= Date: Tue, 29 Oct 2024 06:27:58 +0100 Subject: [PATCH 2/2] Linting MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Francisco Martín Rico --- cs4home_simple_project/CMakeLists.txt | 12 +++++++----- .../include/cs4home_simple_project/FaceAfferent.hpp | 2 -- .../include/cs4home_simple_project/FaceEfferent.hpp | 2 -- cs4home_simple_project/src/FaceModule.cpp | 2 +- .../src/cs4home_simple_project/FaceAfferent.cpp | 12 ++++-------- 5 files changed, 12 insertions(+), 18 deletions(-) diff --git a/cs4home_simple_project/CMakeLists.txt b/cs4home_simple_project/CMakeLists.txt index b27e99d..decebbc 100644 --- a/cs4home_simple_project/CMakeLists.txt +++ b/cs4home_simple_project/CMakeLists.txt @@ -5,8 +5,10 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") add_compile_options(-Wall -Wextra -Wpedantic) endif() -add_compile_options(-fsanitize=address) -add_link_options(-fsanitize=address) +set(CMAKE_BUILD_TYPE Debug) + +# add_compile_options(-fsanitize=address) +# add_link_options(-fsanitize=address) # find dependencies find_package(ament_cmake REQUIRED) @@ -21,7 +23,7 @@ find_package(yolov8_msgs REQUIRED) find_package(sensor_msgs REQUIRED) find_package(ament_index_cpp REQUIRED) -set (dependencies +set(dependencies cs4home_core rclcpp rclcpp_components @@ -61,13 +63,13 @@ ament_target_dependencies(yolo_core ${dependencies}) add_executable(yolo_module src/YoloModule.cpp) ament_target_dependencies(yolo_module ${dependencies}) -# target_link_libraries(face_module +# target_link_libraries(face_module # face_afferent # face_efferent # face_core # ) -target_link_libraries(yolo_module +target_link_libraries(yolo_module yolo_afferent yolo_efferent yolo_core diff --git a/cs4home_simple_project/include/cs4home_simple_project/FaceAfferent.hpp b/cs4home_simple_project/include/cs4home_simple_project/FaceAfferent.hpp index 4b8ab97..0a64c7e 100644 --- a/cs4home_simple_project/include/cs4home_simple_project/FaceAfferent.hpp +++ b/cs4home_simple_project/include/cs4home_simple_project/FaceAfferent.hpp @@ -41,9 +41,7 @@ class FaceAfferent : public cs4home_core::Afferent bool configure() override; private: - std::vector input_topic_names_; - }; } // namespace cs4home_simple_project diff --git a/cs4home_simple_project/include/cs4home_simple_project/FaceEfferent.hpp b/cs4home_simple_project/include/cs4home_simple_project/FaceEfferent.hpp index 4e878e2..e3279eb 100644 --- a/cs4home_simple_project/include/cs4home_simple_project/FaceEfferent.hpp +++ b/cs4home_simple_project/include/cs4home_simple_project/FaceEfferent.hpp @@ -43,9 +43,7 @@ class FaceEfferent : public cs4home_core::Efferent void publish_graph(knowledge_graph_msgs::msg::GraphUpdate::UniquePtr msg); private: - std::vector output_topic_names_; - }; } // namespace cs4home_simple_project diff --git a/cs4home_simple_project/src/FaceModule.cpp b/cs4home_simple_project/src/FaceModule.cpp index bb1843b..10307b2 100644 --- a/cs4home_simple_project/src/FaceModule.cpp +++ b/cs4home_simple_project/src/FaceModule.cpp @@ -36,4 +36,4 @@ int main(int argc, char ** argv) rclcpp::shutdown(); return 0; -} \ No newline at end of file +} diff --git a/cs4home_simple_project/src/cs4home_simple_project/FaceAfferent.cpp b/cs4home_simple_project/src/cs4home_simple_project/FaceAfferent.cpp index 9c8cac2..05fc7ed 100644 --- a/cs4home_simple_project/src/cs4home_simple_project/FaceAfferent.cpp +++ b/cs4home_simple_project/src/cs4home_simple_project/FaceAfferent.cpp @@ -34,14 +34,10 @@ bool FaceAfferent::configure() parent_->get_parameter("simple_image_input.topics", input_topic_names_); // Create the subscription to the input topics - for (const auto & topic_name : input_topic_names_) - { - if(this->create_subscriber(topic_name, "hri_msgs/msg/IdsList")) - { + for (const auto & topic_name : input_topic_names_) { + if(this->create_subscriber(topic_name, "hri_msgs/msg/IdsList")) { RCLCPP_INFO(parent_->get_logger(), "Subscribed to topic: %s", topic_name.c_str()); - } - else - { + } else { RCLCPP_ERROR(parent_->get_logger(), "Error subscribing to topic: %s", topic_name.c_str()); return false; } @@ -52,4 +48,4 @@ bool FaceAfferent::configure() CS_REGISTER_COMPONENT(FaceAfferent) -} // namespace cs4home_simple_project \ No newline at end of file +} // namespace cs4home_simple_project