main.py
Go to the documentation of this file.
00001 #!/usr/bin/env python
00002 #
00003 # License: BSD
00004 #   https://raw.github.com/robotics-in-concert/rocon_multimaster/master/multimaster_server/rocon_hub/LICENSE
00005 #
00006 
00007 import sys
00008 
00009 # Ros imports
00010 import roslib
00011 roslib.load_manifest('rocon_hub')
00012 import rospy
00013 
00014 # Local imports
00015 from . import utils
00016 from . import redis_server
00017 from . import ros_parameters
00018 from . import zeroconf
00019 
00020 ##############################################################################
00021 # Main
00022 ##############################################################################
00023 
00024 
00025 def main():
00026     # Ros
00027     while not utils.check_master():
00028         rospy.logerr("Unable to communicate with master!")
00029         rospy.sleep(1.0)
00030         if rospy.is_shutdown():
00031             sys.exit(utils.red_string("Unable to communicate with master!"))
00032     rospy.init_node('hub')
00033     param = ros_parameters.load()
00034 
00035     # Installation checks - sys exits if the process if not installed.
00036     utils.check_if_executable_available('redis-server')
00037     if param['zeroconf']:
00038         utils.check_if_executable_available('avahi-daemon')
00039 
00040     redi = redis_server.RedisServer(param)
00041     redi.start()  # sys exits if server connection is unavailable
00042 
00043     if param['zeroconf']:
00044         zeroconf.advertise_port_to_avahi(param['port'], param['name'])  # sys exits if running avahi-daemon not found
00045 
00046     rospy.spin()
00047     redi.shutdown()
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Friends


rocon_hub
Author(s): Daniel Stonier, Jihoon Lee
autogenerated on Tue Jan 15 2013 17:43:33