[Action] Add ActionEndpointInfo and action graph count APIs - #1571
Open
minggangw wants to merge 3 commits into
Open
[Action] Add ActionEndpointInfo and action graph count APIs#1571minggangw wants to merge 3 commits into
minggangw wants to merge 3 commits into
Conversation
There was a problem hiding this comment.
Pull request overview
Adds new ROS 2 action-graph query capabilities to rclnodejs, exposing action client/server counts and per-endpoint metadata through the Node API and corresponding TypeScript types.
Changes:
- Add
Node.countActionClients/countActionServersand endpoint-info query APIs for actions. - Introduce
ActionEndpointInfo(JS + TS) to represent aggregated action endpoint metadata. - Extend native graph bindings/utilities and add tests/type-tests for the new APIs.
Reviewed changes
Copilot reviewed 8 out of 11 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| types/node.d.ts | Declares new Node action graph count + endpoint-info APIs. |
| types/base.d.ts | Wires in the new action_endpoint_info.d.ts reference. |
| types/action_endpoint_info.d.ts | Adds TS declarations for ActionEndpointInfo and related endpoint info shapes. |
| test/types/index.test-d.ts | Adds d.ts assertions for the new Node APIs and ActionEndpointInfo. |
| test/test-action-graph.js | Adds runtime tests for action client/server counts and endpoint info queries. |
| src/rcl_utilities.h | Declares JS conversion helper for action endpoint info arrays (ROS_VERSION >= 5000). |
| src/rcl_utilities.cpp | Implements action endpoint info conversion + adds null-string guards for endpoint fields. |
| src/rcl_graph_bindings.cpp | Adds native bindings for action count and action endpoint info queries. |
| lib/node.js | Exposes new Node methods and maps native endpoint info into ActionEndpointInfo instances. |
| lib/action/endpoint_info.js | Implements ActionEndpointInfo JS wrapper over native endpoint data. |
| index.js | Exports ActionEndpointInfo from the package entrypoint. |
Suppressed comments (2)
src/rcl_graph_bindings.cpp:437
countActionClients/countActionServersare exported underROS_VERSION >= 2605, but their implementations should beROS_VERSION >= 5000only. As-is, builds withROS_VERSIONbetween 2605 and 4999 will reference undefined symbols. Move the two exports into the existingROS_VERSION >= 5000block (keep the service info exports under>= 2605).
#if ROS_VERSION >= 2605
exports.Set("countActionClients",
Napi::Function::New(env, CountActionClients));
exports.Set("countActionServers",
Napi::Function::New(env, CountActionServers));
test/test-action-graph.js:309
- This test assumes the action endpoint info APIs exist. On distros older than Rolling,
getActionServersInfoByActionreturnsnull, andwaitForEndpointInfowill throw when accessing.length. Skip this test unlessDistroId.ROLLING.
it('Test getActionServersInfoByAction', async function () {
const infos = await waitForEndpointInfo(
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| #include <rcl/error_handling.h> | ||
| #include <rcl/graph.h> | ||
| #include <rcl/rcl.h> | ||
| #include <rcl_action/graph.h> |
| return result_list; | ||
| } | ||
|
|
||
| #if ROS_VERSION >= 2605 |
Comment on lines
+256
to
+257
| it('Test countActionClients and countActionServers', async function () { | ||
| assert.strictEqual( |
Comment on lines
+275
to
+276
| it('Test getActionClientsInfoByAction', async function () { | ||
| const infos = await waitForEndpointInfo( |
countActionClients/countActionServers require rcl_action_count_* (Lyrical+) and the endpoint info queries require rcl_action_get_*_info_by_action (Rolling only). Without gating these return null, so arm64 CI failed with 'null !== 1' and 'Cannot read properties of null' on humble, jazzy, kilted and lyrical.
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Adds new ROS 2 action-graph query capabilities to rclnodejs, exposing action client/server counts and per-endpoint metadata through the Node API and corresponding TypeScript types.
Changes:
Node.countActionClients/countActionServersand endpoint-info query APIs for actions.ActionEndpointInfo(JS + TS) to represent aggregated action endpoint metadata.Fix: #1570