Comments (17)
The list parameters service call (https://github.com/ros2/rcl_interfaces/blob/master/rcl_interfaces/srv/ListParameters.srv) should provide that functionality. The service call is exposed as API in rclcpp as
rclcpp/rclcpp/include/rclcpp/parameter_client.hpp
Lines 146 to 150 in 8c47f61
See http://design.ros2.org/articles/ros_parameters.html for the high level design.
from rclcpp.
Yeah. But what to pass for as prefix if I want to list all parameters? I already tried a empty list or * but it didn't work as far as I remember.
from rclcpp.
From looking at the implementation (
rclcpp/rclcpp/src/rclcpp/node.cpp
Line 236 in 69f7bca
It would be good to also document the necessary arguments of this common use case in the .srv file.
from rclcpp.
#197 adds the ability to list all parameters by supplying an empty prefix list. ros2/system_tests#107 adds a test for it.
from rclcpp.
@gerkey Can you please run a CI job for it.
from rclcpp.
I'd like to get feedback on the approach. Is an empty prefix list and ignored depth a good way to list all parameters?
from rclcpp.
A think returning all parameters when an empty prefix list is passes is good (and this should be mentioned in the .srv
file).
But the depth parameter should still be honored in that case.
from rclcpp.
Proposal: when the prefix list is empty, a depth of D
means: return all parameters whose names contain <=D
separators (currently the .
character). Does that make sense?
from rclcpp.
I don't think <=D
makes sense. D=1
should return everything without a separator - basically the first level. And of course also the parent group name for everything with a separator.
And I assume depth=0
has a similar semantic as an empty prefix list. So return all parameters with an arbitrary number of separators.
from rclcpp.
This doens't directly affects the approaches discussed before.
From the point of usability I think it's more convenient to have two methods in the rclcpp parameter_client.hpp.
The same as at the moment
list_parameters(
const std::vector<std::string> & parameter_prefixes,
uint64_t depth);
and another variant without any arguments
list_parameters();
I think that would be less confusing than empty arguments. Internally the second method could just call the first one with an empty parameter_prefixes vector.
from rclcpp.
I like the idea of adding the second signature of list_parameters()
with no args. But we still need to decide the semantics for this query when it happens via a service call, independent of any particular client library. That is, we need to decide how to interpret the contents of the request in the rcl_interfaces/ListParameters service.
An empty prefixes
list makes sense as a request for all parameters. And now that I've looked at the service spec, which defines DEPTH_RECURSIVE=0
(I didn't know that previously), I agree with @dirk-thomas's suggestion of having D==0
mean all depths, and D>0
mean all params with <D
separators. I'll do that.
from rclcpp.
I agree that an empty list could be a special case, but I'd also argue that if you pass a zero length string as a prefix that should also match everything. Otherwise if you're passing an argument through from another source you would have to add special logic to detect the zero length prefix and follow a special special logic if you want to support the zero length prefix.
from rclcpp.
I don't think a prefix list with one empty string has the same semantic. I understood the semantic of the prefix as follows: a prefix foo
- matches all parameters grouped under
foo
which means start withfoo.
. - it does not match e.g. a parameter
foobar
from rclcpp.
The question is whether you consider there to be an implicit separator at
the beginning.
foo matches foo.* but not foobar could be rewritten as
prefix matches ."prefix".*
but if you consider it more like a path with a leading separator and empty
string matches .* implying both foo and foobar would match.
If '' does not collapse and match any, I would expect that then we could
have zero length namespaces.
With that you would get things like ..foo..bar
as distinct from .foo.bar.
from rclcpp.
In #230, I implemented the following strategy:
- An empty
prefixes
list means that any parameter name will match. - Given the matches against
prefixes
, thedepth
argument is used to further filter the result to be those parameters that contain< depth
separators. I.e.,depth==1
means the first level, no separators allowed;depth==2
means the first and second level, at most 1 separator allowed; and so on. As a special case,depth==0
means all depths.
In ros2/system_tests#140 I added new tests for the empty prefixes case and updated other cases to account for the new handling of the depth
argument.
from rclcpp.
from rclcpp.
New feature (belatedly) merged. Thanks for the request!
from rclcpp.
Related Issues (20)
- TimersManager doesn't follow ROS time HOT 2
- rclcpp_action: Provide enum class return ClientGoalHandle::get_status
- Callback works on Galactic but fails on Rolling - handle_message is not implemented for GenericSubscription HOT 1
- Clang warning: ordered comparison of function pointers (Rolling) HOT 1
- `-fanalyzer` warning: possible null dereference when using TypeAdapters HOT 4
- leak due to std::shared_ptr circular reference between Context and GuardCondition HOT 3
- :farmer: `rclcpp.test_executors` failing in Rolling and Jazzy CycloneDDS HOT 2
- rclcpp::Time(int64_t nanoseconds, ...) should check for negative time
- Regression : Executor::spin_some_impl is active waiting HOT 5
- Parameter service behavior is inconsistent with the documentation of rcl_interfaces HOT 9
- Lifecycle destructor calls shutdown while in shuttingdown intermediate state HOT 45
- Backport PR2063 to Humble for Windows HOT 2
- Executor callbacks are no longer in a predictable order HOT 25
- '/clock' Topic cannot change each loop step time from simulation time HOT 10
- Program exits with code -11 when using async_send_request to set parameters in ROS 2 C++ client HOT 1
- Timer callbacks can be delayed when using simulation time HOT 4
- Possible regression in rcl preshutdown callbacks - context invalid? HOT 11
- Shutdown transition on base lifecycle node dtor may lead to segaults on subclass-registered shutdown callback HOT 6
- `on_shutdown` callback not called when `shutdown` transition is triggered on dtor HOT 2
- ABI/API Compliance Checker in github workflow HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rclcpp.