From 62a7330f3e23b92d130502cc9e58bfdbfe735744 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kowalski?= Date: Mon, 14 Aug 2023 11:14:18 +0200 Subject: [PATCH 1/5] add battery charging logs --- panther_battery/src/adc_node.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/panther_battery/src/adc_node.py b/panther_battery/src/adc_node.py index cae4c5a80..20b41e7a9 100755 --- a/panther_battery/src/adc_node.py +++ b/panther_battery/src/adc_node.py @@ -221,10 +221,25 @@ def _publish_battery_msg( if self._charger_connected: if battery_msg.percentage == 1.0: battery_msg.power_supply_status = BatteryState.POWER_SUPPLY_STATUS_FULL + rospy.loginfo_throttle( + 60.0, + f'[{rospy.get_name()}] The battery is fully charged. ' + f'The robot can be disconnected from the charger.', + ) elif I_bat_mean > self._I_bat_charging_thresh[bat_pub]: battery_msg.power_supply_status = BatteryState.POWER_SUPPLY_STATUS_CHARGING + rospy.loginfo_throttle( + 1800.0, + f'[{rospy.get_name()}] Robot charging process update: \n', + f' - Battery Percentage: {battery_msg.percentage * 100}%', + ) else: battery_msg.power_supply_status = BatteryState.POWER_SUPPLY_STATUS_NOT_CHARGING + rospy.logerr_throttle( + 5.0, + f'[{rospy.get_name()}] The charger has been plugged in, ' + f'but the charging process has not started. ', + ) else: battery_msg.power_supply_status = BatteryState.POWER_SUPPLY_STATUS_DISCHARGING From 475a549f731995eab3baaa31f1601d1c0f7d5123 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kowalski?= <82044322+pkowalsk1@users.noreply.github.com> Date: Mon, 14 Aug 2023 13:00:43 +0200 Subject: [PATCH 2/5] Update panther_battery/src/adc_node.py Co-authored-by: Dawid Kmak <73443304+KmakD@users.noreply.github.com> --- panther_battery/src/adc_node.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panther_battery/src/adc_node.py b/panther_battery/src/adc_node.py index 20b41e7a9..2a9eac8d3 100755 --- a/panther_battery/src/adc_node.py +++ b/panther_battery/src/adc_node.py @@ -230,8 +230,8 @@ def _publish_battery_msg( battery_msg.power_supply_status = BatteryState.POWER_SUPPLY_STATUS_CHARGING rospy.loginfo_throttle( 1800.0, - f'[{rospy.get_name()}] Robot charging process update: \n', - f' - Battery Percentage: {battery_msg.percentage * 100}%', + f'[{rospy.get_name()}] Robot charging process update. ' + f'Battery Percentage: {battery_msg.percentage * 100}%', ) else: battery_msg.power_supply_status = BatteryState.POWER_SUPPLY_STATUS_NOT_CHARGING From bd2979974e8b6c67e91849aaf2f97a95bc19ef7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kowalski?= <82044322+pkowalsk1@users.noreply.github.com> Date: Mon, 14 Aug 2023 13:02:28 +0200 Subject: [PATCH 3/5] Update adc_node.py --- panther_battery/src/adc_node.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panther_battery/src/adc_node.py b/panther_battery/src/adc_node.py index 2a9eac8d3..9058cdbda 100755 --- a/panther_battery/src/adc_node.py +++ b/panther_battery/src/adc_node.py @@ -235,7 +235,7 @@ def _publish_battery_msg( ) else: battery_msg.power_supply_status = BatteryState.POWER_SUPPLY_STATUS_NOT_CHARGING - rospy.logerr_throttle( + rospy.logwarn_throttle( 5.0, f'[{rospy.get_name()}] The charger has been plugged in, ' f'but the charging process has not started. ', From d0342490b8eb823b8fed1d1678e272bc20b8f772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kowalski?= <82044322+pkowalsk1@users.noreply.github.com> Date: Mon, 14 Aug 2023 13:07:17 +0200 Subject: [PATCH 4/5] Update adc_node.py --- panther_battery/src/adc_node.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/panther_battery/src/adc_node.py b/panther_battery/src/adc_node.py index 9058cdbda..bf3a06e03 100755 --- a/panther_battery/src/adc_node.py +++ b/panther_battery/src/adc_node.py @@ -231,7 +231,7 @@ def _publish_battery_msg( rospy.loginfo_throttle( 1800.0, f'[{rospy.get_name()}] Robot charging process update. ' - f'Battery Percentage: {battery_msg.percentage * 100}%', + f'Battery percentage: {battery_msg.percentage * 100}%', ) else: battery_msg.power_supply_status = BatteryState.POWER_SUPPLY_STATUS_NOT_CHARGING @@ -239,6 +239,7 @@ def _publish_battery_msg( 5.0, f'[{rospy.get_name()}] The charger has been plugged in, ' f'but the charging process has not started. ', + f'Verify whether the charger is connected to a power source.' ) else: battery_msg.power_supply_status = BatteryState.POWER_SUPPLY_STATUS_DISCHARGING From 52fd96ec7f4435919840850771fb53e088421668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kowalski?= <82044322+pkowalsk1@users.noreply.github.com> Date: Mon, 14 Aug 2023 13:07:58 +0200 Subject: [PATCH 5/5] fix typo --- panther_battery/src/adc_node.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/panther_battery/src/adc_node.py b/panther_battery/src/adc_node.py index bf3a06e03..111208dc5 100755 --- a/panther_battery/src/adc_node.py +++ b/panther_battery/src/adc_node.py @@ -238,8 +238,8 @@ def _publish_battery_msg( rospy.logwarn_throttle( 5.0, f'[{rospy.get_name()}] The charger has been plugged in, ' - f'but the charging process has not started. ', - f'Verify whether the charger is connected to a power source.' + f'but the charging process has not started. ' + f'Verify whether the charger is connected to a power source.', ) else: battery_msg.power_supply_status = BatteryState.POWER_SUPPLY_STATUS_DISCHARGING