Skip to content

Commit ce923e1

Browse files
Merge pull request #47 from marip8/update/check-server
Check service and action servers before calling
2 parents d4da1cf + f5513d8 commit ce923e1

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

behaviortree_ros2/include/behaviortree_ros2/bt_action_node.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,10 @@ template<class T> inline
352352
};
353353
//--------------------
354354

355+
// Check if server is ready
356+
if(!action_client_->action_server_is_ready())
357+
return onFailure(SERVER_UNREACHABLE);
358+
355359
future_goal_handle_ = action_client_->async_send_goal( goal, goal_options );
356360
time_goal_sent_ = node_->now();
357361

behaviortree_ros2/include/behaviortree_ros2/bt_service_node.hpp

+4
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,10 @@ template<class T> inline
278278
return CheckStatus( onFailure(INVALID_REQUEST) );
279279
}
280280

281+
// Check if server is ready
282+
if(!service_client_->service_is_ready())
283+
return onFailure(SERVICE_UNREACHABLE);
284+
281285
future_response_ = service_client_->async_send_request(request).share();
282286
time_request_sent_ = node_->now();
283287

0 commit comments

Comments
 (0)