$search
00001 #!/usr/bin/python 00002 ################################################################# 00003 ##\file 00004 # 00005 # \note 00006 # Copyright (c) 2011 \n 00007 # Cardiff University \n\n 00008 # 00009 ################################################################# 00010 # 00011 # \note 00012 # Project name: Multi-Role Shadow Robotic System for Independent Living 00013 # \note 00014 # ROS stack name: srs 00015 # \note 00016 # ROS package name: srs_decision_making 00017 # 00018 # \author 00019 # Author: Renxi Qiu, email: renxi.qiu@gmail.com 00020 # 00021 # \date Date of creation: Oct 2011 00022 # 00023 # \brief 00024 # Task coordination and interfacing for SRS decision making 00025 # 00026 ################################################################# 00027 # 00028 # Redistribution and use in source and binary forms, with or without 00029 # modification, are permitted provided that the following conditions are met: 00030 # 00031 # - Redistributions of source code must retain the above copyright 00032 # notice, this list of conditions and the following disclaimer. \n 00033 # 00034 # - Redistributions in binary form must reproduce the above copyright 00035 # notice, this list of conditions and the following disclaimer in the 00036 # documentation and/or other materials provided with the distribution. \n 00037 # 00038 # This program is free software: you can redistribute it and/or modify 00039 # it under the terms of the GNU Lesser General Public License LGPL as 00040 # published by the Free Software Foundation, either version 3 of the 00041 # License, or (at your option) any later version. 00042 # 00043 # This program is distributed in the hope that it will be useful, 00044 # but WITHOUT ANY WARRANTY; without even the implied warranty of 00045 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00046 # GNU Lesser General Public License LGPL for more details. 00047 # 00048 # You should have received a copy of the GNU Lesser General Public 00049 # License LGPL along with this program. 00050 # If not, see <http://www.gnu.org/licenses/>. 00051 # 00052 ################################################################# 00053 00054 """ 00055 This file contains settings for robot configuration 00056 00057 """ 00058 00059 class Ddict(dict): 00060 def __init__(self, default=None): 00061 self.default = default 00062 00063 def __getitem__(self, key): 00064 if not self.has_key(key): 00065 self[key] = self.default() 00066 return dict.__getitem__(self, key) 00067 00068 00069 component_list = ['torso','tray','arm','sdh','head'] 00070 00071 00072 robot_config_pre = Ddict(dict) 00073 00074 robot_config_post = Ddict(dict) 00075 00076 #DM = doesn't matter 00077 #NC = no change required 00078 #CALCULATION = need to be calculated on-line, 00079 #in this program CALCULATION is same as NC, as the calculation is carried out already during action, the is no change required for pre post check. 00080 # 00081 robot_config_need_no_action = ['DM','NC','CALCULATION'] 00082 00083 #Navigation with no object 00084 #pre-config 00085 robot_config_pre['navigation_no_object']['torso']='home' 00086 robot_config_pre['navigation_no_object']['tray']='down' 00087 robot_config_pre['navigation_no_object']['arm']='look_at_table-to-folded' 00088 robot_config_pre['navigation_no_object']['sdh']='home' 00089 robot_config_pre['navigation_no_object']['head']='front' 00090 #post-config 00091 robot_config_post['navigation_no_object']['torso']='DM' 00092 robot_config_post['navigation_no_object']['tray']='NC' 00093 robot_config_post['navigation_no_object']['arm']='NC' 00094 robot_config_post['navigation_no_object']['sdh']='DM' 00095 robot_config_post['navigation_no_object']['head']='front' 00096 00097 00098 #Navigation with object on tray and no object in sdh 00099 #pre-config 00100 robot_config_pre['navigation_object_on_tray']['torso']='home' 00101 robot_config_pre['navigation_object_on_tray']['tray']='NC' 00102 robot_config_pre['navigation_object_on_tray']['arm']='folded' 00103 robot_config_pre['navigation_object_on_tray']['sdh']='DM' 00104 robot_config_pre['navigation_object_on_tray']['head']='front' 00105 #post-config 00106 robot_config_post['navigation_object_on_tray']['torso']="DM" 00107 robot_config_post['navigation_object_on_tray']['tray']='NC' 00108 robot_config_post['navigation_object_on_tray']['arm']='NC' 00109 robot_config_post['navigation_object_on_tray']['sdh']='DM' 00110 robot_config_post['navigation_object_on_tray']['head']='front' 00111 00112 00113 #Navigation with no object on tray but with object in sdh 00114 #pre-config 00115 robot_config_pre['navigation_object_in_sdh']['torso']='home' 00116 robot_config_pre['navigation_object_in_sdh']['tray']='down' 00117 robot_config_pre['navigation_object_in_sdh']['arm']='hold' 00118 robot_config_pre['navigation_object_in_sdh']['sdh']='NC' #should be closed, but the exact location is calculated early during grasp 00119 robot_config_pre['navigation_object_in_sdh']['head']='front' 00120 #post config 00121 robot_config_post['navigation_object_in_sdh']['torso']="DM" 00122 robot_config_post['navigation_object_in_sdh']['tray']='NC' 00123 robot_config_post['navigation_object_in_sdh']['arm']='NC' 00124 robot_config_post['navigation_object_in_sdh']['sdh']='NC' #should be closed, but the exact location is calculated early 00125 robot_config_post['navigation_object_in_sdh']['head']='front' 00126 #Instead of hold we could also use folded, this depends on the object we are handling. In any cases the arm has to be closed 00127 #to the torso so that nothing is out of the rectangular footprint of the robot 00128 #we should be able to check what object need to be hold or hold 00129 00130 #Navigation with object on tray and object in sdh 00131 #pre-config 00132 robot_config_pre['navigation_object_on_tray_and_sdh']['torso']='home' 00133 robot_config_pre['navigation_object_on_tray_and_sdh']['tray']='NC' 00134 robot_config_pre['navigation_object_on_tray_and_sdh']['arm']='NC' 00135 robot_config_pre['navigation_object_on_tray_and_sdh']['sdh']='NC' #should be closed, but the exact location is calculated early during grasp 00136 robot_config_pre['navigation_object_on_tray_and_sdh']['head']='front' 00137 #post config 00138 robot_config_post['navigation_object_on_tray_and_sdh']['torso']="DM" 00139 robot_config_post['navigation_object_on_tray_and_sdh']['tray']='NC' 00140 robot_config_post['navigation_object_on_tray_and_sdh']['arm']='NC' 00141 robot_config_post['navigation_object_on_tray_and_sdh']['sdh']='NC' #should be closed, but the exact location is calculated early 00142 robot_config_post['navigation_object_on_tray_and_sdh']['head']='front' 00143 00144 00145 #detection 00146 #pre-config 00147 robot_config_pre['detection']['torso']='DM' 00148 robot_config_pre['detection']['tray']='down' 00149 robot_config_pre['detection']['arm']='folded' 00150 robot_config_pre['detection']['sdh']='cylclosed' 00151 robot_config_pre['detection']['head']='DM' 00152 #post-config 00153 robot_config_post['detection']['torso']='home' 00154 robot_config_post['detection']['tray']='NC' 00155 robot_config_post['detection']['arm']='NC' 00156 robot_config_post['detection']['sdh']='cylclosed' 00157 robot_config_post['detection']['head']='front' 00158 00159 #environment update 00160 #pre-config 00161 robot_config_pre['enviroment_update']['torso']='DM' 00162 robot_config_pre['enviroment_update']['tray']='down' 00163 robot_config_pre['enviroment_update']['arm']='folded' 00164 robot_config_pre['enviroment_update']['sdh']='DM' 00165 robot_config_pre['enviroment_update']['head']='DM' 00166 #post-config 00167 robot_config_post['enviroment_update']['torso']='home' 00168 robot_config_post['enviroment_update']['tray']='NC' 00169 robot_config_post['enviroment_update']['arm']='NC' 00170 robot_config_post['enviroment_update']['sdh']='DM' 00171 robot_config_post['enviroment_update']['head']='front' 00172 00173 00174 #grasp (including detection for grasp + grasp after detection) 00175 #pre-config 00176 robot_config_pre['grasp']['torso']='DM' 00177 robot_config_pre['grasp']['tray']='down' 00178 robot_config_pre['grasp']['arm']='folded-to-look_at_table' 00179 robot_config_pre['grasp']['sdh']='DM' 00180 robot_config_pre['grasp']['head']='back' 00181 #post-config 00182 robot_config_post['grasp']['torso']='DM' 00183 robot_config_post['grasp']['tray']='NC' 00184 robot_config_post['grasp']['arm']='CALCULATION' # can be used for both put object on tray and hold object 00185 robot_config_post['grasp']['sdh']='CALCULATION' #should be closed, but the exact location should have been calculated 00186 robot_config_post['grasp']['head']='DM' 00187 00188 #Put object on tray 00189 #pre-config 00190 robot_config_pre['put_on_tray']['torso']='home' 00191 robot_config_pre['put_on_tray']['tray']='up' 00192 robot_config_pre['put_on_tray']['arm']='NC' 00193 robot_config_pre['put_on_tray']['sdh']='NC' 00194 robot_config_pre['put_on_tray']['head']='NC' 00195 #post-config 00196 robot_config_post['put_on_tray']['torso']="home" 00197 robot_config_post['put_on_tray']['tray']='NC' 00198 robot_config_post['put_on_tray']['arm']='folded' 00199 robot_config_post['put_on_tray']['sdh']='home' 00200 robot_config_post['put_on_tray']['head']='front' 00201 00202 #place object on table 00203 #pre-config 00204 #To be added 00205 #post-config 00206 #To be added