ROS2 launch.py, execute node on actual terminal [closed]
I am writing a ros2 launch file for a Python node that draws on terminal with curses
- namely key_teleop. The node runs just fine with ros2 run
but crashes when going through ros2 launch
. The launch file is kept to the minimum,
import os
from launch import LaunchDescription
import launch_ros.actions
def generate_launch_description():
proc_env = os.environ.copy()
proc_env['PYTHONUNBUFFERED'] = '1'
return LaunchDescription([launch_ros.actions.Node(
package='key_teleop', node_executable='key_teleop',
env=proc_env)])
Is there anything in the launch framework that would prevent the node from accessing the terminal ?
Is there some parameters, handler or whatnot to define / set up for my application to run smoothly ?
The error, while I don't expect it to be very helpful, is the following:
Traceback (most recent call last):
File "/usr/lib/python3.6/curses/__init__.py", line 78, in wrapper
cbreak()
_curses.error: cbreak() returned ERR
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.6/curses/__init__.py", line 100, in wrapper
nocbreak()
_curses.error: nocbreak() returned ERR
Edit:
After some reading, curses
requires a full blown terminal application which launch
most likely does not offer. One could launch a terminal from the launch file to execute the script but that sounds awful. E.g. with launch-prefix="gnome-terminal --command"
.
This so answer suggests using pyte.
Have you tried adding
output='screen'
? Does that change anything?I did and beside not fixing anything it messes up the terminal.
or use bash scripts and register it under scripts in setup.py