start-jsk / rtmros_hironx

hironx controller and applications using rtmros packages
http://wiki.ros.org/rtmros_hironx
10 stars 27 forks source link

[ros_bridge] Improve error message when no running ROS found. #496

Closed 130s closed 7 years ago

130s commented 7 years ago

Python's stacktrace for this particular exception doesn't mean much to users nor developers. Besides, the errormsg is meaningful enough. And errormsg variable was undefined.

$ ipython -i `rospack find hironx_ros_bridge`/script/hironx.py -- --host hironx
:
[hrpsys.py] initialized successfully
---------------------------------------------------------------------------
ROSInitException                          Traceback (most recent call last)
/usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)
    202             else:
    203                 filename = fname
--> 204             __builtin__.execfile(filename, *where)

/opt/ros/indigo/share/nextage_ros_bridge/script/nextage.py in <module>()
     81
     82     # ROS Client.
---> 83     ros = ROS_Client()
     84
     85 # for simulated robot

/opt/ros/indigo/lib/python2.7/dist-packages/hironx_ros_bridge/ros_client.pyc in __init__(self, jointgroups)
     85             errormsg = 'No ROS Master found. Without it, you cannot use ROS from this script, but you can still use RTM without issues. ' + \
     86                        'To use ROS, do not forget to run rosbridge. How to do so? --> http://wiki.ros.org/rtmros_nextage/Tutorials/Operating%20Hiro%2C%20NEXTAGE%20OPEN'
---> 87             raise ROSInitException(errormsg)
     88         except Exception as e:
     89             errormsg = '[ros_client] Unknown exception occurred, so do not create ros client...'

ROSInitException: No ROS Master found. Without it, you cannot use ROS from this script, but you can still use RTM without issues. To use ROS, do not forget to run rosbridge. How to do so? --> http://wiki.ros.org/rtmros_nextage/Tutorials/Operating%20Hiro%2C%20NEXTAGE%20OPEN