Skip to content

Commit

Permalink
Return if battery soc of robot is greater than recharge_soc
Browse files Browse the repository at this point in the history
Signed-off-by: Yadunund <yadunund@openrobotics.org>
  • Loading branch information
Yadunund committed Jul 28, 2021
1 parent a407858 commit 9552e15
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion rmf_task/src/rmf_task/requests/ChargeBattery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,13 @@ ChargeBattery::Model::estimate_finish(
}

double delta_soc = recharge_soc - battery_soc;
assert(delta_soc >= 0.0);
if (delta_soc <= 1e-3)
{
// The robot's battery level when it reaches the charger is greater than
// the specified battery level the robot should be charged up to. Hence, we
// do not need a ChargeBattery task.
return std::nullopt;
}
double time_to_charge =
(3600 * delta_soc * _parameters.battery_system().capacity()) /
_parameters.battery_system().charging_current();
Expand Down

0 comments on commit 9552e15

Please sign in to comment.