Skip to content

Fix retrieving std::vector<int> parameters - #3245

Open
aiqubits wants to merge 1 commit into
ros2:rollingfrom
aiqubits:fix/issue-2577-vector-int-get-parameter
Open

Fix retrieving std::vector<int> parameters#3245
aiqubits wants to merge 1 commit into
ros2:rollingfrom
aiqubits:fix/issue-2577-vector-int-get-parameter

Conversation

@aiqubits

Copy link
Copy Markdown
Contributor

Fixes #2577.

ParameterValue stores both std::vector<int> and std::vector<int64_t> as ROS integer arrays backed by std::vector<int64_t>. However, ParameterValue::get<std::vector<int>>() returned the internal std::vector<int64_t> value.

Consequently, the templated Node::get_parameter() overload could not assign the result to a std::vector<int> and failed to compile.

Convert the stored integer array back to std::vector<int> when that C++ type is explicitly requested. Retrieval as std::vector<int64_t> remains unchanged.

A regression test covers Node::get_parameter(name, std::vector<int> &), including the minimum and maximum int values.

Signed-off-by: aiqubits <aiqubits@hotmail.com>

@fallenmi fallenmi left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I reviewed this at exact head 70979f10b674b2c1dc9fcd9e9f0169b7f5fa25e2. The explicit get<std::vector<int>>() path now converts the internal std::vector<int64_t> representation back to the requested value type, making Node::get_parameter()'s assignment type-correct while leaving std::vector<int64_t> retrieval unchanged. The regression covers the full lossless int domain boundaries.

A focused C++14/17/20 compile oracle reproduces the old incompatible-vector assignment and passes with the new return type and conversion. Current rolling advanced only in changelog and package-version files, so the affected header and test hunks integrate unchanged. DCO and Mergify are green; this PR exposes no upstream build/test workflow or legacy status context, so I did not treat those two checks as build evidence. I found no blocking issue.

Disclosure: I used OpenAI Codex and Anthropic Claude to assist this review. I verified the exact refs, public source and issue context, repository policy, interactions, CI layers, and focused compile result before submission.

@skyegalaxy

Copy link
Copy Markdown
Member

hi @fallenmi, we have already asked you once to stop posting automated AI reviews of these PRs. This behavior violates our guidelines for responsible generative AI usage. Further incidents will result in an org-wide ban of your github account.

@aiqubits

aiqubits commented Sep 1, 2026

Copy link
Copy Markdown
Contributor Author

hi @fallenmi, we have already asked you once to stop posting automated AI reviews of these PRs. This behavior violates our guidelines for responsible generative AI usage. Further incidents will result in an org-wide ban of your github account.

Well, I almost thought he was part of your organization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Retrieving(get_parameter()) value of parameter of type std::vector<int> won't build

3 participants