-
Notifications
You must be signed in to change notification settings - Fork 79
Add GetNumEntities() for action client #1123
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -126,28 +126,6 @@ Napi::Value ActionSendGoalRequest(const Napi::CallbackInfo& info) { | |||||||||||
| return Napi::Number::New(env, static_cast<int32_t>(sequence_number)); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| Napi::Value ActionTakeCancelRequest(const Napi::CallbackInfo& info) { | ||||||||||||
| Napi::Env env = info.Env(); | ||||||||||||
|
|
||||||||||||
| RclHandle* action_server_handle = | ||||||||||||
| RclHandle::Unwrap(info[0].As<Napi::Object>()); | ||||||||||||
| rcl_action_server_t* action_server = | ||||||||||||
| reinterpret_cast<rcl_action_server_t*>(action_server_handle->ptr()); | ||||||||||||
| rmw_request_id_t* header = | ||||||||||||
| reinterpret_cast<rmw_request_id_t*>(malloc(sizeof(rmw_request_id_t))); | ||||||||||||
|
|
||||||||||||
| void* taken_request = info[1].As<Napi::Buffer<char>>().Data(); | ||||||||||||
| rcl_ret_t ret = | ||||||||||||
| rcl_action_take_cancel_request(action_server, header, taken_request); | ||||||||||||
| if (ret != RCL_RET_ACTION_SERVER_TAKE_FAILED) { | ||||||||||||
| auto js_obj = RclHandle::NewInstance(env, header, nullptr, | ||||||||||||
| [](void* ptr) { free(ptr); }); | ||||||||||||
| return js_obj; | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| return env.Undefined(); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| Napi::Value ActionSendResultRequest(const Napi::CallbackInfo& info) { | ||||||||||||
| Napi::Env env = info.Env(); | ||||||||||||
|
|
||||||||||||
|
|
@@ -211,20 +189,73 @@ Napi::Value ActionTakeStatus(const Napi::CallbackInfo& info) { | |||||||||||
| return env.Undefined(); | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| Napi::Value GetNumEntities(const Napi::CallbackInfo& info) { | ||||||||||||
| Napi::Env env = info.Env(); | ||||||||||||
| RclHandle* action_client_handle = | ||||||||||||
| RclHandle::Unwrap(info[0].As<Napi::Object>()); | ||||||||||||
| rcl_action_client_t* action_client = | ||||||||||||
| reinterpret_cast<rcl_action_client_t*>(action_client_handle->ptr()); | ||||||||||||
|
|
||||||||||||
| size_t num_subscriptions = 0u; | ||||||||||||
| size_t num_guard_conditions = 0u; | ||||||||||||
| size_t num_timers = 0u; | ||||||||||||
| size_t num_clients = 0u; | ||||||||||||
| size_t num_services = 0u; | ||||||||||||
|
|
||||||||||||
| rcl_ret_t ret; | ||||||||||||
| ret = rcl_action_client_wait_set_get_num_entities( | ||||||||||||
| action_client, &num_subscriptions, &num_guard_conditions, &num_timers, | ||||||||||||
| &num_clients, &num_services); | ||||||||||||
| if (RCL_RET_OK != ret) { | ||||||||||||
| rcl_reset_error(); | ||||||||||||
| std::string error_text{ | ||||||||||||
| "Failed to get number of entities for 'rcl_action_client_t'"}; | ||||||||||||
|
Comment on lines
+210
to
+212
|
||||||||||||
| rcl_reset_error(); | |
| std::string error_text{ | |
| "Failed to get number of entities for 'rcl_action_client_t'"}; | |
| std::string error_text = "Failed to get number of entities for 'rcl_action_client_t'. Error code: " + std::to_string(ret); | |
| rcl_reset_error(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Add a comment outlining the mapping between native entity counts and the JavaScript object keys to improve maintainability and assist future developers in understanding the conversion.