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

Fix ChargeBattery finish_time earlier than start_time #30

Merged
merged 1 commit into from
Jul 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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