From 00b952c14a90b61ce3b8be1dabfac2fec27e8fee Mon Sep 17 00:00:00 2001 From: rafal-gorecki Date: Tue, 23 Apr 2024 15:06:02 +0200 Subject: [PATCH] Fix battery discharge --- panther_description/urdf/gazebo.urdf.xacro | 29 +++++++------------ .../config/battery_plugin_config.yaml | 25 +++++++++------- 2 files changed, 25 insertions(+), 29 deletions(-) diff --git a/panther_description/urdf/gazebo.urdf.xacro b/panther_description/urdf/gazebo.urdf.xacro index 7dbbc738c..9b3713f37 100644 --- a/panther_description/urdf/gazebo.urdf.xacro +++ b/panther_description/urdf/gazebo.urdf.xacro @@ -6,38 +6,31 @@ - - - - - + + - - + + - panther_battery + ${ns}panther_battery 41.4 42.0 -10.0 - ${bat_initial_charge} - 20.0 + ${battery_config['initial_charge_percentage']*battery_config['capacity']} + ${battery_config['capacity']} 0.15 2.0 true - ${bat_charging_time} + ${battery_config['charging_time']} 2.0 - ${bat_power_load} - false - - - true - + + ${battery_config['power_load']/100.0} + ${battery_config['simulate_discharging']} ${namespace} diff --git a/panther_gazebo/config/battery_plugin_config.yaml b/panther_gazebo/config/battery_plugin_config.yaml index 665710fdc..45eaac5ed 100644 --- a/panther_gazebo/config/battery_plugin_config.yaml +++ b/panther_gazebo/config/battery_plugin_config.yaml @@ -1,19 +1,22 @@ -# Parameters for the Ignition LinearBatteryPlugin +# Parameters for the Gazebo LinearBatteryPlugin +# For more information on Panther power consumption, please refer to: +# https://husarion.com/manuals/panther/#battery--charging -# Enables battery simulation. If set to true, the battery will discharge, -# and if it depletes completely, the robot will stop moving. +# If set to true, the battery will discharge and if it depletes completely, the robot will stop moving. simulate_discharging: false -# Sets the initial charge percentage of the battery. -initial_charge_percentage: 70.0 +# Battery capacity +# BAT01 - 20 Ah +# BAT02 - 40 Ah +capacity: 20.0 # [Ah] + +# Sets the initial charge percentage of the battery (range 0-1). +initial_charge_percentage: 0.7 # Specifies the charging time for the battery in hours. charging_time: 6.0 # [h] -# Represents the power load during normal operation and is initially set to 120W. -# With the default power load of 120W, the robot can operate for up to 8 hours. -# When the 'simulate_discharging' parameter is set to false, this value defaults to 0. -# Users are encouraged to customize this value to match their specific needs. -# For more information on Panther power consumption, please refer to: -# https://husarion.com/manuals/panther/#battery--charging +# Constant power discharging the battery. +# 120W – represents the power consumed during normal operation. +# With this power load, the robot equipped with BAT01 should work for about 7 hours. power_load: 120.0 # [W]