ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Strange problem with ROSLaunchParent

asked 2018-06-07 04:16:54 -0600

sebh gravatar image

Hello all, my first post on this forum!

I have a strange problem trying to launch a launch file using ROSLaunchParent.

I have a node I am trying to launch using a launch file:


    <!-- Launch the robot_localization node -->
    <node pkg="robot_localization" type="ekf_localization_node" name="ekf_symeter" clear_params="true">
        <rosparam command="load" file="$(find symeter2)/config/ekf_config.yaml" />


which is named symeter2_nav.launch, and which belongs to a package named symeter2.

If I attempt to launch through the command line interface, all goes well:

$ roslaunch symeter2 symeter2_nav.launch 
... logging to /home/tellus-user/.ros/log/1eef2bb4-68a6-11e8-b842-48e2444fe644/roslaunch-pcrouge-720.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

started roslaunch server http://pcrouge:37605/


 * /ekf_symeter/

 * /ekf_symeter/acceleration_gains: [1.0, 0.0, 0.0, 0...
 * /ekf_symeter/acceleration_limits: [20, 20, 20, 3, 3...

However, if I try to launch the exact same launch file programmatically using the following code:

import roslaunch

class MyPlugin(Plugin):

    def startnav_pressed(self):


    def launch_startnav(self):
        uuid = roslaunch.rlutil.get_or_generate_uuid(None, False)

        cli_args = ['symeter2', 'symeter2_nav.launch']
        roslaunch_file = roslaunch.rlutil.resolve_launch_arguments(cli_args)
        roslaunch_arg = []
        launch = roslaunch.parent.ROSLaunchParent(uuid, [(roslaunch_file, roslaunch_arg)])

        rospy.loginfo("roslaunch_file is %s", roslaunch_file)


the calling node crashes with the following message:

[INFO] [1528297147.923750, 6.622000]: roslaunch_file is ['/home/tellus-user/Bureau/StageSebh/repos/testgazebo/src/symeter2/launch/symeter2_nav.launch']
Traceback (most recent call last):
  File "/home/tellus-user/Bureau/StageSebh/repos/testgazebo/src/symeter2_gui/src/symeter2_gui/", line 80, in startnav_pressed
  File "/home/tellus-user/Bureau/StageSebh/repos/testgazebo/src/symeter2_gui/src/symeter2_gui/", line 114, in launch_startnav
  File "/opt/ros/lunar/lib/python2.7/dist-packages/roslaunch/", line 271, in start
  File "/opt/ros/lunar/lib/python2.7/dist-packages/roslaunch/", line 220, in _start_infrastructure
  File "/opt/ros/lunar/lib/python2.7/dist-packages/roslaunch/", line 135, in _load_config
    roslaunch_strs=self.roslaunch_strs, verbose=self.verbose)
  File "/opt/ros/lunar/lib/python2.7/dist-packages/roslaunch/", line 459, in load_config_default
    raise RLException(e)
roslaunch.core.RLException: Invalid roslaunch XML syntax: 'list' object has no attribute 'read'

which is strange as my launch file has no list object. Has anybody got any idea to what is going on?

My environment is * /rosdistro: lunar * /rosversion: 1.13.6 on Ubuntu 16.04

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2020-12-04 09:02:35 -0600

jannkar gravatar image

Same error happens in Melodic as well. Since you don't pass any launch arguments, you can just simply start the launch file in a similar way as specified in wiki:

import rospkg
rospack = rospkg.RosPack()
launch_path = rospack.get_path('symeter2') + '/symeter2_nav.launch'
cli_args = [launch_path]
roslaunch_file = roslaunch.rlutil.resolve_launch_arguments(cli_args)
launch = roslaunch.parent.ROSLaunchParent(uuid, roslaunch_file)

I believe this same solution works for Lunar as well.

For the people who receive this error when trying to launch multiple launch files at the same time, there seems to be error in wiki. As suggested by @kawa, changing

roslaunch_file = roslaunch.rlutil.resolve_launch_arguments(cli_args)


roslaunch_file = roslaunch.rlutil.resolve_launch_arguments(cli_args)[0]

helped me to solve the error.

edit flag offensive delete link more

answered 2019-07-02 16:13:06 -0600

zultron gravatar image

I'm guessing you're using Kinetic or earlier. Launch file arguments were only added to the roslaunch API in Lunar, as stated on the wiki.

We're still on Kinetic, and I wasn't paying attention to the docs and hit the same error. The original exception is caught and re-raised (a couple of times!), which covers up the real location of the problem, and the mismatched error and traceback don't make sense anymore.

edit flag offensive delete link more



I'm having this problem on Melodic, too.

Karl_Costa gravatar image Karl_Costa  ( 2019-10-28 05:28:07 -0600 )edit

Same problem here on Melodic. Using the API examples, I can get a single launchfile to work but run into this problem with multiple launchfiles.

voltron gravatar image voltron  ( 2020-01-29 11:11:20 -0600 )edit

same problem on Melodic. Anyone has got a solution?

azerila gravatar image azerila  ( 2020-05-11 09:25:46 -0600 )edit

I was sucsessed when I changed "roslaunch_file = roslaunch.rlutil.resolve_launch_arguments(cli_args)" to "roslaunch_file = roslaunch.rlutil.resolve_launch_arguments(cli_args)[0]"

kawa gravatar image kawa  ( 2020-05-23 12:45:31 -0600 )edit

still gives strange errors like: _compile_info(code, p, flags) File "/usr/lib/python2.7/", line 536, in _compile_info _compile_charset(charset, flags, code) File "/usr/lib/python2.7/", line 232, in _compile_charset flags & SRE_FLAG_UNICODE): KeyboardInterrupt Arguments = namedtuple('Arguments', 'args varargs keywords') File "/usr/lib/python2.7/", line 386, in namedtuple exec class_definition in namespace File "<string>", line 1, in <module> KeyboardInterrupt

But I don't do any keyboard intrupt.

azerila gravatar image azerila  ( 2020-05-28 15:47:38 -0600 )edit

i just add
while not rospy.is_shutdown(): rospy.sleep(0.1) after parent.start() and solved the problem parent.start() while not rospy.is_shutdown(): rospy.sleep(0.1)

hansolo111 gravatar image hansolo111  ( 2022-11-28 21:01:34 -0600 )edit

Question Tools

1 follower


Asked: 2018-06-07 04:16:54 -0600

Seen: 1,395 times

Last updated: Dec 04 '20