roslaunch: #1685 ros master uri is now included in terminal titlebar
This commit is contained in:
parent
5b7910c9b8
commit
3fe8daff42
|
@ -49,6 +49,8 @@ from roslaunch.node_args import NodeParamsException, create_local_process_env
|
|||
from roslaunch.nodeprocess import create_master_process, create_node_process
|
||||
from roslaunch.pmon import start_process_monitor, ProcessListener, FatalProcessLaunch
|
||||
|
||||
from roslaunch.rlutil import update_terminal_name
|
||||
|
||||
_TIMEOUT_MASTER_START = 10.0 #seconds
|
||||
_TIMEOUT_MASTER_STOP = 10.0 #seconds
|
||||
|
||||
|
@ -283,7 +285,12 @@ Please use ROS_IP to set the correct IP address to use."""%(reverse_ip, hostname
|
|||
|
||||
if not m.is_running():
|
||||
raise RLException("ERROR: could not contact master [%s]"%m.uri)
|
||||
|
||||
printlog_bold("ROS_MASTER_URI=%s"%m.uri)
|
||||
# TODO: although this dependency doesn't cause anything bad,
|
||||
# it's still odd for launch to know about console stuff. This
|
||||
# really should be an event.
|
||||
update_terminal_name(m.uri)
|
||||
|
||||
# Param Server config params
|
||||
param_server = m.get()
|
||||
|
|
|
@ -82,16 +82,32 @@ def _wait_for_master():
|
|||
else:
|
||||
raise RuntimeError("unknown error waiting for master to start")
|
||||
|
||||
## use echo (where available) to change the name of the terminal window
|
||||
def change_terminal_name(args, is_core):
|
||||
_terminal_name = None
|
||||
|
||||
def _set_terminal(s):
|
||||
import platform
|
||||
if platform.system() in ['Linux', 'Darwin', 'Unix']:
|
||||
try:
|
||||
if is_core:
|
||||
print '\033]2;roscore\007'
|
||||
else:
|
||||
print '\033]2;'+','.join(args)+'\007'
|
||||
except: pass
|
||||
print '\033]2;%s\007'%s
|
||||
except:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
pass
|
||||
|
||||
def update_terminal_name(ros_master_uri):
|
||||
"""
|
||||
append master URI to the terminal name
|
||||
"""
|
||||
if _terminal_name:
|
||||
_set_terminal(_terminal_name + ' ' + ros_master_uri)
|
||||
|
||||
def change_terminal_name(args, is_core):
|
||||
"""
|
||||
use echo (where available) to change the name of the terminal window
|
||||
"""
|
||||
global _terminal_name
|
||||
_terminal_name = 'roscore' if is_core else ','.join(args)
|
||||
_set_terminal(_terminal_name)
|
||||
|
||||
## @param options_runid str: run_id value from command-line or None
|
||||
## @param options_wait_for_master bool: the wait_for_master command
|
||||
|
|
Loading…
Reference in New Issue