make _on_parameter_event return result correctly#817
Conversation
|
Just FYI, the following is the current behavior. type mismatch can be detected before _parameters_callbacks is called. |
|
as mentioned in #817 (comment), currently with master, it will check the parameter type via But i think this PR makes sense. |
|
@squizz617 could you address flake8 errors? |
Previously, `_on_parameter_event` always returned `successful=True` to the caller (e.g., ros2param set) regardless of whether setting `use_sim_time` parameter actually succeeded or not. * PoC: ```sh # terminal 1 $ ros2 run examples_rclpy_minimal_publisher publisher_member_function [INFO] [1629490410.452032755] [minimal_publisher]: Publishing: "Hello World: 0" [INFO] [1629490410.918999697] [minimal_publisher]: Publishing: "Hello World: 1" [INFO] [1629490411.419087028] [minimal_publisher]: Publishing: "Hello World: 2" [INFO] [1629490411.919343319] [minimal_publisher]: Publishing: "Hello World: 3" [INFO] [1629490412.419345165] [minimal_publisher]: Publishing: "Hello World: 4" [INFO] [1629490412.919260702] [minimal_publisher]: Publishing: "Hello World: 5" [ERROR] [1629490413.030775970] [minimal_publisher]: use_sim_time parameter set to something besides a bool [INFO] [1629490413.419389164] [minimal_publisher]: Publishing: "Hello World: 6" [INFO] [1629490413.919106545] [minimal_publisher]: Publishing: "Hello World: 7" ``` ```sh # terminal 2 $ ros2 param set /minimal_publisher use_sim_time Trueeeee Set parameter successful ``` As demonstrated above, when trying to set `use_sim_time` param to an invalid type, the minimal_publisher node complains it cannot. However, ros2 param prints "Set parameter successful". This commit fixes this issue. Signed-off-by: Seulbae Kim <[email protected]>
Signed-off-by: Seulbae Kim <[email protected]>
|
Fixed the flake8 error. Seems ready to be merged. And the param type check in the master branch does make sense. Thanks! |
|
@ivanpauno could you review on this just in case before merge. |
ivanpauno
left a comment
There was a problem hiding this comment.
LGTM, it would be nice if tests are added before this gets merged
|
@fujitatomoya friendly ping, what's the state of this? |
|
CI (repos file build: |
|
PR job is test_timer, which appears to be flaky and unrelated to this PR. CI LGTM |
|
Thank you for the PR! |
Previously,
_on_parameter_eventalways returnedsuccessful=Trueto thecaller (e.g., ros2param set) regardless of whether setting
use_sim_timeparameter actually succeeded or not.
As demonstrated above, when trying to set
use_sim_timeparam to an invalidtype, the minimal_publisher node complains it cannot. However, ros2 param
prints "Set parameter successful". This commit fixes this issue.