Skip to content

Commit

Permalink
binary filter check services availability in init
Browse files Browse the repository at this point in the history
  • Loading branch information
enricosutera committed Nov 19, 2023
1 parent 62ce3d3 commit 496ce37
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions nav2_costmap_2d/plugins/costmap_filters/binary_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,19 @@ void BinaryFilter::initializeFilter(
auto change_parameters_client = node->create_client<rcl_interfaces::srv::SetParameters>(
"/" + param.node_name + "/set_parameters");
change_parameters_clients_.push_back(change_parameters_client);
if (!change_parameters_client->wait_for_service(
std::chrono::milliseconds(change_parameter_timeout_)))
{
RCLCPP_ERROR(
logger_, "BinaryFilter: service %s not available. Skipping ...",
change_parameters_client->get_service_name());
// TODO (@enricosutera) replace this once we figure out what to do
// throw std::runtime_error("BinaryFilter: Service not available!");
} else {
RCLCPP_INFO(
logger_, "BinaryFilter: service %s available.",
change_parameters_client->get_service_name());
}
}

// Get global frame required for binary state publisher
Expand Down

0 comments on commit 496ce37

Please sign in to comment.