Skip to content

Conversation

@mxgrey
Copy link
Contributor

@mxgrey mxgrey commented Apr 25, 2024

There's been a long outstanding TODO for the fleet adapter to set the published robot status to charging when a robot is charging. This PR fixes that, and also accounts for whether the robot's dedicated waypoint is a charging waypoint or actually just a waiting point.

This also adds a parking: [ ... ] list to the charging schedule node so that certain waypoints can be tagged as parking waypoints and that will get updated correctly. Note that this means the charging schedule node will not work with any fleets that have the name "parking".

/// (true) or to actually charge (false)?
bool _waiting_for_charger;
bool _waiting_for_charger = false;
std::shared_ptr<void> _lock_charging;
Copy link
Member

@arjo129 arjo129 Apr 26, 2024

Choose a reason for hiding this comment

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

Do you mind if I ask why we are using a std::shared_ptr<void> here? It might be worth documenting the rationale. Are we some how abusing reference counting here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't consider it an abuse, but yes, we're taking advantage of the fact that std::shared_ptr has implemented atomic reference counting, so we can use RAII to lock and release tokens that represent resources. We're using the same technique in a few other places, like traffic schedule stubbornness and holding/releasing lift requests.

@mxgrey mxgrey merged commit dfb656f into main Jun 10, 2024
@mxgrey mxgrey deleted the fix_charging_status branch June 10, 2024 09:34
@Yadunund Yadunund mentioned this pull request Jun 10, 2024
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.

3 participants