Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add battery charging logs #175

Merged
merged 5 commits into from
Aug 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions panther_battery/src/adc_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,10 +221,26 @@ 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. '
f'Battery percentage: {battery_msg.percentage * 100}%',
)
else:
battery_msg.power_supply_status = BatteryState.POWER_SUPPLY_STATUS_NOT_CHARGING
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.',
)
else:
battery_msg.power_supply_status = BatteryState.POWER_SUPPLY_STATUS_DISCHARGING

Expand Down
Loading