Add StringJoinSubstitution substituion#843
Conversation
Signed-off-by: Christian Ruf <c.ruf99@gmail.com> Support concatenation of substitutions as implemented in ros2#838 Signed-off-by: Christian Ruf <c.ruf99@gmail.com> Add docstrings Signed-off-by: Christian Ruf <c.ruf99@gmail.com> Updatre repr Signed-off-by: Christian Ruf <c.ruf99@gmail.com> Fix formatting Signed-off-by: Christian Ruf <c.ruf99@gmail.com>
There was a problem hiding this comment.
This seems fine, but could you give a real-world example? Ah, sorry, I glossed over the last example in the PR description, although I kind of think it could simply be ['robot.', LaunchConfiguration('model'), '.urdf.xacro'].
Also, do you think we should support frontends, i.e., by implementing parse()?
launch/test/launch/substitutions/test_string_joint_substitution.py
Outdated
Show resolved
Hide resolved
Co-authored-by: Christophe Bedard <bedard.christophe@gmail.com> Signed-off-by: Christian Ruf <c.ruf99@gmail.com>
|
@christophebedard frontend support would definitly be a great addition for #838 because of cross-platform path handling. For both cases, PathJoinSubstitution and StringJoinSubstitution, I come across following problem: I dont know how this would translate to yaml launch. Maybe to something like this but the join-string result is not accessible. Perhaps something like this could work |
|
Substitutions in frontends look like launch/launch/launch/substitutions/launch_configuration.py Lines 33 to 34 in 7a79d6b So for launch:
- let:
name: 'model'
value: 'a'
- log:
message: '$(path-join robot $(var model) urdf xacro)'This would log $(path-join robot $(var model) "ur df" xacro) which results in robot/a/ur df/xacro. You can also nest substitutions, which is kind of the point of #838 (but for Python). In frontends, it looks like:
launch:
- let:
name: 'model'
value: 'a'
- let:
name: 'id'
value: '2'
- log:
message: '$(path-join "robot$(var id)" $(var model) "ur df" xacro)'which outputs For |
Signed-off-by: Christian Ruf <c.ruf99@gmail.com>
Signed-off-by: Christian Ruf <c.ruf99@gmail.com>
Signed-off-by: Christian Ruf <c.ruf99@gmail.com>
christophebedard
left a comment
There was a problem hiding this comment.
Just a small suggestion, otherwise this looks good to me!
|
@christophebedard Alright, thanks for your review! :D |
Signed-off-by: Christophe Bedard <bedard.christophe@gmail.com>
|
Pulls: #843 |
|
The test failures seem to be unrelated. |
|
Would you be willing to add support for frontends, i.e., by implementing |
|
Yes! I can do that |
|
Great! |
Add a substitution wrapper for python
str.joinmethod.Supports concatenation of substitutions as implemented in #838
This PR would complement
PathJoinSubstitutionfor general use cases like file names with separators (e.g. some.long.urdf.xacro), naming of entities (e.g. the_name_of_the_robot) or even namespaces (e.g. /env/group/robot/joint)Usecases
Domains
e.g.
https://docs.ros.orgwithsubdomainlaunch configuration equal todocsFile names
e.g.
robot.a.urdf.xacrowithmodellaunch configuration equal toa