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

[SW-642] Make it obvious when spot is running out of battery #252

Merged

Conversation

tcappellari-bdai
Copy link
Collaborator

@tcappellari-bdai tcappellari-bdai commented Feb 1, 2024

Created a new spot_alerts node to monitor stats and throw a pop-up alert warning the user. It currently only monitors the battery states and throws a warning up if the percentage is <= 10%.
Also added the low_battery parameter flag to prevent constant pop up spamming.

Tested on a spot with low battery.

Copy link
Collaborator Author

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

@tcappellari-bdai tcappellari-bdai marked this pull request as ready for review February 1, 2024 20:52
@tcappellari-bdai tcappellari-bdai force-pushed the SW-642-make-it-obvious-when-spot-is-running-out-of-battery branch from e590c8e to 64f00a4 Compare February 1, 2024 20:58
Copy link
Contributor

@jschornak-bdai jschornak-bdai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a heads-up, #209 is going to move the code that's modified in this PR into a separate C++-based node, which will impact your implementation here.

A future-proof way to handle this warning would be to make a ROS node that's added to the Spot driver launch description which subscribes to the battery state ROS topic published by the driver and runs the check you added here in the subscriber callback.

spot_driver/spot_driver/ros_helpers.py Outdated Show resolved Hide resolved
@tcappellari-bdai tcappellari-bdai marked this pull request as draft February 2, 2024 17:41
@tcappellari-bdai tcappellari-bdai force-pushed the SW-642-make-it-obvious-when-spot-is-running-out-of-battery branch from b2c8072 to 398ad35 Compare February 6, 2024 21:44
Copy link

coveralls-official bot commented Feb 13, 2024

Pull Request Test Coverage Report for Build 7923150267

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 41.434%

Totals Coverage Status
Change from base Build 7906660021: 0.0%
Covered Lines: 1840
Relevant Lines: 4397

💛 - Coveralls

@tcappellari-bdai tcappellari-bdai force-pushed the SW-642-make-it-obvious-when-spot-is-running-out-of-battery branch from ccfce27 to e389a91 Compare February 14, 2024 16:50
@jschornak-bdai jschornak-bdai dismissed their stale review February 14, 2024 16:50

The changes I requested have been put in place. Dismissing so I don't block the PR.

@tcappellari-bdai tcappellari-bdai marked this pull request as ready for review February 14, 2024 16:50
Copy link
Collaborator

@khughes-bdai khughes-bdai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@jschornak-bdai jschornak-bdai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested this out by running the spot_alerts node by itself and publishing a BatteryStateArray message like this:

ros2 topic pub --rate 1 /status/battery_states spot_msgs/msg/BatteryStateArray "{battery_states: [{charge_percentage: 8.0}]}"

, and the pop-up appears like I'd expect.

There are a couple things that can be addressed in follow-up work, such as handling Spot charging back above the low-battery threshold level while these nodes are still running.

@tcappellari-bdai
Copy link
Collaborator Author

I tested this out by running the spot_alerts node by itself and publishing a BatteryStateArray message like this:

ros2 topic pub --rate 1 /status/battery_states spot_msgs/msg/BatteryStateArray "{battery_states: [{charge_percentage: 8.0}]}"

, and the pop-up appears like I'd expect.

There are a couple things that can be addressed in follow-up work, such as handling Spot charging back above the low-battery threshold level while these nodes are still running.

I just added in an extra check to reset the low_battery flag in case the spot is charging

Copy link
Collaborator

@jbarry-bdai jbarry-bdai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry just realized in all the questions I had about parameters I never clicked approve. Thanks for doing this!!

@tcappellari-bdai tcappellari-bdai merged commit 1e814b5 into main Feb 16, 2024
6 checks passed
@tcappellari-bdai tcappellari-bdai deleted the SW-642-make-it-obvious-when-spot-is-running-out-of-battery branch February 16, 2024 16:03
marlow-fawn pushed a commit to marlow-fawn/spot_ros2 that referenced this pull request Aug 19, 2024
…titute#252)

Created a new `spot_alerts` node to monitor stats and throw a pop-up alert warning the user. It currently only monitors the battery states and throws a warning up if the percentage is <= 10%.
Also added the `low_battery` parameter flag to prevent constant pop up spamming.

Tested on a spot with low battery.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants