You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a modified version of launch_ros/examples/pub_sub_launch.pyhere.
# Copyright 2018 Open Source Robotics Foundation, Inc.## Licensed under the Apache License, Version 2.0 (the "License");# you may not use this file except in compliance with the License.# You may obtain a copy of the License at## http://www.apache.org/licenses/LICENSE-2.0## Unless required by applicable law or agreed to in writing, software# distributed under the License is distributed on an "AS IS" BASIS,# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.# See the License for the specific language governing permissions and# limitations under the License."""Launch a talker and a listener."""importosimportsyssys.path.insert(0, os.path.join(os.path.dirname(__file__), '..')) # noqasys.path.insert(0, os.path.join(os.path.dirname(__file__), '..', '..', 'launch')) # noqafromlaunchimportLaunchDescriptionfromlaunchimportLaunchIntrospectorfromlaunchimportLaunchServicefromlaunch_rosimportget_default_launch_descriptionimportlaunch_ros.actionsdefmain(argv=sys.argv[1:]):
"""Main."""ld=LaunchDescription([
launch_ros.actions.Node(
package='demo_nodes_cpp', node_executable='talker', output='screen',
node_name='my_node',
parameters=[{'a': 1, 'b': 'a', 'c': ['list', 'of', 'stuff']}],
remappings=[('chatter', 'my_chatter')]),
launch_ros.actions.Node(
package='demo_nodes_cpp', node_executable='listener', output='screen',
remappings=[('chatter', 'my_chatter')]),
])
print('Starting introspection of launch description...')
print('')
print(LaunchIntrospector().format_launch_description(ld))
print('')
print('Starting launch of launch description...')
print('')
# ls = LaunchService(debug=True)ls=LaunchService()
ls.include_launch_description(get_default_launch_description())
ls.include_launch_description(ld)
returnls.run()
if__name__=='__main__':
main()
Starting introspection of launch description...
<launch.launch_description.LaunchDescription object at 0x7fe2636a25c0>
├── ExecuteProcess(cmd=[ExecInPkg(pkg='demo_nodes_cpp', exec='talker'), LocalVar('node name'), LocalVar('parameter 1'), LocalVar('remapping 1')], cwd=None, env=None, shell=False)
└── ExecuteProcess(cmd=[ExecInPkg(pkg='demo_nodes_cpp', exec='listener'), LocalVar('remapping 1')], cwd=None, env=None, shell=False)
Starting launch of launch description...
[INFO] [launch]: All log files can be found below /home/ivanpauno/.ros/log/2019-04-11-15-07-37-242126-71c1584df2a2-4887
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [talker-1]: process started with pid [4896]
[INFO] [listener-2]: process started with pid [4897]
[talker-1] terminate called after throwing an instance of 'std::runtime_error'
[talker-1] what(): Failed to parse parameters from file '/tmp/launch_params_au9d6q_k': Sequence should be of same type. Value type 'bool' do not belong at line_num 8, at /home/ivanpauno/ros2_ws/src/ros2/rcl/rcl_yaml_param_parser/src/parser.c:891
[ERROR] [talker-1]: process has died [pid 4896, exit code -6, cmd '/home/ivanpauno/ros2_ws/install/demo_nodes_cpp/lib/demo_nodes_cpp/talker __node:=my_node __params:=/tmp/launch_params_au9d6q_k chatter:=my_chatter'].
Content of /tmp/launch_params_au9d6q_k
ivanpauno@71c1584df2a2:~/ros2_ws/src/ros2/launch_ros/launch_ros/examples$ cat /tmp/launch_params_au9d6q_k
/:
my_node:
ros__parameters:
a: 1
b: a
c: !!python/tuple
- list
- of
- stuff
Ok, I saw that the 'of' world is automatically recognized as a bool, and I used it on all my previous tests (super fun).
I think that it shouldn't be recognized like that (yaml boolean).
Also, if any of the yaml boolean keywords is between quotes ('On', 'True', etc), they shouldn't been converted to a bool. Now, the generated yaml file doesn't have quotes, and the rcl parser is still converting it to a bool.
I will open an issue later in rcl. I'm closing this one.
Bug report
Steps to reproduce issue
This is a modified version of
launch_ros/examples/pub_sub_launch.py
here.I only added:
Expected behavior
It should work as the original example.
Actual behavior
It fails when loading parameters.
Content of
/tmp/launch_params_au9d6q_k
Additional information
If I change the parameter arg to:
It works. Generated parameters file:
Numbers inside the 'c' list also work well, like ['10', '1', '2'].
As far as I've seen, the problem appears when one of the parameters is a list of strings, and one of the list items is more that one character long.
The text was updated successfully, but these errors were encountered: