config.py
Go to the documentation of this file.
00001 
00002 import os
00003 import yaml
00004 
00005 # config data
00006 gRequireUsername = 0
00007 
00008 gWebUser = "apache"
00009 gWebUserID = None  # apache
00010 gWebGroupID = None # apache
00011 
00012 gBaseURL = "/webui/"
00013 gROSURL = "/ros"
00014 
00015 gAuthVCode = 1574444059
00016 gAuthSalt = "ir"
00017 
00018 gWebUserID = 33  # apache
00019 gWebGroupID = 33 # apache
00020 
00021 gDomain = "willowgarage.com"
00022 gROSBridgePort = ":8068"
00023 
00024 LOGIN_TIMEOUT = 60*60*4
00025 
00026 # 1 hour
00027 REFRESH_COOKIE_TIMEOUT = 60*60
00028 
00029 ROS_VAR_DIR = os.environ.get("ROS_VAR_DIR", "/var/ros")
00030 if ROS_VAR_DIR == "":
00031   ROS_VAR_DIR = "/var/ros"
00032 
00033 ACTIVE_USER_FILE = os.path.join(ROS_VAR_DIR, "active_user.dat")
00034 ACTIVE_USER_TIMEOUT = 3600 # after one hour of inactivity, the active user will stop being active
00035 
00036 VALID_USER_COOKIE_FILE = os.path.join(ROS_VAR_DIR, "user_cookie.dat")
00037 
00038 gDBPath = os.path.join(ROS_VAR_DIR, "db")
00039 
00040 ROS_CONFIG_DIR = "/etc/ros/env"
00041 ROS_CONFIG_FILE = "/etc/ros/robot.yaml"
00042 
00043 def getSiteDBPath(module):
00044   path = os.path.join(gDBPath, module)
00045   return path
00046   
00047 def getDBPath(module):
00048   path = os.path.join(gDBPath, module)
00049   return path
00050   
00051 def createDBPath(path):
00052   if not os.path.isdir(path):
00053     os.makedirs(path, 0700)
00054     #webChown(path)
00055   
00056 def webChown(path):
00057   if gWebUserID is not None and gWebGroupID is not None:
00058     os.chown(path, gWebUserID, gWebGroupID)
00059   
00060 def get_robot_type():
00061   if os.path.exists(ROS_CONFIG_FILE):
00062     try:
00063       with open(ROS_CONFIG_FILE, 'r') as conf:
00064         return yaml.load(conf)['robot']['type']
00065     except:
00066       pass
00067   try:
00068     return open(os.path.join(ROS_CONFIG_DIR, "ROBOT")).read().strip()
00069   except IOError:
00070     return "desktop"
00071   
00072 def get_robot_name():
00073   if os.path.exists(ROS_CONFIG_FILE):
00074     try:
00075       with open(ROS_CONFIG_FILE, 'r') as conf:
00076         return yaml.load(conf)['robot']['name']
00077     except:
00078       pass
00079   try:
00080     return open(os.path.join(ROS_CONFIG_DIR, "ROBOT_NAME")).read().strip()
00081   except IOError:
00082     return "localhost"
00083   
00084 if get_robot_type().startswith("texas"):
00085     gDefaultModule = "app/texas_web_teleop/texas_web_teleop"
00086 else:
00087     gDefaultModule = "webui"
00088     
00089 gDefaultPage = "webui"
00090 
00091 gLobby = None
00092 gHomeServer = None
00093 
00094 if get_robot_type().startswith("texas"):
00095     gLobby = "http://priv1.texai.com"
00096     gLobbyHost = "priv1.texai.com"
00097     gHomeServer = gLobby + "/lobby/lobby/robot_data.py"
00098     gDomain = "texai.com"
00099     gROSBridgePort = ""
00100     gLobbyReturnPage = "https://www.texai.com/lobby/lobby/disconnect.py"


webui
Author(s): Scott Hassan/hassan@willowgarage.com
autogenerated on Wed Apr 23 2014 10:36:00