ros/ros_tutorials

ros2 param set /turtlesim background_* needs to be "triggered"

maryaB-osr opened this issue · 10 comments

See the Understanding ROS 2 parameters tutorial discussion.

Setting the background color parameter with

ros2 param set /turtlesim background_r 150

should update the turtlesim window immediately, but it needs to be triggered by calling

ros2 service call /clear std_srvs/srv/Empty

because of some leftover functionality from ROS 1.

There is no way to change the background color without wiping all previous drawn lines. I am not sure if that is desired - to implicitly clear when changing the parameter?

I think that's fine because now they'll have to explicitly clear anyway. I'm more concerned with the extra instructions, not what's actually happening. So if it can all be done at once (the clear and the color change) that's better.

So just to be clear: every time a background color parameter is set the whole scene should be cleared implicitly / automatically?

I don't think it should be. If there's a way to make it happen without clearing the lines that would be best.

But, since you said there is no way to change the color without clearing the drawn lines, I'm fine with the whole screen being cleared as long as the background changes automatically.

I will just add a note to the tutorial that the lines will clear - that's much better than the 4 or 5 extra sentences I have now explaining how you have to call /clear to get the parameter setting to change.

#75 separates the background color from the painted turtle paths which makes it possible to update the former without resetting the later. Also the background is immediately redrawn when a parameter event occurs.

I hope this makes writing the tutorial easier (and also simpler for the users).

Awesome! Thanks @dirk-thomas. I'll update the parameters tutorial once #75 is merged in

I'm working through ros2 tutorials at Understanding ROS 2 Parameters
I still need to execute the /clear service to show the changes and it wasn't mentioned anywhere in the tutorial.
Edit: I'm using "Dashing" distro

While a new version was tagged in this repo for Dashing (de7271c) it doesn't seem it was ever released with bloom: https://github.com/ros/rosdistro/blob/05e1fa9b6510c9a71a65e8d786b37934e38539b9/dashing/distribution.yaml#L3493

@claireyywang Can you clarify since you did the upstream release?

@dirk-thomas honestly I don't remember if I did since it's been a while, but I can do a release now if that's the right move.