clearpathrobotics / robot_upstart

ROS package of helper functions related to bringing up roslaunch on system startup.
BSD 3-Clause "New" or "Revised" License
193 stars 96 forks source link

ERROR: could not contact master [http://127.0.0.1:11311], when service is launched. #45

Open ayafuji opened 7 years ago

ayafuji commented 7 years ago

Hi, I'm new to robot_upstart package.

First, my environment is below:

ubuntu mate 16.04 Raspberry Pi 3 ros kinetic

And I did that I installed robot upstart package from source at this repository (master branch). Then I install my launch file to run when I RPI boot up.

rosrun robot_upstart install --job roscore foo/launch/bar.launch

But I caught the folloing error.

1月 15 15:50:34 mal root[409]: roscore: Using workspace setup file /home/mal/catkin_ws/devel/setup.bash                                                      [676/1929]
 1月 15 15:50:34 mal roscore-start[402]: <14>Jan 15 15:50:34 root: roscore: Using workspace setup file /home/mal/catkin_ws/devel/setup.bash
 1月 15 15:50:37 mal root[558]: roscore: Launching ROS_HOSTNAME=mal, ROS_IP=, ROS_MASTER_URI=http://127.0.0.1:11311, ROS_LOG_DIR=/tmp
 1月 15 15:50:37 mal roscore-start[402]: <14>Jan 15 15:50:37 root: roscore: Launching ROS_HOSTNAME=mal, ROS_IP=, ROS_MASTER_URI=http://127.0.0.1:11311, ROS_LOG_DIR=/tmp
 1月 15 15:50:40 mal roscore-start[402]: ls: cannot access '/etc/ros/kinetic/roscore.d/*.xacro': No such file or directory
 1月 15 15:50:41 mal root[639]: roscore: Generated launchfile: /tmp/roscore.launch
 1月 15 15:50:41 mal roscore-start[402]: <14>Jan 15 15:50:41 root: roscore: Generated launchfile: /tmp/roscore.launch
 1月 15 15:50:41 mal root[645]: roscore: Started roslaunch as background process, PID 644, ROS_LOG_DIR=/tmp
 1月 15 15:50:41 mal roscore-start[402]: <14>Jan 15 15:50:41 root: roscore: Started roslaunch as background process, PID 644, ROS_LOG_DIR=/tmp
 1月 15 15:50:44 mal roscore-start[402]: WARNING: cannot create log directory [/tmp/efe8ee0e-daee-11e6-a628-b827eb2a38c8]. Please set ROS_LOG_DIR to a writable location
.
 1月 15 15:50:44 mal roscore-start[402]: du: cannot read directory '/tmp/systemd-private-d841bace0f734c619ae55aa67b2e1288-systemd-hostnamed.service-FXeqHp': Permission 
d
 1月 15 15:50:55 mal roscore-start[402]: No handlers could be found for logger "roslaunch"
 1月 15 15:50:55 mal roscore-start[402]: ERROR: could not contact master [http://127.0.0.1:11311]
 1月 15 15:50:55 mal roscore-start[402]: The traceback for the exception was written to the log file
 1月 15 15:50:55 mal roscore-start[402]: Checking log directory for disk usage. This may take awhile.
 1月 15 15:50:55 mal roscore-start[402]: Press Ctrl-C to interrupt
 1月 15 15:50:55 mal roscore-start[402]: Done checking log file disk usage. Usage is <1GB.
 1月 15 15:50:55 mal roscore-start[402]: [24B blob data]
 1月 15 15:50:55 mal roscore-start[402]: started roslaunch server http://mal:40124/
 1月 15 15:50:55 mal roscore-start[402]: SUMMARY
 1月 15 15:50:55 mal roscore-start[402]: ========
 1月 15 15:50:55 mal roscore-start[402]: PARAMETERS
 1月 15 15:50:55 mal roscore-start[402]:  * /rosdistro: kinetic
 1月 15 15:50:55 mal roscore-start[402]:  * /rosversion: 1.12.6
 1月 15 15:50:55 mal roscore-start[402]: NODES
 1月 15 15:50:55 mal roscore-start[402]:   /mal_upstart/
 1月 15 15:50:55 mal roscore-start[402]:     integrator (mal_perception/integrator.py)
 1月 15 15:50:55 mal roscore-start[402]: auto-starting new master
 1月 15 15:50:55 mal roscore-start[402]: process[master]: started with pid [1015]
 1月 15 15:50:55 mal roscore-start[402]: Traceback (most recent call last):
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/bin/rosmaster", line 35, in <module>
 1月 15 15:50:55 mal roscore-start[402]:     rosmaster.rosmaster_main()
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/main.py", line 80, in rosmaster_main
 1月 15 15:50:55 mal roscore-start[402]:     configure_logging()
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosmaster/main.py", line 58, in configure_logging
 1月 15 15:50:55 mal roscore-start[402]:     _log_filename = rosgraph.roslogging.configure_logging('rosmaster', logging.DEBUG, filename=filename)
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/roslogging.py", line 126, in configure_logging
 1月 15 15:50:55 mal roscore-start[402]:     logging.config.fileConfig(config_file, disable_existing_loggers=False)
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/logging/config.py", line 85, in fileConfig
 1月 15 15:50:55 mal roscore-start[402]:     handlers = _install_handlers(cp, formatters)
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/logging/config.py", line 163, in _install_handlers
 1月 15 15:50:55 mal roscore-start[402]:     h = klass(*args)
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/lib/python2.7/dist-packages/rosgraph/roslogging.py", line 167, in __init__
 1月 15 15:50:55 mal roscore-start[402]:     from rospy.rostime import get_time, is_wallclock
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/__init__.py", line 49, in <module>
 1月 15 15:50:55 mal roscore-start[402]:     from .client import spin, myargv, init_node, \
 1月 15 15:50:55 mal roscore-start[402]:   File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/client.py", line 47, in <module>
 1月 15 15:50:55 mal roscore-start[402]:     import yaml
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/dist-packages/yaml/__init__.py", line 8, in <module>
 1月 15 15:50:55 mal roscore-start[402]:     from loader import *
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/dist-packages/yaml/loader.py", line 4, in <module>
 1月 15 15:50:55 mal roscore-start[402]:     from reader import *
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/dist-packages/yaml/reader.py", line 47, in <module>
 1月 15 15:50:55 mal roscore-start[402]:     class Reader(object):
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/dist-packages/yaml/reader.py", line 140, in Reader
 1月 15 15:50:55 mal roscore-start[402]:     NON_PRINTABLE = re.compile(u'[^\x09\x0A\x0D\x20-\x7E\x85\xA0-\uD7FF\uE000-\uFFFD\U00010000-\U0010ffff]')
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/re.py", line 194, in compile
 1月 15 15:50:55 mal roscore-start[402]:     return _compile(pattern, flags)
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/re.py", line 249, in _compile
 1月 15 15:50:55 mal roscore-start[402]:     p = sre_compile.compile(pattern, flags)
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/sre_compile.py", line 576, in compile
 1月 15 15:50:55 mal roscore-start[402]:     code = _code(p, flags)
 1月 15 15:50:55 mal roscore-start[402]:   File "/usr/lib/python2.7/sre_compile.py", line 561, in _code```

When I caught such error, I suspected timing of launching service. So I add following line to the service file in /lib/systemd/system/roscore.service (in this case "roscore").

[Timer]
OnBootSec=1min

And I reboot the PC, the service and launch file is launched correctly after a minute. I'm not sure why this happens.

Sorry, this is only report. but if I have some time to see the code. I will.

Thanks.