Commit c4cf7a0
make _on_parameter_event return result correctly (#817)
* make _on_parameter_event return result correctly
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 <squizz617@gmail.com>
* use single quote
Signed-off-by: Seulbae Kim <squizz617@gmail.com>
Co-authored-by: Shane Loretz <sloretz@osrfoundation.org>1 parent 649bdec commit c4cf7a0
1 file changed
+9
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
126 | 129 | | |
127 | 130 | | |
128 | 131 | | |
129 | 132 | | |
130 | 133 | | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
131 | 138 | | |
132 | 139 | | |
133 | | - | |
134 | | - | |
135 | | - | |
| 140 | + | |
136 | 141 | | |
137 | 142 | | |
138 | | - | |
| 143 | + | |
139 | 144 | | |
140 | 145 | | |
141 | 146 | | |
| |||
0 commit comments