Comments (6)
I've opened up ros2/rcl_interfaces#159 to fix this.
I actually don't think I'll add this to the Iron release notes; this behavior has actually always been the case (at least since we've had multiple callbacks), it just wasn't as clearly exposed as it is now. That said, if you find other places that reference setting the 'reason' code on success, I'm happy to update them as well (just let me know where they are).
from rclcpp.
Confirmed that this is a change in behavior, though it brings up an interesting question of policy.
The way that this works is that the add_on_set_parameter_callbacks
are a vector of callbacks; you can install an arbitrary number of them. Each one that is installed is placed at the front, so the callbacks are called newest first.
Further, the way that this list of callbacks is called is here. Notice in particular that the same result
variable is reused for each invocation of the callback.
Finally, what happened in Iron is that we added a callback into the core rclcpp::Node
:
rclcpp/rclcpp/src/rclcpp/time_source.cpp
Lines 275 to 276 in 9b4b3da
Putting this all together, we can see what happens. During the rclcpp::Node
constructor (which happens before any user code), we install the first add_on_set_parameters_callback
for the TimeSource
. Later on, we run the user code which installs the second add_on_set_parameters_callback
. Since the user one is installed second, it is actually called first. Which means we call it, get the result successful
and reason
back, and then go on to call the TimeSource
one which overwrites it. So that explains what is happening here.
Fixing it is tricky. In the set_parameters
case, we could actually fix it since we have a separate SetParametersResult
for each parameter, and thus we could refactor this to save off the result from each call. However, we run into a problem for set_parameters_atomically
, which only has a single result for all parameters, and there it is unclear which one we would store.
Because of that latter problem, my inclination is to call this the new behavior and add a release note about it. But I'm interested to hear opinions from others, particularly from @ros2/team
from rclcpp.
Sounds good. Probably should be mentioned in documentation that it is only a failure reason, not a general message.
from rclcpp.
as @clalancette mentioned, originally the problem has been there in Humble, but Iron change makes it easier to happen.
Probably should be mentioned in documentation that it is only a failure reason, not a general message.
i thought that too, but that is not a designed behavior. application can set the reason why is is accepted as well.
In the set_parameters case, we could actually fix it since we have a separate SetParametersResult for each parameter, and thus we could refactor this to save off the result from each call.
agree.
However, we run into a problem for set_parameters_atomically, which only has a single result for all parameters, and there it is unclear which one we would store.
precisely, i think the problem comes up for successful cases.
once it hits the failure, it can return the result(false) with reason set by the user application callback right away.
but if all parameters can be accepted, we cannot be sure which reason should be set in result message.
a few approaches that we could take,
set_parameters_atomically
succeeds with multiple parameters,reason
payload will be empty. (cannot usereason
for general message with acceptance.)- it can print warning, that
reason
field will be empty, if that hits this case. reason
can be applied only when it fails. (design change, probably not a good idea.)
any thoughts?
from rclcpp.
After discussing this, we decided that the new behavior pretty much has to be the behavior. So I'll update the comments in the SetParametersResult
message, add an Iron release note about this, and update any other documentation that we have that references this.
from rclcpp.
Thanks!
from rclcpp.
Related Issues (20)
- cannot link mimick : /usr/bin/ld: cannot find -lmimick HOT 2
- ROSRate to be useless without chain to clock pointer HOT 4
- Backport request - Unified NodeInterfaces in Humble HOT 1
- When the binary package will be released to Humble? HOT 2
- Executor::spin_some, spin_all, spin_once are odd function names HOT 3
- Creating a Subscriber with TopicStatistics Applies Custom QoS to /statistics Publisher HOT 3
- Consider renaming `pre_set`, `on_set` and `post_set_parameters_callback`. HOT 4
- :man_farmer: `TestRate.wall_rate_basics`, `TestRate.ros_rate_basics` and `TestRate.rate_basics` are flaky in `nightly_win_rep` CI HOT 3
- Adding rmw_request_id_t allocator HOT 2
- change rclcpp logger sink or get all the sinks used by rclcpp HOT 4
- multithreaded executor blocked when there are 8 running nodes HOT 6
- Allow `rclcpp::Time::max()` to support other clock types than `RCL_SYSTEM_TIME`. HOT 2
- /rosout logging without a node? HOT 14
- Calling a service from inside a service HOT 1
- Asynchronous action acceptance and cancellation HOT 1
- Component manager load node service queue overflows and fails to launch some nodes HOT 1
- Unable to declare parameter that are only known at runtime HOT 2
- Component Container process has died ROS2 galactic RCLCPP HOT 7
- Several Action Client Regressions Iron, Rolling HOT 1
- Use `NodeParametersInterface` to track `use_sim_time` parameter for time source
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.