Skip to content

Commit

Permalink
chore: dock database cleanup
Browse files Browse the repository at this point in the history
Signed-off-by: josegarcia <[email protected]>
  • Loading branch information
josegarcia committed Jun 19, 2024
1 parent bc37939 commit 9668b29
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
2 changes: 1 addition & 1 deletion nav2_bringup/params/nav2_params.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ docking_server:
filter_coef: 0.1

# Dock instances
# The following example illustrates how you should configure the docks instances.
# The following example illustrates configuring dock instances.
# docks: ['home_dock'] # Input your docks here
# home_dock:
# type: 'simple_charging_dock'
Expand Down
17 changes: 1 addition & 16 deletions nav2_docking/opennav_docking/src/dock_database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,14 @@ void DockDatabase::reloadDbCb(
{
auto node = node_.lock();
DockMap dock_instances;
if (utils::parseDockFile(request->filepath, node_.lock(), dock_instances)) {
if (utils::parseDockFile(request->filepath, node, dock_instances)) {
dock_instances_ = dock_instances;
response->success = true;
RCLCPP_INFO(
node->get_logger(),
"Dock database reloaded from file %s.", request->filepath.c_str());
return;
}

RCLCPP_ERROR(
node->get_logger(),
"Dock database reload failed from file %s.", request->filepath.c_str());
response->success = false;
}

Expand All @@ -118,17 +114,6 @@ Dock * DockDatabase::findDock(const std::string & dock_id)

Dock * DockDatabase::findDockInstance(const std::string & dock_id)
{
if (dock_instances_.empty()) {
auto node = node_.lock();
RCLCPP_WARN(
node->get_logger(),
"Dock database filepath nor dock parameters set. "
"Docking actions can only be executed specifying the dock pose via the action request. "
"Or update the dock database via the reload_database service.");

return nullptr;
}

auto it = dock_instances_.find(dock_id);
if (it != dock_instances_.end()) {
return &(it->second);
Expand Down

0 comments on commit 9668b29

Please sign in to comment.