gazebosim / gz-sim

Open source robotics simulator. The latest version of Gazebo.
https://gazebosim.org
Apache License 2.0
719 stars 272 forks source link

Discrepancy in battery current sign between gz and ROS 2 for discharging state #2685

Open Tacha-S opened 2 days ago

Tacha-S commented 2 days ago

Environment

When using a ROS 2 bridge to convert battery state from gz to `sensor_msgs/BatteryState` in ROS 2, `sensor_msgs/BatteryState` expects the `current` to have a negative value during discharge. However, the `gz-sim-linearbatteryplugin-system` plugin does not behave this way. Is it correct for the `current` in the gz message to remain positive even during discharge?

Description

current value is negative value.

current value is positive value.

Steps to reproduce

1. 2. 3.

Output

header:
  stamp:
    sec: 47
    nanosec: 885000000
  frame_id: ''
voltage: 22.915739059448242
temperature: 0.0
current: 21.886171340942383
charge: 1.7268285751342773
capacity: 2.0
design_capacity: .nan
percentage: 86.3414306640625
power_supply_status: 2
power_supply_health: 0
power_supply_technology: 0
present: true
cell_voltage: []
cell_temperature: []
location: ''
serial_number: '