From 8c2a546251ba70567e880d106aea5d3877ff883f Mon Sep 17 00:00:00 2001 From: Vincent Belpois Date: Thu, 9 May 2024 10:47:34 +0200 Subject: [PATCH] changed prints to loggers --- src/ezbot_command_module/include/tirette.hpp | 12 ++++++------ src/ezbot_command_module/src/tirette_node.cpp | 2 +- src/listen_package/listen_package/ecoute.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ezbot_command_module/include/tirette.hpp b/src/ezbot_command_module/include/tirette.hpp index c9e7562..9179ec1 100644 --- a/src/ezbot_command_module/include/tirette.hpp +++ b/src/ezbot_command_module/include/tirette.hpp @@ -4,7 +4,7 @@ #include #include #include - +#include class TiretteNode : public rclcpp::Node { @@ -33,24 +33,24 @@ bool TiretteNode::init_gpiod(void) gpiochip = gpiod_chip_open_by_name("gpiochip0"); if(gpiochip == NULL) { - printf("unable to open GPIO\n"); + RCLCPP_WARN(get_logger(), "unable to open GPIO"); return false; } - printf("gpiochip successful = %d\n",gpiochip); + RCLCPP_INFO(get_logger(), "gpiochip successful = %d\n",gpiochip); gpioline = gpiod_chip_get_line(gpiochip,gpioTirette); if (gpioline == NULL) { - printf("unable to get GPIO line\n"); + RCLCPP_WARN(get_logger(), "unable to get GPIO line\n"); return false; } - printf("gpioTirette successful = %d\n",gpioTirette); + RCLCPP_INFO(get_logger(), "gpioTirette successful = %d\n",gpioTirette); int temp; // temp = gpiod_line_request_input_flags(gpioline,"Tirette", GPIOD_LINE_BIAS_PULL_UP); temp = gpiod_line_request_input(gpioline,"Tirette"); - printf("gpiod_line_request_input_flags = %d\n",temp); + RCLCPP_INFO(get_logger(),"gpiod_line_request_input_flags = %d\n",temp); return true; } diff --git a/src/ezbot_command_module/src/tirette_node.cpp b/src/ezbot_command_module/src/tirette_node.cpp index 323688d..fc54f9f 100644 --- a/src/ezbot_command_module/src/tirette_node.cpp +++ b/src/ezbot_command_module/src/tirette_node.cpp @@ -10,7 +10,7 @@ void TiretteNode::readGPIO() value = gpiod_line_get_value(gpioline); - printf("value = %d\n",value); + RCLCPP_INFO(get_logger(),"value = %d\n",value); message.data = value ? true : false; diff --git a/src/listen_package/listen_package/ecoute.py b/src/listen_package/listen_package/ecoute.py index 61848c0..dc2e5d8 100644 --- a/src/listen_package/listen_package/ecoute.py +++ b/src/listen_package/listen_package/ecoute.py @@ -26,7 +26,7 @@ def listener_callback(self, msg): for range_value in msg.ranges: if min_distance < range_value < max_distance: # If an object is detected within the specified range, publish a message - print("y a un truc") + self.get_logger().info("Object detected") self.publisher.publish(String(data='Object detected')) break