ROS2 roslaunch launching node in new terminal kills node immediately

asked 2020-07-07 14:22:38 -0500

exuberantshark gravatar image

updated 2020-07-08 13:44:36 -0500

I would like to use roslaunch to setup multiple nodes automatically. These nodes each have output, so ideally I would launch them in separate terminal windows to make it easier to read the different outputs. I am using the prefix argument to execute code in a new window, but the node is immediately shutdown after startup (I see a new terminal open briefly, but it closes quickly). I can change the prefix argument to persist the window, i.e. "lxterminal -e -hold", but this just leaves a blank window, and the node is still killed.

Is there anyway to launch persistent nodes in separate terminals, or some other way to view my various live outputs separately?

Launch file:

from launch import LaunchDescription
from launch_ros.actions import Node


def generate_launch_description():
    return LaunchDescription([
        Node(
            package='expkg',
            node_executable='ex1',
            output="screen",
            prefix=["lxterminal -e"],
            emulate_tty=True
        ),
        Node(
            package='expkg',
            node_executable='ex2',
            output="screen",
            emulate_tty=True
        )
    ])

Relevant Output:

[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [ex1-1]: process started with pid [1768]
[INFO] [ex2-2]: process started with pid [1769]
[INFO] [ex1-1]: process has finished cleanly [pid 1768]

EDIT:

I can run my system successfully if I manually launch each node in a separate terminal myself (nodes do not self terminate). This is of course much more of a hassle as I have many nodes. I can also use the launch file to start every node in a single terminal, but this causes a lot of output clutter.

edit retag flag offensive close merge delete

Comments

Maybe is a irrelevant check, but could be possible that ex1 finishes by itself (inside code) a few instants later after the run?

Solrac3589 gravatar image Solrac3589  ( 2020-07-08 01:55:11 -0500 )edit

Unfortunately not, ex1 is a continuous process. I should also mention that when I do not use the launch file, and instead start each node manually in separate terminals, all nodes run successfully, and do not self terminate.

exuberantshark gravatar image exuberantshark  ( 2020-07-08 13:42:25 -0500 )edit