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 parameter for adjust current sign in battery plugin #2696

Open
wants to merge 4 commits into
base: gz-sim9
Choose a base branch
from

Conversation

Tacha-S
Copy link

@Tacha-S Tacha-S commented Dec 10, 2024

🦟 Bug fix

Fixes #2685

Summary

A parameter has been added to adjust the sign of the battery current value to comply with ROS conventions.
By default, it is set to false, so the existing behavior remains unchanged.

Checklist

  • Signed all commits for DCO
  • Added tests
  • Updated documentation (as needed)
  • Updated migration guide (as needed)
  • Consider updating Python bindings (if the library has them)
  • codecheck passed (See contributing)
  • All tests passed (See test coverage)
  • While waiting for a review on your PR, please help review another open pull request to support the maintainers

Note to maintainers: Remember to use Squash-Merge and edit the commit message to match the pull request summary while retaining Signed-off-by messages.

@Tacha-S Tacha-S requested a review from mjcarroll as a code owner December 10, 2024 01:32
@github-actions github-actions bot added 🏛️ ionic Gazebo Ionic 🪵 jetty Gazebo Jetty labels Dec 10, 2024
Signed-off-by: Tatsuro Sakaguchi <[email protected]>
@Tacha-S Tacha-S force-pushed the bugfix/current-sign branch from 92c8eac to fc1a2d5 Compare December 10, 2024 03:04
@@ -178,6 +178,9 @@ class gz::sim::systems::LinearBatteryPluginPrivate

/// \brief Initial power load set trough config
public: double initialPowerLoad = 0.0;

/// \brief Adjusts the sign of the current to align with ROS conventions.
public: bool adjustCurrentSignForROS{false};
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you mind to use a different value for the parameter ? We try not to include any ROS related stuff here.

Maybe something like invertSignValues ? But I open to suggestions

Copy link
Author

Choose a reason for hiding this comment

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

I was also considering using a variable like that, so I agree with the idea.
However, it's not clear what the sign is being inverted for, so how about naming it invertCurrentSign?

Copy link
Contributor

Choose a reason for hiding this comment

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

go ahead with invertCurrentSign 👌

Signed-off-by: Tatsuro Sakaguchi <[email protected]>
@Tacha-S Tacha-S requested a review from ahcorde December 11, 2024 05:10
@ahcorde ahcorde changed the title Add parameter for adjust current sign for ROS Add parameter for adjust current sign in battery plugin Dec 12, 2024
@ahcorde ahcorde enabled auto-merge (squash) December 12, 2024 11:29
@azeey azeey disabled auto-merge December 13, 2024 20:20
Copy link
Contributor

@azeey azeey left a comment

Choose a reason for hiding this comment

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

Wouldn't this be easier to flip the sign only when the data is being published (PostUpdate) instead of adding extra logic at various places?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏛️ ionic Gazebo Ionic 🪵 jetty Gazebo Jetty
Projects
Status: In review
Development

Successfully merging this pull request may close these issues.

Discrepancy in battery current sign between gz and ROS 2 for discharging state
3 participants