Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add substitution when loading yaml files #1354

Merged

Conversation

nano-meter
Copy link
Contributor

implements #1051

@dirk-thomas
Copy link
Member

Can you please add a test for this new functionality.

@nano-meter
Copy link
Contributor Author

Should I instead of creating a new test yaml file just modify params.yaml?

@alextoind
Copy link
Contributor

I was exactly searching for this feature right now!

@dirk-thomas do you think you'll backport it also to kinetic-devel when you are happy with the implementation?

value = self.resolve_args(value, context)
self.load_rosparam(context, ros_config, cmd, param, file, value, verbose=verbose)
subst_function = lambda x: self.resolve_args(x, context)
self.load_rosparam(context, ros_config, cmd, param, file, value, verbose=verbose, subst_function=subst_function)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the patch even a plain value (no file) was being substituted when subst_value was set. After this change substitution seems to only happen on the file content. Is that intentional? This seems to change the existing behavior which would be undesired.

Copy link
Contributor Author

@nano-meter nano-meter Apr 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, I am not changing existing behavior, the code that does the change is moved to
https://github.com/nano-meter/ros_comm/blob/a7ed7d8c003f52757b75121ee021b578b4b33a07/tools/roslaunch/src/roslaunch/loader.py#L405

This way both value and file content substitution is handled the same way.
I also created tests for file and value substitution, so if I introduced undesired changes, those probably would have caught it. If you see a problem, please tell me so I could fix it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for clarifying. I see now this is only relevant when cmd is load where it is handles in the function. The other commands don't mind about value so it is ok to not substitute it in these cases.

@dirk-thomas
Copy link
Member

do you think you'll backport it also to kinetic-devel when you are happy with the implementation?

That depends if the final patch changes any API or behavior and how big the changes / chances for regressions are.

@dirk-thomas
Copy link
Member

Should I instead of creating a new test yaml file just modify params.yaml?

The new separate yaml file looks fine to me.

Thanks for the patch. Checking CI results before merging...

@dirk-thomas
Copy link
Member

@ros-pull-request-builder retest this please

1 similar comment
@dirk-thomas
Copy link
Member

@ros-pull-request-builder retest this please

@dirk-thomas
Copy link
Member

Since the failing RosAssert unit tests are unrelated (already on the target branch the case and ticketed separately in #1358) I will go ahead and merge this anyway.

@dirk-thomas dirk-thomas merged commit 2838185 into ros:lunar-devel Apr 5, 2018
@miguelprada
Copy link

Now that this has been merged, I'd like to bring back the issue raised by @alextoind of backporting to kinetic-devel. Is there any chance of that happening @dirk-thomas?

@dirk-thomas
Copy link
Member

Is there any chance of that happening @dirk-thomas?

That will be considered before the next Kinetic release. In general new features have a lower chance of getting backported.

zachfang pushed a commit to 6RiverSystems/ros_comm that referenced this pull request Jun 21, 2018
* Add substitution when loading yaml files

like in ros#1051

* Add tests
dantwinkler pushed a commit to 6RiverSystems/ros_comm that referenced this pull request Jul 10, 2018
* Add substitution when loading yaml files (ros#1354)

* Add substitution when loading yaml files

like in ros#1051

* Add tests

* fix: add fix commit message

* fix: add jira ticket (PERCEPTION-1921)
@tlind
Copy link

tlind commented Jul 13, 2018

Would also be interested in getting this backported to ROS Kinetic, given that it still has a lifetime of 3 years and this feature looks quite elementary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants