Ask Your Question
0

Strange problem with ROSLaunchParent

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

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>

    <!-- 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" />

    </node>
</launch>

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/

SUMMARY
========

CLEAR PARAMETERS
 * /ekf_symeter/

PARAMETERS
 * /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):
        self.launch_startnav()
        return

...

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

        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)

        launch.start()

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/my_module.py", line 80, in startnav_pressed
    self.launch_startnav()
  File "/home/tellus-user/Bureau/StageSebh/repos/testgazebo/src/symeter2_gui/src/symeter2_gui/my_module.py", line 114, in launch_startnav
    launch.start()
  File "/opt/ros/lunar/lib/python2.7/dist-packages/roslaunch/parent.py", line 271, in start
    self._start_infrastructure()
  File "/opt/ros/lunar/lib/python2.7/dist-packages/roslaunch/parent.py", line 220, in _start_infrastructure
    self._load_config()
  File "/opt/ros/lunar/lib/python2.7/dist-packages/roslaunch/parent.py", line 135, in _load_config
    roslaunch_strs=self.roslaunch_strs, verbose=self.verbose)
  File "/opt/ros/lunar/lib/python2.7/dist-packages/roslaunch/config.py", 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

1 Answer

Sort by ยป oldest newest most voted
0

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

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

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

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

Seen: 165 times

Last updated: Jul 02