Skip to content

Commit

Permalink
Fix issue #136: Battery charge not shown in Android apps
Browse files Browse the repository at this point in the history
  • Loading branch information
corot committed Jun 20, 2012
1 parent abf4e85 commit bb3c7ec
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions kobuki_bringup/resources/yaml/diagnostics.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@ analyzers:
path: 'Power System'
timeout: 5.0
contains: ['Battery', 'Laptop Battery']
remove_prefix: mobile_base
kobuki:
type: diagnostic_aggregator/GenericAnalyzer
path: 'Kobuki'
timeout: 5.0
contains: ['Watchdog']
remove_prefix: mobile_base
sensors:
type: diagnostic_aggregator/GenericAnalyzer
path: 'Sensors'
timeout: 5.0
contains: ['Cliff Sensor', 'Wall Sensor', 'Wheel Drop', 'Motor Current', 'Gyro Sensor']
remove_prefix: mobile_base
input_ports:
type: diagnostic_aggregator/GenericAnalyzer
path: 'Input Ports'
timeout: 5.0
contains: ['Digital Input', 'Analog Input']
remove_prefix: mobile_base
# nodes:
# type: diagnostic_aggregator/GenericAnalyzer
# path: 'Nodes'
Expand Down
10 changes: 8 additions & 2 deletions kobuki_node/src/node/diagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,12 @@ void BatteryTask::run(diagnostic_updater::DiagnosticStatusWrapper &stat) {
break;
}
}
stat.add("Capacity", status.capacity);
stat.add("Voltage", status.voltage);

stat.add("Voltage (V)", status.voltage);
stat.add("Percent", status.percent());
stat.add("Charge (Ah)", (2.2*status.percent())/100.0);
stat.add("Capacity (Ah)", 2.2); // TODO: how can we tell which battery is in use?

switch (status.charging_source ) {
case(Battery::None) : {
stat.add("Source", "None");
Expand All @@ -88,14 +91,17 @@ void BatteryTask::run(diagnostic_updater::DiagnosticStatusWrapper &stat) {
switch ( status.charging_state ) {
case ( Battery::Charged ) : {
stat.add("State", "Charged");
stat.add("Current (A)", 3.14); // TODO: what's the real value for our charger?
break;
}
case ( Battery::Charging ) : {
stat.add("State", "Charging");
stat.add("Current (A)", 3.14); // TODO: what's the real value for our charger?
break;
}
case ( Battery::Discharging ) : {
stat.add("State", "Discharging");
stat.add("Current (A)", 0.0);
break;
}
default: break;
Expand Down

0 comments on commit bb3c7ec

Please sign in to comment.