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

Iron: Action IPC Fixes #151

Merged
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions rclcpp/include/rclcpp/experimental/intra_process_manager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1061,7 +1061,7 @@ class IntraProcessManager
auto ptr = MessageAllocTraits::allocate(allocator, 1);
MessageAllocTraits::construct(allocator, ptr, *message);

subscription->provide_intra_process_data(std::move(MessageUniquePtr(ptr, deleter)));
subscription->provide_intra_process_data(MessageUniquePtr(ptr, deleter));
}

continue;
Expand Down Expand Up @@ -1104,7 +1104,7 @@ class IntraProcessManager
MessageAllocTraits::construct(allocator, ptr, *message);

ros_message_subscription->provide_intra_process_message(
std::move(MessageUniquePtr(ptr, deleter)));
MessageUniquePtr(ptr, deleter));
}
}
}
Expand Down
26 changes: 21 additions & 5 deletions rclcpp_action/include/rclcpp_action/client.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ class ClientBase : public rclcpp::Waitable
);
}

/// Return true if there is an intra-process action server that is ready to take goal requests.
bool
intra_process_action_server_is_available()
{
if (auto ipm = weak_ipm_.lock()) {
return ipm->action_server_is_available(ipc_action_client_id_);
}
return false;
}

// -------------
// Waitables API

Expand Down Expand Up @@ -835,12 +845,18 @@ class Client : public ClientBase
// the server might be available in another process or was configured to not use IPC.
if (intra_process_server_available) {
size_t hashed_guuid = std::hash<GoalUUID>()(goal_handle->get_goal_id());
ipc_action_client_->store_result_response_callback(
hashed_guuid, result_response_callback);

intra_process_send_done = ipm->template intra_process_action_send_result_request<ActionT>(
ipc_action_client_id_,
std::move(goal_result_request));
// Determine if goal was sent through inter or intra process by checking the goal ID
bool goal_sent_by_ipc = ipm->get_action_client_id_from_goal_uuid(hashed_guuid);

if (goal_sent_by_ipc) {
ipc_action_client_->store_result_response_callback(
hashed_guuid, result_response_callback);

intra_process_send_done = ipm->template intra_process_action_send_result_request<ActionT>(
ipc_action_client_id_,
std::move(goal_result_request));
}
}
}

Expand Down
3 changes: 2 additions & 1 deletion rclcpp_action/include/rclcpp_action/server.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -675,7 +675,8 @@ class Server : public ServerBase, public std::enable_shared_from_this<Server<Act
rclcpp::get_logger("rclcpp_action"),
"Action server can't send result response, missing IPC Action client: %s. "
"Will do inter-process publish",
this->action_name_.c_str());
this->action_name_);

return true;
}

Expand Down
Loading