rem
stringlengths 0
322k
| add
stringlengths 0
2.05M
| context
stringlengths 8
228k
|
---|---|---|
script_server()
|
SCRIPT = script_server() SCRIPT.Start()
|
def execute_cb(self, server_goal): server_result = MoveActionResult().result server_result.return_value = self.sss.move(server_goal.component_name.data,server_goal.parameter_name.data) if server_result.return_value == 0: print "success" self.move_action_server.set_succeeded(server_result) else: print "error" self.move_action_server.set_aborted(server_result)
|
self.sss.move("sdh","cup")
|
self.sss.move("sdh","cylclosed")
|
def Run(self): listener = tf.TransformListener(True, rospy.Duration(10.0)) # prepare for grasping self.sss.move("base","kitchen") handle01 = self.sss.move("arm","pregrasp",False) self.sss.move("sdh","cylopen") handle01.wait()
|
n = pynotify.Notification("Emergency Stop issued!", "", "dialog-warning") icon=gtk.status_icon_new_from_icon_name("important") n.attach_to_status_icon(icon) n.set_timeout(1000) n.show()
|
if(self.em_stop == False): self.em_stop = True n = pynotify.Notification("Emergency Stop issued!", "", "dialog-warning") n.set_timeout(1) n.show()
|
def setEMStop(self, em): if(em): #print "Emergency Stop Active" self.status_image.set_from_file(roslib.packages.get_pkg_dir("cob_dashboard") + "/share/icons/weather-storm.png") self.status_label.set_text("EM Stop !") n = pynotify.Notification("Emergency Stop issued!", "", "dialog-warning") icon=gtk.status_icon_new_from_icon_name("important") n.attach_to_status_icon(icon) n.set_timeout(1000) n.show() else: #print "Status OK" self.status_image.set_from_file(roslib.packages.get_pkg_dir("cob_dashboard") + "/share/icons/weather-clear.png") self.status_label.set_text("Status OK") n = pynotify.Notification("Emergency Stop released!", "", "dialog-ok") n.set_timeout(1000) n.show()
|
n = pynotify.Notification("Emergency Stop released!", "", "dialog-ok") n.set_timeout(1000) n.show()
|
if(self.em_stop == True): self.em_stop = False n = pynotify.Notification("Emergency Stop released!", "", "dialog-ok") n.set_timeout(1) n.show()
|
def setEMStop(self, em): if(em): #print "Emergency Stop Active" self.status_image.set_from_file(roslib.packages.get_pkg_dir("cob_dashboard") + "/share/icons/weather-storm.png") self.status_label.set_text("EM Stop !") n = pynotify.Notification("Emergency Stop issued!", "", "dialog-warning") icon=gtk.status_icon_new_from_icon_name("important") n.attach_to_status_icon(icon) n.set_timeout(1000) n.show() else: #print "Status OK" self.status_image.set_from_file(roslib.packages.get_pkg_dir("cob_dashboard") + "/share/icons/weather-clear.png") self.status_label.set_text("Status OK") n = pynotify.Notification("Emergency Stop released!", "", "dialog-ok") n.set_timeout(1000) n.show()
|
def SetOperationMode(self,component_name,mode):
|
def SetOperationMode(self,component_name,mode,blocking=False):
|
def SetOperationMode(self,component_name,mode): rospy.loginfo("setting <<%s>> to operation mode <<%s>>",component_name, mode) rospy.set_param(component_name + "_controller/OperationMode",mode)
|
rospy.set_param(component_name + "_controller/OperationMode",mode)
|
rospy.set_param("/" + component_name + "_controller/OperationMode",mode)
|
def SetOperationMode(self,component_name,mode): rospy.loginfo("setting <<%s>> to operation mode <<%s>>",component_name, mode) rospy.set_param(component_name + "_controller/OperationMode",mode)
|
print "Width: ", self.allocation.width print "Height: ", self.allocation.height
|
def do_expose_event(self, event): # Create the cairo context cr = self.window.cairo_create() print "Width: ", self.allocation.width print "Height: ", self.allocation.height # Restrict Cairo to the exposed area; avoid extra work cr.rectangle(event.area.x, event.area.y, event.area.width, event.area.height) cr.clip() self.draw(cr, self.allocation.width,self.allocation.height )
|
|
xw = height/(self.sizex+1) print height, ", ", self.sizex yw = width/(self.sizey+1) print "Divider: ", xw, ", ", yw for i in range(0,self.sizey): for j in range(0,self.sizex):
|
xw = width/(self.sizex) yw = height/(self.sizey) for i in range(0,self.sizex): for j in range(0,self.sizey):
|
def draw(self, cr, width, height): # Fill the background with gray color = 0.5 xw = height/(self.sizex+1) print height, ", ", self.sizex yw = width/(self.sizey+1) print "Divider: ", xw, ", ", yw for i in range(0,self.sizey): for j in range(0,self.sizex): if(color==0.0): color=1.0 else: color=0.0 cr.set_source_rgb(color, 1-color, 0.5) print (j)*yw,":", (i)*xw,":", (j+1)*yw,":", (i+1) * xw cr.rectangle((j)*xw, (i)*yw, xw, yw) cr.fill()
|
print (j)*yw,":", (i)*xw,":", (j+1)*yw,":", (i+1) * xw cr.rectangle((j)*xw, (i)*yw, xw, yw)
|
cr.rectangle((i)*xw, (j)*yw, xw, yw)
|
def draw(self, cr, width, height): # Fill the background with gray color = 0.5 xw = height/(self.sizex+1) print height, ", ", self.sizex yw = width/(self.sizey+1) print "Divider: ", xw, ", ", yw for i in range(0,self.sizey): for j in range(0,self.sizex): if(color==0.0): color=1.0 else: color=0.0 cr.set_source_rgb(color, 1-color, 0.5) print (j)*yw,":", (i)*xw,":", (j+1)*yw,":", (i+1) * xw cr.rectangle((j)*xw, (i)*yw, xw, yw) cr.fill()
|
button4 = gtk.Button("box.pack4") button5 = gtk.Button("box.pack5") button6 = gtk.Button("box.pack6")
|
sc4 = Screen() sc4.set_size_request((winwidth/3)-10, (winheight/2)-5) sc5 = Screen() sc5.set_size_request((winwidth/3)-10, (winheight/2)-5) sc6 = Screen() sc6.set_size_request((winwidth/3)-10, (winheight/2)-5)
|
def main_quit(obh, obb): global dget #Stopping the thread and the gtk's main loop dget.stop() gtk.main_quit()
|
hbox2=gtk.HBox(True,0) hbox2.pack_start(button4,False, False, 0) hbox2.pack_start(button5,False, False, 0) hbox2.pack_start(button6,False, False, 0)
|
hbox2=gtk.HBox(False,10) hbox2.pack_start(sc4,False, True, 0) hbox2.pack_start(sc5,False, True, 0) hbox2.pack_start(sc6,False, True, 0)
|
def main_quit(obh, obb): global dget #Stopping the thread and the gtk's main loop dget.stop() gtk.main_quit()
|
graph.add_edge(self.last_node, str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name)
|
if type(parameter_name) is types.StringType: graphstring = str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name else: graphstring = str(self.function_counter)+"_"+function_name+"_"+component_name graph.add_edge(self.last_node, graphstring)
|
def AppendGraph(self, function_name, component_name, parameter_name, blocking=True): global graph global graph_wait_list graph.add_edge(self.last_node, str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name) for waiter in graph_wait_list: graph.add_edge(waiter, str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name) graph_wait_list=[] ah = action_handle(simulation=True) if blocking: self.last_node = str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name else: ah.parent_node = str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name
|
graph.add_edge(waiter, str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name)
|
graph.add_edge(waiter, graphstring)
|
def AppendGraph(self, function_name, component_name, parameter_name, blocking=True): global graph global graph_wait_list graph.add_edge(self.last_node, str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name) for waiter in graph_wait_list: graph.add_edge(waiter, str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name) graph_wait_list=[] ah = action_handle(simulation=True) if blocking: self.last_node = str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name else: ah.parent_node = str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name
|
self.last_node = str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name else: ah.parent_node = str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name
|
self.last_node = graphstring else: ah.parent_node = graphstring
|
def AppendGraph(self, function_name, component_name, parameter_name, blocking=True): global graph global graph_wait_list graph.add_edge(self.last_node, str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name) for waiter in graph_wait_list: graph.add_edge(waiter, str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name) graph_wait_list=[] ah = action_handle(simulation=True) if blocking: self.last_node = str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name else: ah.parent_node = str(self.function_counter)+"_"+function_name+"_"+component_name+"_"+parameter_name
|
def wait(self, duration=None): global ah_counter ah_counter += 1 self.blocking = True self.wait_for_finished(duration,True) def wait_inside(self, duration=None): if self.blocking: self.wait_for_finished(duration,True) else: thread.start_new_thread(self.wait_for_finished,(duration,False,)) return self.error_code def wait_for_finished(self, duration, logging): global graph_wait_list if(self.simulate): if(self.parent_node != ""): graph_wait_list.append(self.parent_node) return if self.error_code <= 0: if duration is None: if logging: rospy.loginfo("Wait for <<%s>> reaching <<%s>>...",self.component_name, self.parameter_name) self.client.wait_for_result() else: if logging: rospy.loginfo("Wait for <<%s>> reached <<%s>> (max %f secs)...",self.component_name, self.parameter_name,duration) if not self.client.wait_for_result(rospy.Duration(duration)): if logging: rospy.logerr("Timeout while waiting for <<%s>> to reach <<%s>>. Continuing...",self.component_name, self.parameter_name) self.error_code = 10 return if logging: rospy.loginfo("...<<%s>> reached <<%s>>",self.component_name, self.parameter_name) else: rospy.logwarn("Execution of <<%s>> to <<%s>> was aborted, wait not possible. Continuing...",self.component_name, self.parameter_name) self.set_failed(self.error_code) return self.set_succeeded() def get_error_code(self): return self.error_code
|
def set_client(self,client): self.client = client
|
|
rospy.set_param(operation_mode_name, "position")
|
def move_traj(self,component_name,parameter_name,blocking): ah = action_handle("move", component_name, parameter_name, blocking, self.parse) if(self.parse): return ah else: ah.set_active() rospy.loginfo("Move <<%s>> to <<%s>>",component_name,parameter_name) # selecting component if component_name == "tray": joint_names = ["torso_tray_joint"] elif component_name == "torso": joint_names = ["torso_lower_neck_pan_joint","torso_lower_neck_tilt_joint","torso_upper_neck_pan_joint","torso_upper_neck_tilt_joint"] elif component_name == "arm": joint_names = ["arm_1_joint","arm_2_joint","arm_3_joint","arm_4_joint","arm_5_joint","arm_6_joint","arm_7_joint"] elif component_name == "sdh": joint_names = ["sdh_thumb_2_joint", "sdh_thumb_3_joint", "sdh_finger_11_joint", "sdh_finger_12_joint", "sdh_finger_13_joint", "sdh_finger_21_joint", "sdh_finger_22_joint", "sdh_finger_23_joint"] elif component_name == "head": joint_names = ["head_axis_joint"] else: rospy.logerr("component %s not known to script_server",component_name) ah.set_failed(1) return ah # get joint values from parameter server if type(parameter_name) is str: if not rospy.has_param(self.ns_global_prefix + "/" + component_name + "/" + parameter_name): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/" + component_name + "/" + parameter_name) ah.set_failed(2) return ah param = rospy.get_param(self.ns_global_prefix + "/" + component_name + "/" + parameter_name) else: param = parameter_name # check trajectory parameters if not type(param) is list: # check outer list rospy.logerr("no valid parameter for %s: not a list, aborting...",component_name) print "parameter is:",param ah.set_failed(3) return ah else: for i in param: #print i,"type1 = ", type(i) if not type(i) is list: # check inner list rospy.logerr("no valid parameter for %s: not a list of lists, aborting...",component_name) print "parameter is:",param ah.set_failed(3) return ah else: if not len(i) == len(joint_names): # check dimension rospy.logerr("no valid parameter for %s: dimension should be %d and is %d, aborting...",component_name,len(joint_names),len(i)) print "parameter is:",param ah.set_failed(3) return ah else: for j in i: #print j,"type2 = ", type(j) if not ((type(j) is float) or (type(j) is int)): # check type #print type(j) rospy.logerr("no valid parameter for %s: not a list of float or int, aborting...",component_name) print "parameter is:",param ah.set_failed(3) return ah else: rospy.logdebug("accepted parameter %f for %s",j,component_name) # convert to trajectory message traj = JointTrajectory() traj.header.stamp = rospy.Time.now()+rospy.Duration(0.5) traj.joint_names = joint_names point_nr = 0 for i in param: point_nr = point_nr + 1 point = JointTrajectoryPoint() point.positions = i point.time_from_start=rospy.Duration(3*point_nr) # this value is set to 3 sec per point. \todo: read from parameter traj.points.append(point) # call action server operation_mode_name = "/" + component_name + '_controller/OperationMode' action_server_name = "/" + component_name + '_controller/joint_trajectory_action' rospy.set_param(operation_mode_name, "position") # \todo remove and replace with service call rospy.logdebug("calling %s action server",action_server_name) self.client = actionlib.SimpleActionClient(action_server_name, JointTrajectoryAction) # trying to connect to server rospy.logdebug("waiting for %s action server to start",action_server_name) if not self.client.wait_for_server(rospy.Duration(5)): # error: server did not respond rospy.logerr("%s action server not ready within timeout, aborting...", action_server_name) ah.set_failed(4) return ah else: rospy.logdebug("%s action server ready",action_server_name)
|
|
self.set_operation_mode(component_name,"position")
|
def move_traj(self,component_name,parameter_name,blocking): ah = action_handle("move", component_name, parameter_name, blocking, self.parse) if(self.parse): return ah else: ah.set_active() rospy.loginfo("Move <<%s>> to <<%s>>",component_name,parameter_name) # selecting component if component_name == "tray": joint_names = ["torso_tray_joint"] elif component_name == "torso": joint_names = ["torso_lower_neck_pan_joint","torso_lower_neck_tilt_joint","torso_upper_neck_pan_joint","torso_upper_neck_tilt_joint"] elif component_name == "arm": joint_names = ["arm_1_joint","arm_2_joint","arm_3_joint","arm_4_joint","arm_5_joint","arm_6_joint","arm_7_joint"] elif component_name == "sdh": joint_names = ["sdh_thumb_2_joint", "sdh_thumb_3_joint", "sdh_finger_11_joint", "sdh_finger_12_joint", "sdh_finger_13_joint", "sdh_finger_21_joint", "sdh_finger_22_joint", "sdh_finger_23_joint"] elif component_name == "head": joint_names = ["head_axis_joint"] else: rospy.logerr("component %s not known to script_server",component_name) ah.set_failed(1) return ah # get joint values from parameter server if type(parameter_name) is str: if not rospy.has_param(self.ns_global_prefix + "/" + component_name + "/" + parameter_name): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/" + component_name + "/" + parameter_name) ah.set_failed(2) return ah param = rospy.get_param(self.ns_global_prefix + "/" + component_name + "/" + parameter_name) else: param = parameter_name # check trajectory parameters if not type(param) is list: # check outer list rospy.logerr("no valid parameter for %s: not a list, aborting...",component_name) print "parameter is:",param ah.set_failed(3) return ah else: for i in param: #print i,"type1 = ", type(i) if not type(i) is list: # check inner list rospy.logerr("no valid parameter for %s: not a list of lists, aborting...",component_name) print "parameter is:",param ah.set_failed(3) return ah else: if not len(i) == len(joint_names): # check dimension rospy.logerr("no valid parameter for %s: dimension should be %d and is %d, aborting...",component_name,len(joint_names),len(i)) print "parameter is:",param ah.set_failed(3) return ah else: for j in i: #print j,"type2 = ", type(j) if not ((type(j) is float) or (type(j) is int)): # check type #print type(j) rospy.logerr("no valid parameter for %s: not a list of float or int, aborting...",component_name) print "parameter is:",param ah.set_failed(3) return ah else: rospy.logdebug("accepted parameter %f for %s",j,component_name) # convert to trajectory message traj = JointTrajectory() traj.header.stamp = rospy.Time.now()+rospy.Duration(0.5) traj.joint_names = joint_names point_nr = 0 for i in param: point_nr = point_nr + 1 point = JointTrajectoryPoint() point.positions = i point.time_from_start=rospy.Duration(3*point_nr) # this value is set to 3 sec per point. \todo: read from parameter traj.points.append(point) # call action server operation_mode_name = "/" + component_name + '_controller/OperationMode' action_server_name = "/" + component_name + '_controller/joint_trajectory_action' rospy.set_param(operation_mode_name, "position") # \todo remove and replace with service call rospy.logdebug("calling %s action server",action_server_name) self.client = actionlib.SimpleActionClient(action_server_name, JointTrajectoryAction) # trying to connect to server rospy.logdebug("waiting for %s action server to start",action_server_name) if not self.client.wait_for_server(rospy.Duration(5)): # error: server did not respond rospy.logerr("%s action server not ready within timeout, aborting...", action_server_name) ah.set_failed(4) return ah else: rospy.logdebug("%s action server ready",action_server_name)
|
|
pub = rospy.Publisher('light_controller/command', Light) rospy.sleep(0.5)
|
def set_light(self,parameter_name): ah = action_handle() ah.component_name = "light" ah.parameter_name = parameter_name rospy.loginfo("Set light to %s",parameter_name) pub = rospy.Publisher('light_controller/command', Light) rospy.sleep(0.5) # we have to wait here until publisher is ready, don't ask why # get joint values from parameter server if type(parameter_name) is str: if not rospy.has_param(self.ns_global_prefix + "/light/" + parameter_name): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/light/" + parameter_name) return 2 param = rospy.get_param(self.ns_global_prefix + "/light/" + parameter_name) else: param = parameter_name # check color parameters if not type(param) is list: # check outer list rospy.logerr("no valid parameter for light: not a list, aborting...") print "parameter is:",param ah.error_code = 3 return ah else: if not len(param) == 3: # check dimension rospy.logerr("no valid parameter for light: dimension should be 3 (r,g,b) and is %d, aborting...",len(param)) print "parameter is:",param ah.error_code = 3 return ah else: for i in param: #print i,"type1 = ", type(i) if not ((type(i) is float) or (type(i) is int)): # check type #print type(i) rospy.logerr("no valid parameter for light: not a list of float or int, aborting...") print "parameter is:",param ah.error_code = 3 return ah else: rospy.logdebug("accepted parameter %f for light",i) # convert to light message color = Light() color.header.stamp = rospy.Time.now() if type(parameter_name) is str: color.name.data = parameter_name else: color.name.data = "unspecified" color.r = param[0] color.g = param[1] color.b = param[2]
|
|
pub.publish(color)
|
self.pub_light.publish(color) ah.set_succeeded()
|
def set_light(self,parameter_name): ah = action_handle() ah.component_name = "light" ah.parameter_name = parameter_name rospy.loginfo("Set light to %s",parameter_name) pub = rospy.Publisher('light_controller/command', Light) rospy.sleep(0.5) # we have to wait here until publisher is ready, don't ask why # get joint values from parameter server if type(parameter_name) is str: if not rospy.has_param(self.ns_global_prefix + "/light/" + parameter_name): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/light/" + parameter_name) return 2 param = rospy.get_param(self.ns_global_prefix + "/light/" + parameter_name) else: param = parameter_name # check color parameters if not type(param) is list: # check outer list rospy.logerr("no valid parameter for light: not a list, aborting...") print "parameter is:",param ah.error_code = 3 return ah else: if not len(param) == 3: # check dimension rospy.logerr("no valid parameter for light: dimension should be 3 (r,g,b) and is %d, aborting...",len(param)) print "parameter is:",param ah.error_code = 3 return ah else: for i in param: #print i,"type1 = ", type(i) if not ((type(i) is float) or (type(i) is int)): # check type #print type(i) rospy.logerr("no valid parameter for light: not a list of float or int, aborting...") print "parameter is:",param ah.error_code = 3 return ah else: rospy.logdebug("accepted parameter %f for light",i) # convert to light message color = Light() color.header.stamp = rospy.Time.now() if type(parameter_name) is str: color.name.data = parameter_name else: color.name.data = "unspecified" color.r = param[0] color.g = param[1] color.b = param[2]
|
rospy.loginfo("setting <<%s>> to operation mode <<%s>>",component_name, mode)
|
def set_operation_mode(self,component_name,mode,blocking=False): rospy.loginfo("setting <<%s>> to operation mode <<%s>>",component_name, mode) rospy.set_param("/" + component_name + "_controller/OperationMode",mode) # \todo remove and only use service call #rospy.wait_for_service("/" + component_name + "_controller/set_operation_mode") try: set_operation_mode = rospy.ServiceProxy("/" + component_name + "_controller/set_operation_mode", SetOperationMode) req = SetOperationModeRequest() req.operationMode.data = mode #print req resp = set_operation_mode(req) #print resp except rospy.ServiceException, e: print "Service call failed: %s"%e
|
|
req.operationMode.data = mode
|
req.operation_mode.data = mode
|
def set_operation_mode(self,component_name,mode,blocking=False): rospy.loginfo("setting <<%s>> to operation mode <<%s>>",component_name, mode) rospy.set_param("/" + component_name + "_controller/OperationMode",mode) # \todo remove and only use service call #rospy.wait_for_service("/" + component_name + "_controller/set_operation_mode") try: set_operation_mode = rospy.ServiceProxy("/" + component_name + "_controller/set_operation_mode", SetOperationMode) req = SetOperationModeRequest() req.operationMode.data = mode #print req resp = set_operation_mode(req) #print resp except rospy.ServiceException, e: print "Service call failed: %s"%e
|
def Speak(self,parameter_name,mode="DEFAULT")
|
def Speak(self,parameter_name,mode="DEFAULT"):
|
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech with the English Festival voice CEPS_EN - use Text-to-speech with the English Cepstral voice David CEPS_DE - use Text-to-speech with the German Cepstral voice Matthias MUTE - play no sound at all """ rospy.loginfo("Speak <<%s>> in mode <<%s>>",parameter_name,mode) # get mode from global parameter if necessary if mode == "DEFAULT": if not rospy.has_param(self.ns_global_prefix + "/sound/speech_mode"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_mode") ah.error_code = 2 return ah mode = rospy.get_param(self.ns_global_prefix + "/sound/speech_mode") # play sound depending on the mode that was chosen elif mode == "WAV_DE": rospy.loginfo("Playing German WAV file %s",param_name) # get path for German WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_de_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_de_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_de_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "WAV_EN": rospy.loginfo("Playing English WAV file %s",param_name) # get path for English WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_en_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_en_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_en_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "FEST_EN": # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Festival Voice for speaking '%s'",text_string) # send text string to TTS system soundhandle.say(text_string) return 0 elif mode == "CEPS_EN"): # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Cepstral Voice David for speaking '%s'",text_string) # send text string to TTS system returnVal = os.system("swift -n \"Matthias\" -e \"utf-8\" \"" + str + "\"") return 0
|
elif mode == "WAV_DE":
|
if mode == "WAV_DE":
|
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech with the English Festival voice CEPS_EN - use Text-to-speech with the English Cepstral voice David CEPS_DE - use Text-to-speech with the German Cepstral voice Matthias MUTE - play no sound at all """ rospy.loginfo("Speak <<%s>> in mode <<%s>>",parameter_name,mode) # get mode from global parameter if necessary if mode == "DEFAULT": if not rospy.has_param(self.ns_global_prefix + "/sound/speech_mode"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_mode") ah.error_code = 2 return ah mode = rospy.get_param(self.ns_global_prefix + "/sound/speech_mode") # play sound depending on the mode that was chosen elif mode == "WAV_DE": rospy.loginfo("Playing German WAV file %s",param_name) # get path for German WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_de_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_de_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_de_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "WAV_EN": rospy.loginfo("Playing English WAV file %s",param_name) # get path for English WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_en_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_en_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_en_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "FEST_EN": # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Festival Voice for speaking '%s'",text_string) # send text string to TTS system soundhandle.say(text_string) return 0 elif mode == "CEPS_EN"): # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Cepstral Voice David for speaking '%s'",text_string) # send text string to TTS system returnVal = os.system("swift -n \"Matthias\" -e \"utf-8\" \"" + str + "\"") return 0
|
if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name)
|
if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name):
|
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech with the English Festival voice CEPS_EN - use Text-to-speech with the English Cepstral voice David CEPS_DE - use Text-to-speech with the German Cepstral voice Matthias MUTE - play no sound at all """ rospy.loginfo("Speak <<%s>> in mode <<%s>>",parameter_name,mode) # get mode from global parameter if necessary if mode == "DEFAULT": if not rospy.has_param(self.ns_global_prefix + "/sound/speech_mode"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_mode") ah.error_code = 2 return ah mode = rospy.get_param(self.ns_global_prefix + "/sound/speech_mode") # play sound depending on the mode that was chosen elif mode == "WAV_DE": rospy.loginfo("Playing German WAV file %s",param_name) # get path for German WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_de_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_de_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_de_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "WAV_EN": rospy.loginfo("Playing English WAV file %s",param_name) # get path for English WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_en_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_en_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_en_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "FEST_EN": # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Festival Voice for speaking '%s'",text_string) # send text string to TTS system soundhandle.say(text_string) return 0 elif mode == "CEPS_EN"): # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Cepstral Voice David for speaking '%s'",text_string) # send text string to TTS system returnVal = os.system("swift -n \"Matthias\" -e \"utf-8\" \"" + str + "\"") return 0
|
if not type(text_string) == str:
|
return Speak_Str(text_string,mode) elif mode == "CEPS_EN": if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) return Speak_Str(text_string,mode) elif mode == "CEPS_DE": if not rospy.has_param(self.ns_global_prefex + "/sound/speech_de/"+parameter_name): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_de/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_de/"+parameter_name) return Speak_Str(text_string,mode) elif mode == "MUTE": rospy.loginfo("Playing sound %s",param_name) return 0 else: rospy.lorerr("ROS has no sound mode %s!",mode) ah.error_code = 2 return ah def Speak_Str(self,text,mode): """ Speak the string 'text' via the TTS system specified by mode Possible modes are: FEST_EN - use Text-to-speech with the English Festival voice CEPS_EN - use Text-to-speech with the English Cepstral voice David CEPS_DE - use Text-to-speech with the German Cepstral voice Matthias MUTE - play no sound at all """ if mode == "FEST_EN": if not type(text) == str:
|
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech with the English Festival voice CEPS_EN - use Text-to-speech with the English Cepstral voice David CEPS_DE - use Text-to-speech with the German Cepstral voice Matthias MUTE - play no sound at all """ rospy.loginfo("Speak <<%s>> in mode <<%s>>",parameter_name,mode) # get mode from global parameter if necessary if mode == "DEFAULT": if not rospy.has_param(self.ns_global_prefix + "/sound/speech_mode"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_mode") ah.error_code = 2 return ah mode = rospy.get_param(self.ns_global_prefix + "/sound/speech_mode") # play sound depending on the mode that was chosen elif mode == "WAV_DE": rospy.loginfo("Playing German WAV file %s",param_name) # get path for German WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_de_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_de_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_de_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "WAV_EN": rospy.loginfo("Playing English WAV file %s",param_name) # get path for English WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_en_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_en_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_en_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "FEST_EN": # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Festival Voice for speaking '%s'",text_string) # send text string to TTS system soundhandle.say(text_string) return 0 elif mode == "CEPS_EN"): # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Cepstral Voice David for speaking '%s'",text_string) # send text string to TTS system returnVal = os.system("swift -n \"Matthias\" -e \"utf-8\" \"" + str + "\"") return 0
|
rospy.loginfo("Using English Festival Voice for speaking '%s'",text_string) soundhandle.say(text_string) return 0 elif mode == "CEPS_EN"): if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str:
|
rospy.loginfo("Using English Festival Voice for speaking '%s'",text) soundhandle.say(text) return 0 elif mode == "CEPS_EN": if not type(text) == str:
|
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech with the English Festival voice CEPS_EN - use Text-to-speech with the English Cepstral voice David CEPS_DE - use Text-to-speech with the German Cepstral voice Matthias MUTE - play no sound at all """ rospy.loginfo("Speak <<%s>> in mode <<%s>>",parameter_name,mode) # get mode from global parameter if necessary if mode == "DEFAULT": if not rospy.has_param(self.ns_global_prefix + "/sound/speech_mode"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_mode") ah.error_code = 2 return ah mode = rospy.get_param(self.ns_global_prefix + "/sound/speech_mode") # play sound depending on the mode that was chosen elif mode == "WAV_DE": rospy.loginfo("Playing German WAV file %s",param_name) # get path for German WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_de_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_de_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_de_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "WAV_EN": rospy.loginfo("Playing English WAV file %s",param_name) # get path for English WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_en_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_en_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_en_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "FEST_EN": # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Festival Voice for speaking '%s'",text_string) # send text string to TTS system soundhandle.say(text_string) return 0 elif mode == "CEPS_EN"): # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Cepstral Voice David for speaking '%s'",text_string) # send text string to TTS system returnVal = os.system("swift -n \"Matthias\" -e \"utf-8\" \"" + str + "\"") return 0
|
rospy.loginfo("Using English Cepstral Voice David for speaking '%s'",text_string) returnVal = os.system("swift -n \"Matthias\" -e \"utf-8\" \"" + str + "\"") return 0 elif mode == "CEPS_DE"): if not rospy.has_param(self.ns_global_prefex + "/sound/speech_de/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_de/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_de/"+parameter_name) if not type(text_string) == str:
|
rospy.loginfo("Using English Cepstral Voice David for speaking '%s'",text) returnVal = os.system("swift -n \"David\" -e \"utf-8\" \"" + str + "\"") if returnVal != 0: rospy.logerror("Calling Cepstral TTS system returned failure. Check if Cepstral voice \"David\" is set up properly!") ah.error_code = 4 return ah return returnVal elif mode == "CEPS_DE": if not type(text) == str:
|
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech with the English Festival voice CEPS_EN - use Text-to-speech with the English Cepstral voice David CEPS_DE - use Text-to-speech with the German Cepstral voice Matthias MUTE - play no sound at all """ rospy.loginfo("Speak <<%s>> in mode <<%s>>",parameter_name,mode) # get mode from global parameter if necessary if mode == "DEFAULT": if not rospy.has_param(self.ns_global_prefix + "/sound/speech_mode"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_mode") ah.error_code = 2 return ah mode = rospy.get_param(self.ns_global_prefix + "/sound/speech_mode") # play sound depending on the mode that was chosen elif mode == "WAV_DE": rospy.loginfo("Playing German WAV file %s",param_name) # get path for German WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_de_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_de_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_de_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "WAV_EN": rospy.loginfo("Playing English WAV file %s",param_name) # get path for English WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_en_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_en_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_en_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "FEST_EN": # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Festival Voice for speaking '%s'",text_string) # send text string to TTS system soundhandle.say(text_string) return 0 elif mode == "CEPS_EN"): # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Cepstral Voice David for speaking '%s'",text_string) # send text string to TTS system returnVal = os.system("swift -n \"Matthias\" -e \"utf-8\" \"" + str + "\"") return 0
|
rospy.loginfo("Using German Cepstral Voice Matthias for speaking '%s'",text_string) returnVal = os.system("swift -n \"Matthias\"-e \"utf-8\" \"" + str + "\"") return 0 elif mode == "MUTE": rospy.loginfo("Playing sound %s",param_name) else: rospy.lorerr("ROS has no sound mode %s!",mode)
|
rospy.loginfo("Using German Cepstral Voice Matthias for speaking '%s'",text) returnVal = os.system("swift -n \"Matthias\" -e \"utf-8\" \"" + str + "\"") if returnVal != 0: rospy.logerror("Calling Cepstral TTS system returned failure. Check if Cepstral voice \"Matthias\" is set up properly!") ah.error_code = 4 return ah return returnVal
|
def Speak(self,parameter_name,mode="DEFAULT") """ Speak sound specified by 'parameter_name' either via TTS or by playing a WAV-File Possible modes are: DEFAULT - use mode set by a global parameter (default) WAV_DE - play wav-Files with German Text WAV_EN - play wav-FIles with English Text FEST_EN - use Text-to-speech with the English Festival voice CEPS_EN - use Text-to-speech with the English Cepstral voice David CEPS_DE - use Text-to-speech with the German Cepstral voice Matthias MUTE - play no sound at all """ rospy.loginfo("Speak <<%s>> in mode <<%s>>",parameter_name,mode) # get mode from global parameter if necessary if mode == "DEFAULT": if not rospy.has_param(self.ns_global_prefix + "/sound/speech_mode"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_mode") ah.error_code = 2 return ah mode = rospy.get_param(self.ns_global_prefix + "/sound/speech_mode") # play sound depending on the mode that was chosen elif mode == "WAV_DE": rospy.loginfo("Playing German WAV file %s",param_name) # get path for German WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_de_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_de_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_de_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "WAV_EN": rospy.loginfo("Playing English WAV file %s",param_name) # get path for English WAV files if not rospy.has_param(self.ns_global_prefex + "/sound/wav_en_path"): rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/wav_en_path") ah.error_code = 2 return ah wav_path = rospy.get_param(self.ns_global_prefix + "/sound/wav_en_path") # play sound soundhandle.playWave(wav_path + parameter_name + ".wav") return 0 elif mode == "FEST_EN": # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Festival Voice for speaking '%s'",text_string) # send text string to TTS system soundhandle.say(text_string) return 0 elif mode == "CEPS_EN"): # get the text string to speak if not rospy.has_param(self.ns_global_prefex + "/sound/speech_en/"+parameter_name) rospy.logerr("parameter %s does not exist on ROS Parameter Server, aborting...",self.ns_global_prefix + "/sound/speech_en/"+parameter_name) ah.error_code = 2 return ah text_string = rospy.get_param(self.ns_global_prefix + "/sound/speech_en/"+parameter_name) if not type(text_string) == str: rospy.logerr("no valid parameter for text-to-speech system: Not a string, aborting...") ah.error_code = 3 return ah rospy.loginfo("Using English Cepstral Voice David for speaking '%s'",text_string) # send text string to TTS system returnVal = os.system("swift -n \"Matthias\" -e \"utf-8\" \"" + str + "\"") return 0
|
def Trigger(self,component_name,service_name):
|
def Trigger(self,component_name,service_name,blocking=True):
|
def Trigger(self,component_name,service_name): rospy.loginfo("<<%s>> <<%s>>", service_name, component_name) rospy.loginfo("Waiting for <<%s>> to <<%s>>...", component_name, service_name) service_full_name = "/" + component_name + "_controller/" + service_name try: rospy.wait_for_service(service_full_name,rospy.get_param('server_timeout',3)) except rospy.ROSException, e: print "Service not available: %s"%e return False try: init = rospy.ServiceProxy(service_full_name,Trigger) #print init() init() except rospy.ServiceException, e: print "Service call failed: %s"%e return False rospy.loginfo("...<<%s>> is <<%s>>", component_name, service_name) return True
|
try: if sock.family != socket.AF_UNIX: raise ValueError("Only AF_UNIX sockets are allowed")
|
if hasattr(sock, 'family') and sock.family != socket.AF_UNIX: raise ValueError("Only AF_UNIX sockets are allowed") if hasattr(sock, 'fileno'):
|
def __check_socket(sock): try: if sock.family != socket.AF_UNIX: raise ValueError("Only AF_UNIX sockets are allowed") sock = sock.fileno() except AttributeError: pass if not isinstance(sock, int): raise TypeError("An socket object or file descriptor was expected") return sock
|
except AttributeError: pass
|
def __check_socket(sock): try: if sock.family != socket.AF_UNIX: raise ValueError("Only AF_UNIX sockets are allowed") sock = sock.fileno() except AttributeError: pass if not isinstance(sock, int): raise TypeError("An socket object or file descriptor was expected") return sock
|
|
s.send("a")
|
def parent_tests(self, s): # First message is not even sent s.send("a") self.vrfy_recv(recvfd(s), "a") s.send("a") self.vrfy_recv(recvfd(s), "\0") s.send("a") self.vrfy_recv(recvfd(s), "foobar") s.send("a") self.vrfy_recv(recvfd(s, msg_buf = 11), "long string") # is long s.send("a") self.assertEquals(s.recv(8), " is long") # re-sync s.send("a") self.assertEquals(s.recv(100), "foobar") s.send("a") self.assertRaises(RuntimeError, recvfd, s) # No fd received # s.send("a") self.assertRaises(OSError, recvfd, s, 4096, ['w']) # Trying to write
|
|
s.send("a") (f, msg) = recvfd(s, open_args = [ "w" ]) self.assertEquals(msg, "writing") f.write("foo")
|
def parent_tests(self, s): # First message is not even sent s.send("a") self.vrfy_recv(recvfd(s), "a") s.send("a") self.vrfy_recv(recvfd(s), "\0") s.send("a") self.vrfy_recv(recvfd(s), "foobar") s.send("a") self.vrfy_recv(recvfd(s, msg_buf = 11), "long string") # is long s.send("a") self.assertEquals(s.recv(8), " is long") # re-sync s.send("a") self.assertEquals(s.recv(100), "foobar") s.send("a") self.assertRaises(RuntimeError, recvfd, s) # No fd received # s.send("a") self.assertRaises(OSError, recvfd, s, 4096, ['w']) # Trying to write
|
|
w.acom1.chs=options.serial_handshake.get() + \ ' '[:40]
|
w.acom1.chs=(options.serial_handshake.get() + \ ' ')[:40]
|
def put_params(param3=NONE): global param20
|
root.title(' WSPR 2.20 by K1JT')
|
root.title(' WSPR 2.21 by K1JT')
|
def readinit(): global nparam,mrudir try: for i in range(len(params)): if badlist.count(i)>0: print 'Skipping bad entry in WSPR.INI:\a',params[i] continue key,value=params[i].split() if key == 'WSPRGeometry': root.geometry(value) elif key == 'MyCall': options.MyCall.set(value) elif key == 'MyGrid': options.MyGrid.set(value) elif key == 'CWID': advanced.idint.set(value) elif key == 'dBm': options.dBm.set(value) elif key == 'PctTx': ipctx.set(value) elif key == 'PttPort': options.PttPort.set(value) elif key == 'CatPort': options.CatPort.set(value) elif key == 'AudioIn': value=value.replace("#"," ") g.DevinName.set(value) try: g.ndevin.set(int(value[:2])) except: g.ndevin.set(0) options.DevinName.set(value) elif key == 'AudioOut': value=value.replace("#"," ") g.DevoutName.set(value) try: g.ndevout.set(int(value[:2])) except: g.ndevout.set(0) options.DevoutName.set(value) elif key == 'BFOfreq': advanced.bfofreq.set(value) elif key == 'Acal': advanced.Acal.set(value) elif key == 'Bcal': advanced.Bcal.set(value) elif key == 'CalEnable': advanced.encal.set(value) elif key == 'IQmode': iq.iqmode.set(value) elif key == 'IQrx': iq.iqrx.set(value) elif key == 'IQtx': iq.iqtx.set(value) elif key == 'FIQ': iq.fiq.set(value) elif key == 'Ntxdb': advanced.isc1.set(value) elif key == 'Ntxbal': iq.isc2.set(value) elif key == 'Ntxbalf': iq.isc2a.set(value) elif key == 'Ntxpha': iq.isc3.set(value) elif key == 'Ntxphaf': iq.isc3a.set(value) elif key == 'PTTmode': options.pttmode.set(value) elif key == 'CATenable': options.cat_enable.set(value) elif key == 'SerialRate': options.serial_rate.set(int(value)) elif key == 'DataBits': options.databits.set(int(value)) elif key == 'StopBits': options.stopbits.set(int(value)) elif key == 'Handshake': options.serial_handshake.set(value.replace("#"," ") ) elif key == 'Rig': t=value.replace("#"," ") options.rig.set(t) options.rignum.set(int(t[:4])) elif key == 'Nsave': nsave.set(value) elif key == 'Upload': upload.set(value) elif key == 'Idle': idle.set(value) elif key == 'Debug': ndebug.set(value) elif key == 'WatScale': sc1.set(value) elif key == 'WatOffset': sc2.set(value) elif key == 'Palette': g.cmap=value elif key == 'freq0_600': freq0[1]=float(value) elif key == 'freq0_160': freq0[2]=float(value) elif key == 'freq0_80': freq0[3]=float(value) elif key == 'freq0_60': freq0[4]=float(value) elif key == 'freq0_40': freq0[5]=float(value) elif key == 'freq0_30': freq0[6]=float(value) elif key == 'freq0_20': freq0[7]=float(value) elif key == 'freq0_17': freq0[8]=float(value) elif key == 'freq0_15': freq0[9]=float(value) elif key == 'freq0_12': freq0[10]=float(value) elif key == 'freq0_10': freq0[11]=float(value) elif key == 'freq0_6': freq0[12]=float(value) elif key == 'freq0_4': freq0[13]=float(value) elif key == 'freq0_2': freq0[14]=float(value) elif key == 'freq0_other': freq0[15]=float(value) elif key == 'freqtx_600': freqtx[1]=float(value) elif key == 'freqtx_160': freqtx[2]=float(value) elif key == 'freqtx_80': freqtx[3]=float(value) elif key == 'freqtx_60': freqtx[4]=float(value) elif key == 'freqtx_40': freqtx[5]=float(value) elif key == 'freqtx_30': freqtx[6]=float(value) elif key == 'freqtx_20': freqtx[7]=float(value) elif key == 'freqtx_17': freqtx[8]=float(value) elif key == 'freqtx_15': freqtx[9]=float(value) elif key == 'freqtx_12': freqtx[10]=float(value) elif key == 'freqtx_10': freqtx[11]=float(value) elif key == 'freqtx_6': freqtx[12]=float(value) elif key == 'freqtx_4': freqtx[13]=float(value) elif key == 'freqtx_2': freqtx[14]=float(value) elif key == 'freqtx_other': freqtx[15]=float(value) elif key == 'iband': iband.set(value) elif key == 'StartIdle': start_idle.set(value) elif key == 'NoBeep': no_beep.set(value) elif key == 'Ygain': w.acom1.gain=float(value) elif key == 'Phdeg': w.acom1.phase=float(value)/57.2957795 elif key == 'Reject': w.acom1.reject=float(value) elif key == 'RxApply': iq.iqrxapp.set(value) elif key == 'MRUdir': mrudir=value.replace("#"," ") nparam=i except: badlist.append(i) nparam=i
|
if not no_beep: t=t + "\a"
|
if not no_beep.get(): t=t + "\a"
|
def autolog(decodes): # Random delay of up to 20 seconds to spread load out on server --W1BW time.sleep(random.random() * 20.0) try: # This code originally by W6CQZ ... modified by W1BW # TODO: Cache entries for later uploading if net is down. # TODO: (Maybe??) Allow for stations wishing to collect spot data but # only upload in batch form vs real-time. # Any spots to upload? if len(decodes) > 0: for d in decodes: # now to format as a string to use for autologger upload using urlencode # so we get a string formatted for http get/put operations: m=d['msg'] tcall=m[0] if d['type2']: tgrid='' dbm=m[1] else: tgrid=m[1] dbm=m[2] if tcall[0]=='<': n=tcall.find('>') tcall=tcall[1:n] if tcall=='...': continue dfreq=float(d['freq'])-w.acom1.f0b-0.001500 print 'dfreq:',dfreq if abs(dfreq)>0.0001: print 'Frequency changed, no upload of spots' continue reportparams = urllib.urlencode({'function': 'wspr', 'rcall': options.MyCall.get(), 'rgrid': options.MyGrid.get(), 'rqrg': str(f0.get()), 'date': d['date'], 'time': d['time'], 'sig': d['snr'], 'dt': d['dt'], 'tqrg': d['freq'], 'drift': d['drift'], 'tcall': tcall, 'tgrid': tgrid, 'dbm': dbm, 'version': Version}) # reportparams now contains a properly formed http request string for # the agreed upon format between W6CQZ and N8FQ. # any other data collection point can be added as desired if it conforms # to the 'standard format' defined above. # The following opens a url and passes the reception report to the database # insertion handler for W6CQZ: # urlf = urllib.urlopen("http://jt65.w6cqz.org/rbc.php?%s" % reportparams) # The following opens a url and passes the reception report to the # database insertion handler from W1BW: urlf = urllib.urlopen("http://wsprnet.org/post?%s" \ % reportparams) reply = urlf.readlines() urlf.close() else: # No spots to report, so upload status message instead. --W1BW reportparams = urllib.urlencode({'function': 'wsprstat', 'rcall': options.MyCall.get(), 'rgrid': options.MyGrid.get(), 'rqrg': str(fmid), 'tpct': str(ipctx.get()), 'tqrg': sftx.get(), 'dbm': str(options.dBm.get()), 'version': Version}) urlf = urllib.urlopen("http://wsprnet.org/post?%s" \ % reportparams) reply = urlf.readlines() urlf.close() except: t=" UTC: attempted access to WSPRnet failed." if not no_beep: t=t + "\a" print time.asctime(time.gmtime()) + t
|
bandmap,bm,t0,nreject,gain,phdeg,ierr
|
bandmap,bm,t0,nreject,gain,phdeg,ierr,itx0,timer1
|
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg,ierr tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 120 if hopping.hoppingconfigured.get()==1: bhopping.configure(state=NORMAL) else: bhopping.configure(state=DISABLED) hopped=0 if not idle.get(): if hopping.hopping.get()==1: w.acom1.nfhopping=1 if w.acom1.nfhopok: w.acom1.nfhopok=0 b=-1 if hopping.coord_bands.get()==1: ns=nsec % 86400 ns1=ns % (10*120) b=ns1/120 + 3 if b==12: b=2 if hopping.hoppingflag[b].get()==0: b=-1 if b<0: found=False while not found: b = random.randint(1,len(hopping.bandlabels)-1) if hopping.hoppingflag[b].get()!=0: found=True ipctx.set(hopping.hoppingpctx[b].get()) if b!=iband.get(): hopped=1 iband.set(b) else: w.acom1.nfhopping=0 ns=nsec % 86400 ns1=ns % (10*120) b=ns1/120 + 3 if b==12: b=2 if iband.get()==b and random.randint(1,2)==1 and ipctx.get()>0: w.acom1.ntxnext=1 try: f0.set(float(sf0.get())) ftx.set(float(sftx.get())) except: pass isec=utc[5] twait=120.0 - (tsec % 120.0) if iband.get()!=iband0 or advanced.fset.get(): advanced.fset.set(0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t) if options.cat_enable.get(): if advanced.encal.get(): nHz=int(advanced.Acal.get() + \ f0.get()*(1000000.0 + advanced.Bcal.get()) + 0.5) else: nHz=int(1000000.0*f0.get() + 0.5) if options.rignum.get()==2509 or options.rignum.get()==2511: nHzLO=nHz - iq.fiq.get() cmd="rigctl -m %d -r %s F %d" % \ (options.rignum.get(),options.CatPort.get(),nHzLO) else: cmd="rigctl -m %d -r %s -s %d -C data_bits=%s -C stop_bits=%s -C serial_handshake=%s F %d" % \ (options.rignum.get(),options.CatPort.get(), \ options.serial_rate.get(),options.databits.get(), \ options.stopbits.get(),options.serial_handshake.get(), nHz) ierr=os.system(cmd) if ierr==0: ierr2=0 bandmap=[] bm={} text1.configure(state=NORMAL) text1.delete('1.0',END) text1.configure(state=DISABLED) iband0=iband.get() f=open(appdir+'/fmt.ini',mode='w') f.write(cmd+'\n') f.write(str(g.ndevin.get())+'\n') f.close() cmd2='' if os.path.exists('.\user_hardware.bat') or \ os.path.exists('.\user_hardware.cmd') or \ os.path.exists('.\user_hardware.exe'): cmd2='.\user_hardware ' + str(band[iband0]) elif os.path.exists('./user_hardware'): cmd2='./user_hardware ' + str(band[iband0]) if cmd2!='': try: ierr2=os.system(cmd2) except: print 'Execution of "'+cmd2+'" failed.' else: print 'Error attempting to set rig frequency.\a' print cmd + '\a' iband.set(iband0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t)
|
if ntr!=ntr0:
|
itx=w.acom1.transmitting if ntr!=ntr0 or itx!=itx0:
|
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg,ierr tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 120 if hopping.hoppingconfigured.get()==1: bhopping.configure(state=NORMAL) else: bhopping.configure(state=DISABLED) hopped=0 if not idle.get(): if hopping.hopping.get()==1: w.acom1.nfhopping=1 if w.acom1.nfhopok: w.acom1.nfhopok=0 b=-1 if hopping.coord_bands.get()==1: ns=nsec % 86400 ns1=ns % (10*120) b=ns1/120 + 3 if b==12: b=2 if hopping.hoppingflag[b].get()==0: b=-1 if b<0: found=False while not found: b = random.randint(1,len(hopping.bandlabels)-1) if hopping.hoppingflag[b].get()!=0: found=True ipctx.set(hopping.hoppingpctx[b].get()) if b!=iband.get(): hopped=1 iband.set(b) else: w.acom1.nfhopping=0 ns=nsec % 86400 ns1=ns % (10*120) b=ns1/120 + 3 if b==12: b=2 if iband.get()==b and random.randint(1,2)==1 and ipctx.get()>0: w.acom1.ntxnext=1 try: f0.set(float(sf0.get())) ftx.set(float(sftx.get())) except: pass isec=utc[5] twait=120.0 - (tsec % 120.0) if iband.get()!=iband0 or advanced.fset.get(): advanced.fset.set(0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t) if options.cat_enable.get(): if advanced.encal.get(): nHz=int(advanced.Acal.get() + \ f0.get()*(1000000.0 + advanced.Bcal.get()) + 0.5) else: nHz=int(1000000.0*f0.get() + 0.5) if options.rignum.get()==2509 or options.rignum.get()==2511: nHzLO=nHz - iq.fiq.get() cmd="rigctl -m %d -r %s F %d" % \ (options.rignum.get(),options.CatPort.get(),nHzLO) else: cmd="rigctl -m %d -r %s -s %d -C data_bits=%s -C stop_bits=%s -C serial_handshake=%s F %d" % \ (options.rignum.get(),options.CatPort.get(), \ options.serial_rate.get(),options.databits.get(), \ options.stopbits.get(),options.serial_handshake.get(), nHz) ierr=os.system(cmd) if ierr==0: ierr2=0 bandmap=[] bm={} text1.configure(state=NORMAL) text1.delete('1.0',END) text1.configure(state=DISABLED) iband0=iband.get() f=open(appdir+'/fmt.ini',mode='w') f.write(cmd+'\n') f.write(str(g.ndevin.get())+'\n') f.close() cmd2='' if os.path.exists('.\user_hardware.bat') or \ os.path.exists('.\user_hardware.cmd') or \ os.path.exists('.\user_hardware.exe'): cmd2='.\user_hardware ' + str(band[iband0]) elif os.path.exists('./user_hardware'): cmd2='./user_hardware ' + str(band[iband0]) if cmd2!='': try: ierr2=os.system(cmd2) except: print 'Execution of "'+cmd2+'" failed.' else: print 'Error attempting to set rig frequency.\a' print cmd + '\a' iband.set(iband0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t)
|
if ntr==-1:
|
itx0=int(itx) if ntr==-1 or itx==1:
|
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg,ierr tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 120 if hopping.hoppingconfigured.get()==1: bhopping.configure(state=NORMAL) else: bhopping.configure(state=DISABLED) hopped=0 if not idle.get(): if hopping.hopping.get()==1: w.acom1.nfhopping=1 if w.acom1.nfhopok: w.acom1.nfhopok=0 b=-1 if hopping.coord_bands.get()==1: ns=nsec % 86400 ns1=ns % (10*120) b=ns1/120 + 3 if b==12: b=2 if hopping.hoppingflag[b].get()==0: b=-1 if b<0: found=False while not found: b = random.randint(1,len(hopping.bandlabels)-1) if hopping.hoppingflag[b].get()!=0: found=True ipctx.set(hopping.hoppingpctx[b].get()) if b!=iband.get(): hopped=1 iband.set(b) else: w.acom1.nfhopping=0 ns=nsec % 86400 ns1=ns % (10*120) b=ns1/120 + 3 if b==12: b=2 if iband.get()==b and random.randint(1,2)==1 and ipctx.get()>0: w.acom1.ntxnext=1 try: f0.set(float(sf0.get())) ftx.set(float(sftx.get())) except: pass isec=utc[5] twait=120.0 - (tsec % 120.0) if iband.get()!=iband0 or advanced.fset.get(): advanced.fset.set(0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t) if options.cat_enable.get(): if advanced.encal.get(): nHz=int(advanced.Acal.get() + \ f0.get()*(1000000.0 + advanced.Bcal.get()) + 0.5) else: nHz=int(1000000.0*f0.get() + 0.5) if options.rignum.get()==2509 or options.rignum.get()==2511: nHzLO=nHz - iq.fiq.get() cmd="rigctl -m %d -r %s F %d" % \ (options.rignum.get(),options.CatPort.get(),nHzLO) else: cmd="rigctl -m %d -r %s -s %d -C data_bits=%s -C stop_bits=%s -C serial_handshake=%s F %d" % \ (options.rignum.get(),options.CatPort.get(), \ options.serial_rate.get(),options.databits.get(), \ options.stopbits.get(),options.serial_handshake.get(), nHz) ierr=os.system(cmd) if ierr==0: ierr2=0 bandmap=[] bm={} text1.configure(state=NORMAL) text1.delete('1.0',END) text1.configure(state=DISABLED) iband0=iband.get() f=open(appdir+'/fmt.ini',mode='w') f.write(cmd+'\n') f.write(str(g.ndevin.get())+'\n') f.close() cmd2='' if os.path.exists('.\user_hardware.bat') or \ os.path.exists('.\user_hardware.cmd') or \ os.path.exists('.\user_hardware.exe'): cmd2='.\user_hardware ' + str(band[iband0]) elif os.path.exists('./user_hardware'): cmd2='./user_hardware ' + str(band[iband0]) if cmd2!='': try: ierr2=os.system(cmd2) except: print 'Execution of "'+cmd2+'" failed.' else: print 'Error attempting to set rig frequency.\a' print cmd + '\a' iband.set(iband0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t)
|
ldate.after(200,update)
|
timer1=ldate.after(200,update)
|
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg,ierr tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 120 if hopping.hoppingconfigured.get()==1: bhopping.configure(state=NORMAL) else: bhopping.configure(state=DISABLED) hopped=0 if not idle.get(): if hopping.hopping.get()==1: w.acom1.nfhopping=1 if w.acom1.nfhopok: w.acom1.nfhopok=0 b=-1 if hopping.coord_bands.get()==1: ns=nsec % 86400 ns1=ns % (10*120) b=ns1/120 + 3 if b==12: b=2 if hopping.hoppingflag[b].get()==0: b=-1 if b<0: found=False while not found: b = random.randint(1,len(hopping.bandlabels)-1) if hopping.hoppingflag[b].get()!=0: found=True ipctx.set(hopping.hoppingpctx[b].get()) if b!=iband.get(): hopped=1 iband.set(b) else: w.acom1.nfhopping=0 ns=nsec % 86400 ns1=ns % (10*120) b=ns1/120 + 3 if b==12: b=2 if iband.get()==b and random.randint(1,2)==1 and ipctx.get()>0: w.acom1.ntxnext=1 try: f0.set(float(sf0.get())) ftx.set(float(sftx.get())) except: pass isec=utc[5] twait=120.0 - (tsec % 120.0) if iband.get()!=iband0 or advanced.fset.get(): advanced.fset.set(0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t) if options.cat_enable.get(): if advanced.encal.get(): nHz=int(advanced.Acal.get() + \ f0.get()*(1000000.0 + advanced.Bcal.get()) + 0.5) else: nHz=int(1000000.0*f0.get() + 0.5) if options.rignum.get()==2509 or options.rignum.get()==2511: nHzLO=nHz - iq.fiq.get() cmd="rigctl -m %d -r %s F %d" % \ (options.rignum.get(),options.CatPort.get(),nHzLO) else: cmd="rigctl -m %d -r %s -s %d -C data_bits=%s -C stop_bits=%s -C serial_handshake=%s F %d" % \ (options.rignum.get(),options.CatPort.get(), \ options.serial_rate.get(),options.databits.get(), \ options.stopbits.get(),options.serial_handshake.get(), nHz) ierr=os.system(cmd) if ierr==0: ierr2=0 bandmap=[] bm={} text1.configure(state=NORMAL) text1.delete('1.0',END) text1.configure(state=DISABLED) iband0=iband.get() f=open(appdir+'/fmt.ini',mode='w') f.write(cmd+'\n') f.write(str(g.ndevin.get())+'\n') f.close() cmd2='' if os.path.exists('.\user_hardware.bat') or \ os.path.exists('.\user_hardware.cmd') or \ os.path.exists('.\user_hardware.exe'): cmd2='.\user_hardware ' + str(band[iband0]) elif os.path.exists('./user_hardware'): cmd2='./user_hardware ' + str(band[iband0]) if cmd2!='': try: ierr2=os.system(cmd2) except: print 'Execution of "'+cmd2+'" failed.' else: print 'Error attempting to set rig frequency.\a' print cmd + '\a' iband.set(iband0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t)
|
print 'hopping'
|
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg if hopping_feature==1: if hopping.hoppingconfigured.get()==1: bhopping.configure(state=NORMAL) else: bhopping.configure(state=DISABLED) if hopping_feature==1 and hopping.hopping.get()==1: w.acom1.nfhopping=1 if w.acom1.nfhopok: w.acom1.nfhopok=0 print 'hopping' found=False while not found: b = random.randint(1,len(hopping.bandlabels)-1) #print '>>> ',b,' ',hopping.hoppingflag[b].get() if hopping.hoppingflag[b].get()!=0: found=True print 'hopping to ',hopping.bandlabels[b],' Tx Fraction ',hopping.hoppingpctx[b].get() ipctx.set(hopping.hoppingpctx[b].get()) iband.set(b) else: #print 'tuning off hopping scheduling' w.acom1.nfhopping=0 #print 'hopping scheduling ?',w.acom1.nfhopping tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 120 try: f0.set(float(sf0.get())) ftx.set(float(sftx.get())) except: pass isec=utc[5] twait=120.0 - (tsec % 120.0) if iband.get()!=iband0 or advanced.fset.get(): advanced.fset.set(0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t) if options.cat_enable.get(): if advanced.encal.get(): nHz=int(advanced.Acal.get() + \ f0.get()*(1000000.0 + advanced.Bcal.get()) + 0.5) else: nHz=int(1000000.0*f0.get() + 0.5) if options.rignum.get()==2509: nHzLO=nHz - iq.fiq.get() cmd="rigctl -m %d -r %s F %d" % \ (options.rignum.get(),options.CatPort.get(),nHzLO) else: cmd="rigctl -m %d -r %s -s %d -C data_bits=%s -C stop_bits=%s -C serial_handshake=%s F %d" % \ (options.rignum.get(),options.CatPort.get(), \ options.serial_rate.get(),options.databits.get(), \ options.stopbits.get(),options.serial_handshake.get(), nHz) ierr=os.system(cmd) if ierr==0: bandmap=[] bm={} text1.configure(state=NORMAL) text1.delete('1.0',END) text1.configure(state=DISABLED) iband0=iband.get() f=open(appdir+'/fmt.ini',mode='w') f.write(cmd+'\n') f.write(str(g.ndevin.get())+'\n') f.close() cmd2='' if os.path.exists('.\user_hardware.bat') or \ os.path.exists('.\user_hardware.exe'): cmd2='.\user_hardware ' + str(band[iband0]) elif os.path.exists('./user_hardware'): cmd2='./user_hardware ' + str(band[iband0]) if cmd2!='': try: ierr2=os.system(cmd2) except: print 'Execution of "'+cmd2+'" failed.' else: print 'Error attempting to set rig frequency.\a' print cmd + '\a' iband.set(iband0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t) else: iband0=iband.get() freq0[iband.get()]=f0.get() freqtx[iband.get()]=ftx.get() if isec != isec0: #Do once per second isec0=isec t=time.strftime('%Y %b %d\n%H:%M:%S',utc) ldate.configure(text=t) root_geom=root.geometry() utchours=utc[3]+utc[4]/60.0 + utc[5]/3600.0 try: if options.dBm.get()!=ndbm0: ndbm0=options.dBm.get() options.dbm_balloon() except: pass put_params() nndf=int(1000000.0*(ftx.get()-f0.get()) + 0.5) - 1500 ndb=int(w.acom1.xdb1-41.0) if ndb<-30: ndb=-30 if iq.iqmode.get(): ndb2=int(w.acom1.xdb2-41.0) if ndb2<-30: ndb2=-30 t='Rx Noise: %3d %3d dB' % (ndb,ndb2) else: t='Rx Noise: %3d dB' % (ndb,) bg='gray85' r=SUNKEN if w.acom1.receiving: if ndb>10 and ndb<=20: bg='yellow' elif ndb<-20 or ndb>20: bg='red' else: t='' r=FLAT msg1.configure(text=t,bg=bg,relief=r) gain=w.acom1.gain phdeg=57.2957795*w.acom1.phase nreject=int(w.acom1.reject) t='Bal: %6.4f Pha: %6.1f >%3d dB' % (gain,phdeg,nreject) iq.lab1.configure(text=t)
|
|
global isync
|
global isync,isync_iscat
|
def ModeISCAT(event=NONE): global isync if g.mode != "ISCAT": if lauto: toggleauto() ModeJT6M() mode.set("ISCAT") lab2.configure(text='FileID Avg dB DF') isync=-18 report.configure(state=NORMAL) report.delete(0,END) report.insert(0,'-15')
|
isync=-18
|
isync=isync_iscat lsync.configure(text=slabel+str(isync)) shmsg.configure(state=NORMAL) nfreeze.set(0)
|
def ModeISCAT(event=NONE): global isync if g.mode != "ISCAT": if lauto: toggleauto() ModeJT6M() mode.set("ISCAT") lab2.configure(text='FileID Avg dB DF') isync=-18 report.configure(state=NORMAL) report.delete(0,END) report.insert(0,'-15')
|
im,pim,cmap0,isync,isync441,isync6m,isync65,isync_save,idsec, \ first,itol,txsnrdb,tx6alt
|
im,pim,cmap0,isync,isync441,isync6m,isync_iscat,isync65, \ isync_save,idsec,first,itol,txsnrdb,tx6alt
|
def update(): global root_geom,isec0,naz,nel,ndmiles,ndkm,nhotaz,nhotabetter,nopen, \ im,pim,cmap0,isync,isync441,isync6m,isync65,isync_save,idsec, \ first,itol,txsnrdb,tx6alt utc=time.gmtime(time.time()+0.1*idsec) isec=utc[5] if isec != isec0: #Do once per second isec0=isec t=time.strftime('%Y %b %d\n%H:%M:%S',utc) Audio.gcom2.utcdate=t[:12] Audio.gcom2.iyr=utc[0] Audio.gcom2.imo=utc[1] Audio.gcom2.ida=utc[2] Audio.gcom2.ihr=utc[3] Audio.gcom2.imi=utc[4] Audio.gcom2.isc=utc[5] ldate.configure(text=t) root_geom=root.geometry() utchours=utc[3]+utc[4]/60.0 + utc[5]/3600.0 naz,nel,ndmiles,ndkm,nhotaz,nhotabetter=Audio.azdist0( \ options.MyGrid.get().upper(),HisGrid.get().upper(),utchours) azdist() g.nfreq=nfreq.get() if Audio.gcom2.ndecoding==0: g.AzSun,g.ElSun,g.AzMoon,g.ElMoon,g.AzMoonB,g.ElMoonB,g.ntsky, \ g.ndop,g.ndop00,g.dbMoon,g.RAMoon,g.DecMoon,g.HA8,g.Dgrd, \ g.sd,g.poloffset,g.MaxNR,g.dfdt,g.dfdt0,g.RaAux,g.DecAux, \ g.AzAux,g.ElAux = Audio.astro0(utc[0],utc[1],utc[2], \ utchours,nfreq.get(),options.MyGrid.get().upper(), \ options.auxra.get()+(' '*9)[:9], \ options.auxdec.get()+(' '*9)[:9]) if len(HisGrid.get().strip())<4: g.ndop=g.ndop00 g.dfdt=g.dfdt0 if (ntx.get()==1 and noshjt65.get()) or noshjt65all.get(): Audio.gcom2.ntx2=1 else: Audio.gcom2.ntx2=0 if mode.get()[:4]=='JT65' or mode.get()[:3]=='JT4' \ or mode.get()[:2]=='CW': graph2.delete(ALL) graph2.create_text(80,13,anchor=CENTER,text="Moon",font=g2font) graph2.create_text(13,37,anchor=W, text="Az: %6.2f" % g.AzMoon,font=g2font) graph2.create_text(13,61,anchor=W, text="El: %6.2f" % g.ElMoon,font=g2font) graph2.create_text(13,85,anchor=W, text="Dop:%6d" % g.ndop,font=g2font) graph2.create_text(13,109,anchor=W,text="Dgrd:%5.1f" % g.Dgrd,font=g2font) if (mode.get()[:4]=='JT65' or mode.get()[:3]=='JT4') and g.freeze_decode: itol=2 ltol.configure(text='Tol '+str(50)) Audio.gcom2.dftolerance=50 nfreeze.set(1) Audio.gcom2.nfreeze=1 if Audio.gcom2.monitoring: Audio.gcom2.ndecoding=1 Audio.gcom2.nagain=0 else: Audio.gcom2.ndecoding=4 Audio.gcom2.nagain=1 g.freeze_decode=0 n=-99 g.rms=g.rms+0.001 if g.rms > 0: n=int(20.0*log10(g.rms/770.0+0.01)) else: print "RMS noise:", g.rms, " out of range." t="Rx noise:%3d dB" % (n,) if n>=-10 and n<=10: msg4.configure(text=t,bg='gray85') else: msg4.configure(text=t,bg='red') t=g.ftnstr(Audio.gcom2.decodedfile)
|
elif mode.get()=='JT6M' or mode.get()=="ISCAT": isync6m=isync
|
elif mode.get()=='JT6M': isync6m=isync elif mode.get()=="ISCAT": isync_iscat=isync
|
def update(): global root_geom,isec0,naz,nel,ndmiles,ndkm,nhotaz,nhotabetter,nopen, \ im,pim,cmap0,isync,isync441,isync6m,isync65,isync_save,idsec, \ first,itol,txsnrdb,tx6alt utc=time.gmtime(time.time()+0.1*idsec) isec=utc[5] if isec != isec0: #Do once per second isec0=isec t=time.strftime('%Y %b %d\n%H:%M:%S',utc) Audio.gcom2.utcdate=t[:12] Audio.gcom2.iyr=utc[0] Audio.gcom2.imo=utc[1] Audio.gcom2.ida=utc[2] Audio.gcom2.ihr=utc[3] Audio.gcom2.imi=utc[4] Audio.gcom2.isc=utc[5] ldate.configure(text=t) root_geom=root.geometry() utchours=utc[3]+utc[4]/60.0 + utc[5]/3600.0 naz,nel,ndmiles,ndkm,nhotaz,nhotabetter=Audio.azdist0( \ options.MyGrid.get().upper(),HisGrid.get().upper(),utchours) azdist() g.nfreq=nfreq.get() if Audio.gcom2.ndecoding==0: g.AzSun,g.ElSun,g.AzMoon,g.ElMoon,g.AzMoonB,g.ElMoonB,g.ntsky, \ g.ndop,g.ndop00,g.dbMoon,g.RAMoon,g.DecMoon,g.HA8,g.Dgrd, \ g.sd,g.poloffset,g.MaxNR,g.dfdt,g.dfdt0,g.RaAux,g.DecAux, \ g.AzAux,g.ElAux = Audio.astro0(utc[0],utc[1],utc[2], \ utchours,nfreq.get(),options.MyGrid.get().upper(), \ options.auxra.get()+(' '*9)[:9], \ options.auxdec.get()+(' '*9)[:9]) if len(HisGrid.get().strip())<4: g.ndop=g.ndop00 g.dfdt=g.dfdt0 if (ntx.get()==1 and noshjt65.get()) or noshjt65all.get(): Audio.gcom2.ntx2=1 else: Audio.gcom2.ntx2=0 if mode.get()[:4]=='JT65' or mode.get()[:3]=='JT4' \ or mode.get()[:2]=='CW': graph2.delete(ALL) graph2.create_text(80,13,anchor=CENTER,text="Moon",font=g2font) graph2.create_text(13,37,anchor=W, text="Az: %6.2f" % g.AzMoon,font=g2font) graph2.create_text(13,61,anchor=W, text="El: %6.2f" % g.ElMoon,font=g2font) graph2.create_text(13,85,anchor=W, text="Dop:%6d" % g.ndop,font=g2font) graph2.create_text(13,109,anchor=W,text="Dgrd:%5.1f" % g.Dgrd,font=g2font) if (mode.get()[:4]=='JT65' or mode.get()[:3]=='JT4') and g.freeze_decode: itol=2 ltol.configure(text='Tol '+str(50)) Audio.gcom2.dftolerance=50 nfreeze.set(1) Audio.gcom2.nfreeze=1 if Audio.gcom2.monitoring: Audio.gcom2.ndecoding=1 Audio.gcom2.nagain=0 else: Audio.gcom2.ndecoding=4 Audio.gcom2.nagain=1 g.freeze_decode=0 n=-99 g.rms=g.rms+0.001 if g.rms > 0: n=int(20.0*log10(g.rms/770.0+0.01)) else: print "RMS noise:", g.rms, " out of range." t="Rx noise:%3d dB" % (n,) if n>=-10 and n<=10: msg4.configure(text=t,bg='gray85') else: msg4.configure(text=t,bg='red') t=g.ftnstr(Audio.gcom2.decodedfile)
|
elif mode.get()=='JT6M' or mode.get()=="JT6M": isync=isync6m
|
elif mode.get()=='JT6M': isync=isync6m elif mode.get()=="ISCAT": isync=isync_iscat
|
def update(): global root_geom,isec0,naz,nel,ndmiles,ndkm,nhotaz,nhotabetter,nopen, \ im,pim,cmap0,isync,isync441,isync6m,isync65,isync_save,idsec, \ first,itol,txsnrdb,tx6alt utc=time.gmtime(time.time()+0.1*idsec) isec=utc[5] if isec != isec0: #Do once per second isec0=isec t=time.strftime('%Y %b %d\n%H:%M:%S',utc) Audio.gcom2.utcdate=t[:12] Audio.gcom2.iyr=utc[0] Audio.gcom2.imo=utc[1] Audio.gcom2.ida=utc[2] Audio.gcom2.ihr=utc[3] Audio.gcom2.imi=utc[4] Audio.gcom2.isc=utc[5] ldate.configure(text=t) root_geom=root.geometry() utchours=utc[3]+utc[4]/60.0 + utc[5]/3600.0 naz,nel,ndmiles,ndkm,nhotaz,nhotabetter=Audio.azdist0( \ options.MyGrid.get().upper(),HisGrid.get().upper(),utchours) azdist() g.nfreq=nfreq.get() if Audio.gcom2.ndecoding==0: g.AzSun,g.ElSun,g.AzMoon,g.ElMoon,g.AzMoonB,g.ElMoonB,g.ntsky, \ g.ndop,g.ndop00,g.dbMoon,g.RAMoon,g.DecMoon,g.HA8,g.Dgrd, \ g.sd,g.poloffset,g.MaxNR,g.dfdt,g.dfdt0,g.RaAux,g.DecAux, \ g.AzAux,g.ElAux = Audio.astro0(utc[0],utc[1],utc[2], \ utchours,nfreq.get(),options.MyGrid.get().upper(), \ options.auxra.get()+(' '*9)[:9], \ options.auxdec.get()+(' '*9)[:9]) if len(HisGrid.get().strip())<4: g.ndop=g.ndop00 g.dfdt=g.dfdt0 if (ntx.get()==1 and noshjt65.get()) or noshjt65all.get(): Audio.gcom2.ntx2=1 else: Audio.gcom2.ntx2=0 if mode.get()[:4]=='JT65' or mode.get()[:3]=='JT4' \ or mode.get()[:2]=='CW': graph2.delete(ALL) graph2.create_text(80,13,anchor=CENTER,text="Moon",font=g2font) graph2.create_text(13,37,anchor=W, text="Az: %6.2f" % g.AzMoon,font=g2font) graph2.create_text(13,61,anchor=W, text="El: %6.2f" % g.ElMoon,font=g2font) graph2.create_text(13,85,anchor=W, text="Dop:%6d" % g.ndop,font=g2font) graph2.create_text(13,109,anchor=W,text="Dgrd:%5.1f" % g.Dgrd,font=g2font) if (mode.get()[:4]=='JT65' or mode.get()[:3]=='JT4') and g.freeze_decode: itol=2 ltol.configure(text='Tol '+str(50)) Audio.gcom2.dftolerance=50 nfreeze.set(1) Audio.gcom2.nfreeze=1 if Audio.gcom2.monitoring: Audio.gcom2.ndecoding=1 Audio.gcom2.nagain=0 else: Audio.gcom2.ndecoding=4 Audio.gcom2.nagain=1 g.freeze_decode=0 n=-99 g.rms=g.rms+0.001 if g.rms > 0: n=int(20.0*log10(g.rms/770.0+0.01)) else: print "RMS noise:", g.rms, " out of range." t="Rx noise:%3d dB" % (n,) if n>=-10 and n<=10: msg4.configure(text=t,bg='gray85') else: msg4.configure(text=t,bg='red') t=g.ftnstr(Audio.gcom2.decodedfile)
|
if options.rignum.get()==901: nHzLO=4*(nHz - iq.fiq.get()) cmd="CMDSR -f %d" % (nHzLO,) elif options.rignum.get()==2509:
|
if options.rignum.get()==2509: nHzLO=nHz - iq.fiq.get()
|
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 120 try: f0.set(float(sf0.get())) ftx.set(float(sftx.get())) except: pass isec=utc[5] twait=120.0 - (tsec % 120.0) if iband.get()!=iband0 or advanced.fset.get(): advanced.fset.set(0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t) if options.cat_enable.get(): if advanced.encal.get(): nHz=int(advanced.Acal.get() + \ f0.get()*(1000000.0 + advanced.Bcal.get()) + 0.5) else: nHz=int(1000000.0*f0.get() + 0.5) if options.rignum.get()==901: nHzLO=4*(nHz - iq.fiq.get()) cmd="CMDSR -f %d" % (nHzLO,) elif options.rignum.get()==2509: cmd="rigctl -m %d -r %s F %d" % \ (options.rignum.get(),options.CatPort.get(),nHz) else: cmd="rigctl -m %d -r %s -s %d -C data_bits=%s -C stop_bits=%s -C serial_handshake=%s F %d" % \ (options.rignum.get(),options.CatPort.get(), \ options.serial_rate.get(),options.databits.get(), \ options.stopbits.get(),options.serial_handshake.get(), nHz) ierr=os.system(cmd) if ierr==0: bandmap=[] bm={} text1.configure(state=NORMAL) text1.delete('1.0',END) text1.configure(state=DISABLED) iband0=iband.get() else: print 'Error attempting to set rig frequency.\a' print cmd + '\a' iband.set(iband0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t) else: iband0=iband.get() freq0[iband.get()]=f0.get() freqtx[iband.get()]=ftx.get() if isec != isec0: #Do once per second isec0=isec t=time.strftime('%Y %b %d\n%H:%M:%S',utc) ldate.configure(text=t) root_geom=root.geometry() utchours=utc[3]+utc[4]/60.0 + utc[5]/3600.0 try: if options.dBm.get()!=ndbm0: ndbm0=options.dBm.get() options.dbm_balloon() except: pass put_params() nndf=int(1000000.0*(ftx.get()-f0.get()) + 0.5) - 1500 ndb=int(w.acom1.xdb1-41.0) if ndb<-30: ndb=-30 if iq.iqmode.get(): ndb2=int(w.acom1.xdb2-41.0) if ndb2<-30: ndb2=-30 t='Rx Noise: %3d %3d dB' % (ndb,ndb2) else: t='Rx Noise: %3d dB' % (ndb,) bg='gray85' r=SUNKEN if w.acom1.receiving: if ndb>10 and ndb<=20: bg='yellow' elif ndb<-20 or ndb>20: bg='red' else: t='' r=FLAT msg1.configure(text=t,bg=bg,relief=r) gain=w.acom1.gain phdeg=57.2957795*w.acom1.phase nreject=int(w.acom1.reject) t='Bal: %6.4f Pha: %6.1f >%3d dB' % (gain,phdeg,nreject) iq.lab1.configure(text=t)
|
(options.rignum.get(),options.CatPort.get(),nHz)
|
(options.rignum.get(),options.CatPort.get(),nHzLO)
|
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 120 try: f0.set(float(sf0.get())) ftx.set(float(sftx.get())) except: pass isec=utc[5] twait=120.0 - (tsec % 120.0) if iband.get()!=iband0 or advanced.fset.get(): advanced.fset.set(0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t) if options.cat_enable.get(): if advanced.encal.get(): nHz=int(advanced.Acal.get() + \ f0.get()*(1000000.0 + advanced.Bcal.get()) + 0.5) else: nHz=int(1000000.0*f0.get() + 0.5) if options.rignum.get()==901: nHzLO=4*(nHz - iq.fiq.get()) cmd="CMDSR -f %d" % (nHzLO,) elif options.rignum.get()==2509: cmd="rigctl -m %d -r %s F %d" % \ (options.rignum.get(),options.CatPort.get(),nHz) else: cmd="rigctl -m %d -r %s -s %d -C data_bits=%s -C stop_bits=%s -C serial_handshake=%s F %d" % \ (options.rignum.get(),options.CatPort.get(), \ options.serial_rate.get(),options.databits.get(), \ options.stopbits.get(),options.serial_handshake.get(), nHz) ierr=os.system(cmd) if ierr==0: bandmap=[] bm={} text1.configure(state=NORMAL) text1.delete('1.0',END) text1.configure(state=DISABLED) iband0=iband.get() else: print 'Error attempting to set rig frequency.\a' print cmd + '\a' iband.set(iband0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t) else: iband0=iband.get() freq0[iband.get()]=f0.get() freqtx[iband.get()]=ftx.get() if isec != isec0: #Do once per second isec0=isec t=time.strftime('%Y %b %d\n%H:%M:%S',utc) ldate.configure(text=t) root_geom=root.geometry() utchours=utc[3]+utc[4]/60.0 + utc[5]/3600.0 try: if options.dBm.get()!=ndbm0: ndbm0=options.dBm.get() options.dbm_balloon() except: pass put_params() nndf=int(1000000.0*(ftx.get()-f0.get()) + 0.5) - 1500 ndb=int(w.acom1.xdb1-41.0) if ndb<-30: ndb=-30 if iq.iqmode.get(): ndb2=int(w.acom1.xdb2-41.0) if ndb2<-30: ndb2=-30 t='Rx Noise: %3d %3d dB' % (ndb,ndb2) else: t='Rx Noise: %3d dB' % (ndb,) bg='gray85' r=SUNKEN if w.acom1.receiving: if ndb>10 and ndb<=20: bg='yellow' elif ndb<-20 or ndb>20: bg='red' else: t='' r=FLAT msg1.configure(text=t,bg=bg,relief=r) gain=w.acom1.gain phdeg=57.2957795*w.acom1.phase nreject=int(w.acom1.reject) t='Bal: %6.4f Pha: %6.1f >%3d dB' % (gain,phdeg,nreject) iq.lab1.configure(text=t)
|
if options.rignum.get() == 901: cmd="CMDSR -T 0" elif options.rignum.get() == 2509:
|
if options.rignum.get() == 2509:
|
def readinit(): global nparam,mrudir try: for i in range(len(params)): if badlist.count(i)>0: print 'Skipping bad entry in WSPR.INI:\a',params[i] continue key,value=params[i].split() if key == 'WSPRGeometry': root.geometry(value) elif key == 'MyCall': options.MyCall.set(value) elif key == 'MyGrid': options.MyGrid.set(value) elif key == 'CWID': advanced.idint.set(value) elif key == 'dBm': options.dBm.set(value) elif key == 'PctTx': ipctx.set(value) elif key == 'PttPort': options.PttPort.set(value) elif key == 'CatPort': options.CatPort.set(value) elif key == 'AudioIn': value=value.replace("#"," ") g.DevinName.set(value) try: g.ndevin.set(int(value[:2])) except: g.ndevin.set(0) options.DevinName.set(value) elif key == 'AudioOut': value=value.replace("#"," ") g.DevoutName.set(value) try: g.ndevout.set(int(value[:2])) except: g.ndevout.set(0) options.DevoutName.set(value) elif key == 'BFOfreq': advanced.bfofreq.set(value) elif key == 'Acal': advanced.Acal.set(value) elif key == 'Bcal': advanced.Bcal.set(value) elif key == 'CalEnable': advanced.encal.set(value) elif key == 'IQmode': iq.iqmode.set(value) elif key == 'IQrx': iq.iqrx.set(value) elif key == 'IQtx': iq.iqtx.set(value) elif key == 'FIQ': iq.fiq.set(value) elif key == 'Ntxdb': advanced.isc1.set(value) elif key == 'Ntxbal': iq.isc2.set(value) elif key == 'Ntxbalf': iq.isc2a.set(value) elif key == 'Ntxpha': iq.isc3.set(value) elif key == 'Ntxphaf': iq.isc3a.set(value) elif key == 'PTTmode': options.pttmode.set(value) elif key == 'CATenable': options.cat_enable.set(value) elif key == 'SerialRate': options.serial_rate.set(int(value)) elif key == 'DataBits': options.databits.set(int(value)) elif key == 'StopBits': options.stopbits.set(int(value)) elif key == 'Handshake': options.serial_handshake.set(value.replace("#"," ") ) elif key == 'Rig': t=value.replace("#"," ") options.rig.set(t) options.rignum.set(int(t[:4])) elif key == 'Nsave': nsave.set(value) elif key == 'Upload': upload.set(value) elif key == 'Idle': idle.set(value) elif key == 'Debug': ndebug.set(value) elif key == 'WatScale': sc1.set(value) elif key == 'WatOffset': sc2.set(value) elif key == 'Palette': g.cmap=value elif key == 'freq0_600': freq0[1]=float(value) elif key == 'freq0_160': freq0[2]=float(value) elif key == 'freq0_80': freq0[3]=float(value) elif key == 'freq0_60': freq0[4]=float(value) elif key == 'freq0_40': freq0[5]=float(value) elif key == 'freq0_30': freq0[6]=float(value) elif key == 'freq0_20': freq0[7]=float(value) elif key == 'freq0_17': freq0[8]=float(value) elif key == 'freq0_15': freq0[9]=float(value) elif key == 'freq0_12': freq0[10]=float(value) elif key == 'freq0_10': freq0[11]=float(value) elif key == 'freq0_6': freq0[12]=float(value) elif key == 'freq0_4': freq0[13]=float(value) elif key == 'freq0_2': freq0[14]=float(value) elif key == 'freq0_other': freq0[15]=float(value) elif key == 'freqtx_600': freqtx[1]=float(value) elif key == 'freqtx_160': freqtx[2]=float(value) elif key == 'freqtx_80': freqtx[3]=float(value) elif key == 'freqtx_60': freqtx[4]=float(value) elif key == 'freqtx_40': freqtx[5]=float(value) elif key == 'freqtx_30': freqtx[6]=float(value) elif key == 'freqtx_20': freqtx[7]=float(value) elif key == 'freqtx_17': freqtx[8]=float(value) elif key == 'freqtx_15': freqtx[9]=float(value) elif key == 'freqtx_12': freqtx[10]=float(value) elif key == 'freqtx_10': freqtx[11]=float(value) elif key == 'freqtx_6': freqtx[12]=float(value) elif key == 'freqtx_4': freqtx[13]=float(value) elif key == 'freqtx_2': freqtx[14]=float(value) elif key == 'freqtx_other': freqtx[15]=float(value) elif key == 'iband': iband.set(value) elif key == 'StartIdle': start_idle.set(value) elif key == 'NoBeep': no_beep.set(value) elif key == 'Ygain': w.acom1.gain=float(value) elif key == 'Phdeg': w.acom1.phase=float(value)/57.2957795 elif key == 'Reject': w.acom1.reject=float(value) elif key == 'RxApply': iq.iqrxapp.set(value) elif key == 'MRUdir': mrudir=value.replace("#"," ") nparam=i except: badlist.append(i) nparam=i
|
if event.y<40 and Audio.gcom2.nspecial==0:
|
if event.y<40 and Audio.gcom2.nspecial==0 and mode.get()<>'ISCAT':
|
def dtdf_change(event): if mode.get()[:4]=='JTMS': t="%.1f" % (event.x*30.0/500.0,) lab6.configure(text=t,bg='green') else: if event.y<40 and Audio.gcom2.nspecial==0: lab1.configure(text='Time (s)',bg="#33FFFF") #light blue
|
(event.y<95 and Audio.gcom2.nspecial>0):
|
(event.y<95 and (Audio.gcom2.nspecial>0 or mode.get()=='ISCAT')):
|
def dtdf_change(event): if mode.get()[:4]=='JTMS': t="%.1f" % (event.x*30.0/500.0,) lab6.configure(text=t,bg='green') else: if event.y<40 and Audio.gcom2.nspecial==0: lab1.configure(text='Time (s)',bg="#33FFFF") #light blue
|
t="%d" % int(0.25*(12000.0/1024.0)*(event.x-250.0)+3)
|
t="%d" % int(0.25*(12000.0/1024.0)*(event.x-250.0))
|
def dtdf_change(event): if mode.get()[:4]=='JTMS': t="%.1f" % (event.x*30.0/500.0,) lab6.configure(text=t,bg='green') else: if event.y<40 and Audio.gcom2.nspecial==0: lab1.configure(text='Time (s)',bg="#33FFFF") #light blue
|
mdf=int(Audio.gcom2.idf+(event.x-250)*5.859)
|
mdf=int(Audio.gcom2.idf+(event.x-250)*2.9296875)
|
def mouse_up_g1(event): global nopen,nxa if mode.get()=='ISCAT': if abs(event.x-nxa)>10: nxb=min(event.x,500) if nxb<nxa: t=nxb nxb=nxa nxa=t Audio.gcom2.nxa=nxa Audio.gcom2.nxb=nxb decode() else: if not nopen: mdf=int(Audio.gcom2.idf+(event.x-250)*5.859) if mdf<-400: mdf=-400 if mdf>400: mdf=400 Audio.gcom2.mousedf=mdf nopen=0
|
nhs=0 if options.serial_handshake.get()=='XONXOFF': nhs=1 if options.serial_handshake.get()=='Hardware': nhs=2 w.acom1.nhandshake=nhs
|
w.acom1.chs=options.serial_handshake.get() + \ ' '[:40]
|
def put_params(param3=NONE): global param20
|
use_tearoff = (sys.platform != 'darwin')
|
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
|
|
if (sys.platform != 'darwin'): filebutton = Menubutton(mbar, text = 'File') filebutton.pack(side = LEFT) filemenu = Menu(filebutton, tearoff=0) filebutton['menu'] = filemenu else: filemenu = Menu(mbar, tearoff=0)
|
filebutton = Menubutton(mbar, text = 'File') filebutton.pack(side = LEFT) filemenu = Menu(filebutton) filebutton['menu'] = filemenu
|
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
|
if (sys.platform != 'darwin'): setupbutton = Menubutton(mbar, text = 'Setup') setupbutton.pack(side = LEFT) setupmenu = Menu(setupbutton, tearoff=0) setupbutton['menu'] = setupmenu else: setupmenu = Menu(mbar, tearoff=0)
|
setupbutton = Menubutton(mbar, text = 'Setup') setupbutton.pack(side = LEFT) setupmenu = Menu(setupbutton) setupbutton['menu'] = setupmenu
|
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
|
if (sys.platform != 'darwin'): viewbutton=Menubutton(mbar,text='View') viewbutton.pack(side=LEFT) viewmenu=Menu(viewbutton,tearoff=0) viewbutton['menu']=viewmenu else: viewmenu=Menu(mbar,tearoff=0)
|
viewbutton=Menubutton(mbar,text='View') viewbutton.pack(side=LEFT) viewmenu=Menu(viewbutton) viewbutton['menu']=viewmenu
|
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
|
if (sys.platform != 'darwin'): modebutton = Menubutton(mbar, text = 'Mode') modebutton.pack(side = LEFT) modemenu = Menu(modebutton, tearoff=0) modebutton['menu'] = modemenu else: modemenu = Menu(mbar, tearoff=use_tearoff)
|
modebutton = Menubutton(mbar, text = 'Mode') modebutton.pack(side = LEFT) modemenu = Menu(modebutton) modebutton['menu'] = modemenu
|
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
|
if (sys.platform != 'darwin'): savebutton = Menubutton(mbar, text = 'Save') savebutton.pack(side = LEFT) savemenu = Menu(savebutton, tearoff=use_tearoff) savebutton['menu'] = savemenu else: savemenu = Menu(mbar, tearoff=use_tearoff)
|
savebutton = Menubutton(mbar, text = 'Save') savebutton.pack(side = LEFT) savemenu = Menu(savebutton) savebutton['menu'] = savemenu
|
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
|
if (sys.platform != 'darwin'): bandbutton = Menubutton(mbar, text = 'Band') bandbutton.pack(side = LEFT) bandmenu = Menu(bandbutton, tearoff=use_tearoff) bandbutton['menu'] = bandmenu else: bandmenu = Menu(mbar, tearoff=use_tearoff)
|
bandbutton = Menubutton(mbar, text = 'Band') bandbutton.pack(side = LEFT) bandmenu = Menu(bandbutton) bandbutton['menu'] = bandmenu
|
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
|
if (sys.platform != 'darwin'): helpbutton = Menubutton(mbar, text = 'Help') helpbutton.pack(side = LEFT) helpmenu = Menu(helpbutton, tearoff=0) helpbutton['menu'] = helpmenu else: helpmenu = Menu(mbar, tearoff=0)
|
helpbutton = Menubutton(mbar, text = 'Help') helpbutton.pack(side = LEFT) helpmenu = Menu(helpbutton) helpbutton['menu'] = helpmenu
|
def audio_config(): inbad,outbad=Audio.audiodev(g.ndevin.get(),g.ndevout.get()) options.inbad.set(inbad) options.outbad.set(outbad) if inbad or outbad: Audio.gcom2.ndevsok=0 options1() else: Audio.gcom2.ndevsok=1
|
os.path.exists('.\user_.exe'):
|
os.path.exists('.\user_hardware.exe'):
|
def update(): global root_geom,isec0,im,pim,ndbm0,nsec0,a,ftx0,nin0,nout0, \ receiving,transmitting,newdat,nscroll,newspec,scale0,offset0, \ modpixmap0,tw,s0,c0,fmid,fmid0,loopall,ntr0,txmsg,iband0, \ bandmap,bm,t0,nreject,gain,phdeg if hopping_feature==1 and hopping.hopping==1: w.acom1.nfhopping=1 if w.acom1.nfhopok: w.acom1.nfhopok=0 #print 'hopping' found=False while not found: b = random.randint(1,len(hopping.bandlabels)-1) #print '>>> ',b,' ',hopping.hoppingflag[b].get() if hopping.hoppingflag[b].get()!=0: found=True print 'hopping to ',hopping.bandlabels[b],' Tx Fraction ',hopping.hoppingpctx[b].get() ipctx.set(hopping.hoppingpctx[b].get()) iband.set(b) else: #print 'tuning off hopping scheduling' w.acom1.nfhopping=0 #print 'hopping scheduling ?',w.acom1.nfhopping tsec=time.time() utc=time.gmtime(tsec) nsec=int(tsec) nsec0=nsec ns120=nsec % 120 try: f0.set(float(sf0.get())) ftx.set(float(sftx.get())) except: pass isec=utc[5] twait=120.0 - (tsec % 120.0) if iband.get()!=iband0 or advanced.fset.get(): advanced.fset.set(0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t) if options.cat_enable.get(): if advanced.encal.get(): nHz=int(advanced.Acal.get() + \ f0.get()*(1000000.0 + advanced.Bcal.get()) + 0.5) else: nHz=int(1000000.0*f0.get() + 0.5) if options.rignum.get()==2509: nHzLO=nHz - iq.fiq.get() cmd="rigctl -m %d -r %s F %d" % \ (options.rignum.get(),options.CatPort.get(),nHzLO) else: cmd="rigctl -m %d -r %s -s %d -C data_bits=%s -C stop_bits=%s -C serial_handshake=%s F %d" % \ (options.rignum.get(),options.CatPort.get(), \ options.serial_rate.get(),options.databits.get(), \ options.stopbits.get(),options.serial_handshake.get(), nHz) ierr=os.system(cmd) if ierr==0: bandmap=[] bm={} text1.configure(state=NORMAL) text1.delete('1.0',END) text1.configure(state=DISABLED) iband0=iband.get() f=open(appdir+'/fmt.ini',mode='w') f.write(cmd+'\n') f.write(str(g.ndevin.get())+'\n') f.close() cmd2='' if os.path.exists('.\user_hardware.bat') or \ os.path.exists('.\user_.exe'): cmd2='.\user_hardware ' + str(band[iband0]) elif os.path.exists('./user_hardware'): cmd2='./user_hardware ' + str(band[iband0]) if cmd2!='': try: ierr2=os.system(cmd2) except: print 'Execution of "'+cmd2+'" failed.' else: print 'Error attempting to set rig frequency.\a' print cmd + '\a' iband.set(iband0) f0.set(freq0[iband.get()]) t="%.6f" % (f0.get(),) sf0.set(t) ftx.set(freqtx[iband.get()]) t="%.6f" % (ftx.get(),) sftx.set(t) else: iband0=iband.get() freq0[iband.get()]=f0.get() freqtx[iband.get()]=ftx.get() if isec != isec0: #Do once per second isec0=isec t=time.strftime('%Y %b %d\n%H:%M:%S',utc) ldate.configure(text=t) root_geom=root.geometry() utchours=utc[3]+utc[4]/60.0 + utc[5]/3600.0 try: if options.dBm.get()!=ndbm0: ndbm0=options.dBm.get() options.dbm_balloon() except: pass put_params() nndf=int(1000000.0*(ftx.get()-f0.get()) + 0.5) - 1500 ndb=int(w.acom1.xdb1-41.0) if ndb<-30: ndb=-30 if iq.iqmode.get(): ndb2=int(w.acom1.xdb2-41.0) if ndb2<-30: ndb2=-30 t='Rx Noise: %3d %3d dB' % (ndb,ndb2) else: t='Rx Noise: %3d dB' % (ndb,) bg='gray85' r=SUNKEN if w.acom1.receiving: if ndb>10 and ndb<=20: bg='yellow' elif ndb<-20 or ndb>20: bg='red' else: t='' r=FLAT msg1.configure(text=t,bg=bg,relief=r) gain=w.acom1.gain phdeg=57.2957795*w.acom1.phase nreject=int(w.acom1.reject) t='Bal: %6.4f Pha: %6.1f >%3d dB' % (gain,phdeg,nreject) iq.lab1.configure(text=t)
|
self.load_mod_categories()
|
def load_mod_common(self): self.load_mod_users() self.load_mod_siteinfo() self.load_mod_categories() self.load_mod_articles() self.load_mod_tags() self.load_mod_comments() self.load_mod_links() self.load_mod_styles() self.load_mod_images() self.load_mod_widgets()
|
|
except Queue.Empty:
|
except Empty:
|
def run(self): """Repeatedly process the job queue until told to exit.""" while True: if self._dismissed.isSet(): # we are dismissed, break out of loop break # get next work request. If we don't get a new request from the # queue after self._poll_timout seconds, we jump to the start of # the while loop again, to give the thread a chance to exit. try: request = self._requests_queue.get(True, self._poll_timeout) except Queue.Empty: continue else: if self._dismissed.isSet(): # we are dismissed, put back request in queue and exit loop self._requests_queue.put(request) break try: result = request.callable(*request.args, **request.kwds) self._results_queue.put((request, result)) except: request.exception = True self._results_queue.put((request, sys.exc_info()))
|
except Queue.Empty:
|
except Empty:
|
def poll(self, block=False): """Process any new results in the queue.""" while True: # still results pending? if not self.workRequests: raise NoResultsPending # are there still workers to process remaining requests? elif block and not self.workers: raise NoWorkersAvailable try: # get back next results request, result = self._results_queue.get(block=block) # has an exception occured? if request.exception and request.exc_callback: request.exc_callback(request, result) # hand results to callback, if any if request.callback and not \ (request.exception and request.exc_callback): request.callback(request, result) del self.workRequests[request.requestID] except Queue.Empty: break
|
def getchunkname(x, y):
|
def getchunkname(chunk_x, chunk_y):
|
def getchunkname(x, y): def base36encode(number): sign = '' if not isinstance(number, (int, long)): raise TypeError('number must be an integer') if number < 0: #raise ValueError('number must be positive') sign = '-' number = number * -1 alphabet = '0123456789abcdefghijklmnopqrstuvwxyz' base36 = '' while number: number, i = divmod(number, 36) base36 = alphabet[i] + base36 return sign + base36 or sign + alphabet[0] chunk_x = -13 chunk_y = 44 filename = base36encode(divmod(chunk_x, 64)[1]) + "\\" + base36encode(divmod(chunk_y, 64)[1]) + "\\c." + base36encode(chunk_x) + "." + base36encode(chunk_y) + ".dat" return filename
|
chunk_x = -13 chunk_y = 44
|
def base36encode(number): sign = '' if not isinstance(number, (int, long)): raise TypeError('number must be an integer') if number < 0: #raise ValueError('number must be positive') sign = '-' number = number * -1
|
|
exit(0)
|
return Image.new("RGB", (256, 256))
|
def map_chunk_slice(x, z, y = 64): map_directory = "D:\\Minemap\\!CURRENT\\dev\\shm\\rsync\\smp2\\smp\\World10\\" chunkname = map_directory + getchunkname(x, z) chunk = gzip.open(chunkname, 'r') output = read_tag(chunk) print output[0] try: for level in output[2]: # skip end tags if (level[0] == 0): continue for tag in level[2]: if (tag[0] == 0): continue print tag[1] if tag[1] == "Blocks": blocks = tag[2] print "Blocks retrieved" print "Blocks count: %d" % len(blocks) except: print "No blocks found" exit(0) # y = 77 # Print map by block ID for z in range(0, 16): for x in range (0, 16): print ord(blocks[ y + ( z * 128 + (x * 128 * 16)) ]), print def get_cropbox(x, y): return (x*16, y*16, x*16 + 16, y*16 + 16) terrain = Image.open("terrain.png") stone = terrain.crop(get_cropbox(0,0)) dirt = terrain.crop(get_cropbox(2,0)) grass = terrain.crop(get_cropbox(3,0)) gravel = terrain.crop(get_cropbox(3,1)) sand = terrain.crop(get_cropbox(2,1)) coal = terrain.crop(get_cropbox(2,2)) iron = terrain.crop(get_cropbox(1,2)) gold = terrain.crop(get_cropbox(0,2)) redstone = terrain.crop(get_cropbox(3,3)) diamond = terrain.crop(get_cropbox(2,3)) obsidian = terrain.crop(get_cropbox(5,2)) bedrock = terrain.crop(get_cropbox(1,1)) clay = terrain.crop(get_cropbox(2,0)) log = terrain.crop(get_cropbox(5,1)) leaves = terrain.crop(get_cropbox(4,3)) ice = terrain.crop(get_cropbox(3,4)) mossy_coblestone = terrain.crop(get_cropbox(4,2)) cobblestone_block = terrain.crop(get_cropbox(0,1)) wood_block = terrain.crop(get_cropbox(4,0)) # bookshelf = terrain.crop(get_cropbox(4,0)) iron_block = terrain.crop(get_cropbox(6,1)) gold_block = terrain.crop(get_cropbox(7,1)) diamond_block = terrain.crop(get_cropbox(8,1)) chest = terrain.crop(get_cropbox(9,1)) tnt = terrain.crop(get_cropbox(9,0)) glass = terrain.crop(get_cropbox(1,3)) soil = terrain.crop(get_cropbox(7,5)) brick = terrain.crop(get_cropbox(7,0)) halfblock = terrain.crop(get_cropbox(6,0)) map = Image.new("RGB", (256, 256)) # Draw map for x in range(0, 16): for z in range (0, 16): block_id = ord(blocks[ y + ( z * 128 + (x * 128 * 16)) ]) if block_id == 1: map.paste(stone, get_cropbox(x, z)) if block_id == 2: map.paste(grass, get_cropbox(x, z)) elif block_id == 3: map.paste(dirt, get_cropbox(x, z)) elif block_id == 4: map.paste(cobblestone, get_cropbox(x, z)) elif block_id == 5: map.paste(wood_block, get_cropbox(x, z)) elif block_id == 7: map.paste(bedrock, get_cropbox(x, z)) elif block_id == 12: map.paste(sand, get_cropbox(x, z)) elif block_id == 13: map.paste(gravel, get_cropbox(x, z)) elif block_id == 14: map.paste(gold, get_cropbox(x, z)) elif block_id == 15: map.paste(iron, get_cropbox(x, z)) elif block_id == 16: map.paste(coal, get_cropbox(x, z)) elif block_id == 17: map.paste(log, get_cropbox(x, z)) elif block_id == 18: map.paste(leaves, get_cropbox(x, z)) elif block_id == 20: map.paste(glass, get_cropbox(x, z)) elif block_id == 43: # both of these will look alike from above map.paste(halfblock, get_cropbox(x, z)) elif block_id == 44: # both of these will look alike from above map.paste(halfblock, get_cropbox(x, z)) elif block_id == 47: # Bookshelf looks like wood from above map.paste(wood_block, get_cropbox(x, z)) elif block_id == 49: map.paste(mossy_coblestone, get_cropbox(x, z)) elif block_id == 49: map.paste(obsidian, get_cropbox(x, z)) elif block_id == 56: map.paste(diamond, get_cropbox(x, z)) elif block_id == 60: map.paste(soil, get_cropbox(x, z)) elif block_id == 73: map.paste(redstone, get_cropbox(x, z)) elif block_id == 79: map.paste(ice, get_cropbox(x, z)) elif block_id == 82: map.paste(clay, get_cropbox(x, z)) return map
|
for z in range(0, 16): for x in range (0, 16): print ord(blocks[ y + ( z * 128 + (x * 128 * 16)) ]), print
|
def map_chunk_slice(x, z, y = 64): map_directory = "D:\\Minemap\\!CURRENT\\dev\\shm\\rsync\\smp2\\smp\\World10\\" chunkname = map_directory + getchunkname(x, z) chunk = gzip.open(chunkname, 'r') output = read_tag(chunk) print output[0] try: for level in output[2]: # skip end tags if (level[0] == 0): continue for tag in level[2]: if (tag[0] == 0): continue print tag[1] if tag[1] == "Blocks": blocks = tag[2] print "Blocks retrieved" print "Blocks count: %d" % len(blocks) except: print "No blocks found" exit(0) # y = 77 # Print map by block ID for z in range(0, 16): for x in range (0, 16): print ord(blocks[ y + ( z * 128 + (x * 128 * 16)) ]), print def get_cropbox(x, y): return (x*16, y*16, x*16 + 16, y*16 + 16) terrain = Image.open("terrain.png") stone = terrain.crop(get_cropbox(0,0)) dirt = terrain.crop(get_cropbox(2,0)) grass = terrain.crop(get_cropbox(3,0)) gravel = terrain.crop(get_cropbox(3,1)) sand = terrain.crop(get_cropbox(2,1)) coal = terrain.crop(get_cropbox(2,2)) iron = terrain.crop(get_cropbox(1,2)) gold = terrain.crop(get_cropbox(0,2)) redstone = terrain.crop(get_cropbox(3,3)) diamond = terrain.crop(get_cropbox(2,3)) obsidian = terrain.crop(get_cropbox(5,2)) bedrock = terrain.crop(get_cropbox(1,1)) clay = terrain.crop(get_cropbox(2,0)) log = terrain.crop(get_cropbox(5,1)) leaves = terrain.crop(get_cropbox(4,3)) ice = terrain.crop(get_cropbox(3,4)) mossy_coblestone = terrain.crop(get_cropbox(4,2)) cobblestone_block = terrain.crop(get_cropbox(0,1)) wood_block = terrain.crop(get_cropbox(4,0)) # bookshelf = terrain.crop(get_cropbox(4,0)) iron_block = terrain.crop(get_cropbox(6,1)) gold_block = terrain.crop(get_cropbox(7,1)) diamond_block = terrain.crop(get_cropbox(8,1)) chest = terrain.crop(get_cropbox(9,1)) tnt = terrain.crop(get_cropbox(9,0)) glass = terrain.crop(get_cropbox(1,3)) soil = terrain.crop(get_cropbox(7,5)) brick = terrain.crop(get_cropbox(7,0)) halfblock = terrain.crop(get_cropbox(6,0)) map = Image.new("RGB", (256, 256)) # Draw map for x in range(0, 16): for z in range (0, 16): block_id = ord(blocks[ y + ( z * 128 + (x * 128 * 16)) ]) if block_id == 1: map.paste(stone, get_cropbox(x, z)) if block_id == 2: map.paste(grass, get_cropbox(x, z)) elif block_id == 3: map.paste(dirt, get_cropbox(x, z)) elif block_id == 4: map.paste(cobblestone, get_cropbox(x, z)) elif block_id == 5: map.paste(wood_block, get_cropbox(x, z)) elif block_id == 7: map.paste(bedrock, get_cropbox(x, z)) elif block_id == 12: map.paste(sand, get_cropbox(x, z)) elif block_id == 13: map.paste(gravel, get_cropbox(x, z)) elif block_id == 14: map.paste(gold, get_cropbox(x, z)) elif block_id == 15: map.paste(iron, get_cropbox(x, z)) elif block_id == 16: map.paste(coal, get_cropbox(x, z)) elif block_id == 17: map.paste(log, get_cropbox(x, z)) elif block_id == 18: map.paste(leaves, get_cropbox(x, z)) elif block_id == 20: map.paste(glass, get_cropbox(x, z)) elif block_id == 43: # both of these will look alike from above map.paste(halfblock, get_cropbox(x, z)) elif block_id == 44: # both of these will look alike from above map.paste(halfblock, get_cropbox(x, z)) elif block_id == 47: # Bookshelf looks like wood from above map.paste(wood_block, get_cropbox(x, z)) elif block_id == 49: map.paste(mossy_coblestone, get_cropbox(x, z)) elif block_id == 49: map.paste(obsidian, get_cropbox(x, z)) elif block_id == 56: map.paste(diamond, get_cropbox(x, z)) elif block_id == 60: map.paste(soil, get_cropbox(x, z)) elif block_id == 73: map.paste(redstone, get_cropbox(x, z)) elif block_id == 79: map.paste(ice, get_cropbox(x, z)) elif block_id == 82: map.paste(clay, get_cropbox(x, z)) return map
|
|
image = map_chunk_slice(0,0, 77)
|
imageL = map_chunk_slice(-10, 40, 76).crop((0,0,256,256)) imageR = map_chunk_slice(-9, 40, 76).crop((0,0,256,256)) image = Image.new("RGB", (512, 256)) image.paste(imageL, (0,0,256,256)) image.paste(imageR, (256,0,512,256))
|
def get_cropbox(x, y): return (x*16, y*16, x*16 + 16, y*16 + 16)
|
print "%d items of type %s" % (list_length, tag_types[list_item_type])
|
def read_list_payload(chunk): list_item_type = ord(chunk.read(1)) list_length = unpack('>l', chunk.read(4))[0] print "%d items of type %s" % (list_length, tag_types[list_item_type])
|
|
print "Array length: %d" % length
|
def read_byte_array(chunk): length = read_int(chunk) print "Array length: %d" % length payload = chunk.read(length) return payload
|
|
print "Read %d elements in compound" % len(payload)
|
def read_compound(chunk): payload = [] tag = read_tag(chunk) payload.append(tag) tag_type = tag[0] while (tag_type > 0): tag = read_tag(chunk) payload.append(tag) tag_type = tag[0] print "Read %d elements in compound" % len(payload) return payload
|
|
print "Found tag type: %s" % (tag_types[type], )
|
def read_tag(chunk): type = ord(chunk.read(1)) # Chunk starts with "10" byte print "Found tag type: %s" % (tag_types[type], ) if (type > 0): name = read_string(chunk) if (name != None): print "Name: %s" % name else: name = '' payload = None # Read payload of each tag. "0" tag has no payload if (type == 1): payload = read_byte(chunk) elif (type == 2): payload = read_short(chunk) elif (type == 3): payload = read_int(chunk) elif (type == 4): payload = read_long(chunk) elif (type == 5): # no separate float for now payload = read_long(chunk) elif (type == 6): # no separate double for now payload = read_long(chunk) elif (type == 7): payload = read_byte_array(chunk) elif (type == 8): payload = read_string(chunk) elif (type == 9): payload = read_list_payload(chunk) elif (type == 10): payload = read_compound(chunk) return (type, name, payload)
|
|
if (name != None): print "Name: %s" % name
|
def read_tag(chunk): type = ord(chunk.read(1)) # Chunk starts with "10" byte print "Found tag type: %s" % (tag_types[type], ) if (type > 0): name = read_string(chunk) if (name != None): print "Name: %s" % name else: name = '' payload = None # Read payload of each tag. "0" tag has no payload if (type == 1): payload = read_byte(chunk) elif (type == 2): payload = read_short(chunk) elif (type == 3): payload = read_int(chunk) elif (type == 4): payload = read_long(chunk) elif (type == 5): # no separate float for now payload = read_long(chunk) elif (type == 6): # no separate double for now payload = read_long(chunk) elif (type == 7): payload = read_byte_array(chunk) elif (type == 8): payload = read_string(chunk) elif (type == 9): payload = read_list_payload(chunk) elif (type == 10): payload = read_compound(chunk) return (type, name, payload)
|
|
print output[0]
|
blocks = None
|
def map_chunk_slice(x, z, y = 64): map_directory = "D:\\Minemap\\!CURRENT\\dev\\shm\\rsync\\smp2\\smp\\World10\\" chunkname = map_directory + getchunkname(x, z) chunk = gzip.open(chunkname, 'r') output = read_tag(chunk) print output[0] try: for level in output[2]: # skip end tags if (level[0] == 0): continue for tag in level[2]: if (tag[0] == 0): continue print tag[1] if tag[1] == "Blocks": blocks = tag[2] print "Blocks retrieved" print "Blocks count: %d" % len(blocks) except: print "No blocks found" return Image.new("RGB", (256, 256)) #exit(0) # y = 77 # Print map by block ID
|
print tag[1]
|
def map_chunk_slice(x, z, y = 64): map_directory = "D:\\Minemap\\!CURRENT\\dev\\shm\\rsync\\smp2\\smp\\World10\\" chunkname = map_directory + getchunkname(x, z) chunk = gzip.open(chunkname, 'r') output = read_tag(chunk) print output[0] try: for level in output[2]: # skip end tags if (level[0] == 0): continue for tag in level[2]: if (tag[0] == 0): continue print tag[1] if tag[1] == "Blocks": blocks = tag[2] print "Blocks retrieved" print "Blocks count: %d" % len(blocks) except: print "No blocks found" return Image.new("RGB", (256, 256)) #exit(0) # y = 77 # Print map by block ID
|
|
print "Blocks retrieved" print "Blocks count: %d" % len(blocks) except: print "No blocks found"
|
except:
|
def map_chunk_slice(x, z, y = 64): map_directory = "D:\\Minemap\\!CURRENT\\dev\\shm\\rsync\\smp2\\smp\\World10\\" chunkname = map_directory + getchunkname(x, z) chunk = gzip.open(chunkname, 'r') output = read_tag(chunk) print output[0] try: for level in output[2]: # skip end tags if (level[0] == 0): continue for tag in level[2]: if (tag[0] == 0): continue print tag[1] if tag[1] == "Blocks": blocks = tag[2] print "Blocks retrieved" print "Blocks count: %d" % len(blocks) except: print "No blocks found" return Image.new("RGB", (256, 256)) #exit(0) # y = 77 # Print map by block ID
|
cobblestone_block = terrain.crop(get_cropbox(0,1))
|
cobblestone = terrain.crop(get_cropbox(0,1))
|
def get_cropbox(x, y): return (x*16, y*16, x*16 + 16, y*16 + 16)
|
imageLU = map_chunk_slice(-10, 40, 70).crop((0,0,256,256)) imageRU = map_chunk_slice(-9, 40, 70).crop((0,0,256,256)) imageLD = map_chunk_slice(-10, 41, 70).crop((0,0,256,256)) imageRD = map_chunk_slice(-9, 41, 70).crop((0,0,256,256)) print "Image mode: %s" % imageLU.mode image = Image.new("RGB", (512, 512)) image.paste(imageLU, (0,0,256,256)) image.paste(imageRU, (256,0,512,256)) image.paste(imageLD, (0,256,256,512)) image.paste(imageRD, (256,256,512,512)) try: image.save('.\map.png', 'PNG') except: print "Something went wrong on save"
|
def get_cropbox(x, y): return (x*16, y*16, x*16 + 16, y*16 + 16)
|
|
saturation_cross_section_factor):
|
saturation_cross_section_factor, write_output):
|
def AT_IGK (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, saturation_cross_section_factor): ''' Computes HCP response and RE/RBE using Katz\' Ion-Gamma-Kill approach according to Waligorski, 1988
|
self.E_MeV_u, self.particle_no, self.fluence_cm2, self.material_no, self.RDD_model, self.RDD_parameters, self.ER_model, self.ER_parameters, self.gamma_model, self.gamma_parameters, self.saturation_cross_section_factor)
|
self.E_MeV_u, self.particle_no, self.fluence_cm2, self.material_no, self.RDD_model, self.RDD_parameters, self.ER_model, self.ER_parameters, self.gamma_model, self.gamma_parameters, self.saturation_cross_section_factor, self.write_output)
|
def run(self): ''' RUN AT_IGK ''' self.results = self.AT_IGK(self.number_particles, self.E_MeV_u, self.particle_no, self.fluence_cm2, self.material_no, self.RDD_model, self.RDD_parameters, self.ER_model, self.ER_parameters, self.gamma_model, self.gamma_parameters, self.saturation_cross_section_factor) self.efficency = self.results[0] self.d_check= self.results[1] self.hcp_response = self.results[2] self.gamma_response = self.results[3]
|
ER_parameters_ctype,
|
def AT_SPISS (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, n_runs, N2, fluence_factor, write_output, importance_sampling): ''' Computes HCP response and RE/RBE using compound Poison process and statistical sampling (CPP_SS, the \'SPISS\' algorithm)
|
|
ER_parameters_ctype,
|
def AT_GSM (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, N_runs, N2, fluence_factor, write_output, nX, voxel_size_m, lethal_events_mode): ''' Computes HCP response and RE/RBE using summation of tracks an a Cartesian grid (the \'GSM\' algorithm)
|
|
ER_parameters_ctype,
|
def AT_IGK (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, saturation_cross_section_factor): ''' Computes HCP response and RE/RBE using Katz\' Ion-Gamma-Kill approach according to Waligorski, 1988
|
|
c_at_spiff = self.libamtrack.AT_SPIFF
|
c_at_spiff = libamtrack.AT_SPIFF
|
def AT_SPIFF (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, N2, fluence_factor, write_output, shrink_tails, shrink_tails_under, adjust_N2, lethal_events_mode): ''' Computes HCP response and RE/RBE using compound Poison process and successive convolutions (CPP_SC, the 'SPIFF' algorithm)
|
c_at_spiss = self.libamtrack.AT_SPISS
|
c_at_spiss = libamtrack.AT_SPISS
|
def AT_SPISS (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, n_runs, N2, fluence_factor, write_output, importance_sampling): ''' Computes HCP response and RE/RBE using compound Poison process and statistical sampling (CPP_SS, the 'SPISS' algorithm)
|
c_at_gsm = self.libamtrack.AT_GSM
|
c_at_gsm = libamtrack.AT_GSM
|
def AT_GSM (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, N_runs, N2, fluence_factor, write_output, nX, voxel_size_m, lethal_events_mode): ''' Computes HCP response and RE/RBE using summation of tracks an a Cartesian grid (the 'GSM' algorithm)
|
c_at_igk = self.libamtrack.AT_IGK
|
c_at_igk = libamtrack.AT_IGK
|
def AT_IGK (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, saturation_cross_section_factor): ''' Computes HCP response and RE/RBE using Katz\' Ion-Gamma-Kill approach according to Waligorski, 1988
|
saturation_cross_section_factor_ctype = ctypes.c_float(saturation_cross_section_factor)
|
saturation_cross_section_factor_ctype = ctypes.byref(ctypes.c_float(saturation_cross_section_factor))
|
def AT_IGK (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, saturation_cross_section_factor): ''' Computes HCP response and RE/RBE using Katz\' Ion-Gamma-Kill approach according to Waligorski, 1988
|
material_no = 51 n = 2 E_MeV_u = [100.0, 100.0] particle_no = [18,1] fluence_cm2 = [-10. ,-1.0] RDD_model = 3 RDD_parameters = [5e-8, 0] ER_model = 4 ER_parameters = [1] gamma_model = 4 gamma_parameters = [1, 10] N2 = 40 fluence_factor = 1.0 write_output = True shrink_tails = True shrink_tails_under = 1e-30 adjust_N2 = True lethal_events_mode = False N_runs= 1e3 importance_sampling = 0 voxel_size_m = 0.001 nX = 10 saturation_cross_section_factor = 1.0 test_obj = AmTrack() print 'SPISS\nResults:\n' print test_obj.AT_SPISS(n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, N_runs, N2, fluence_factor, write_output, importance_sampling) print'SPIFF\nResults:\n' print test_obj.AT_SPIFF(n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, N2, fluence_factor, write_output, shrink_tails, shrink_tails_under, adjust_N2, lethal_events_mode) print'IGK\nResults\n' print test_obj.AT_IGK (self, n, E_MeV_u, particle_no, fluence_cm2, material_no, RDD_model, RDD_parameters, ER_model, ER_parameters, gamma_model, gamma_parameters, saturation_cross_section_factor) print'GSM\ntest skipped\n'
|
test_run = AmSpiffRun() print test_run.particle_no test_run.run() print 'Efficency: %.4f\n'%test_run.efficency print test_run.__dict__()
|
def test_suite(): ''' test script for pyamtrack, runs all functions in a row ''' print'\n----------\n- pyamtrack test run\n----------\n\n'
|
mb.class_( lambda x: x.name.startswith( 'HINSTANCE' ) ).include( )
|
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
|
mb.class_( "BaseParticleSystem" ).member_functions( "EmitterTransformation" ).call_policies = call_policies.return_internal_reference( )
|
mb.class_( "BaseParticleSystem" ).member_function( "EmitterTransformation", return_type = '::xfx::Mat4 &' ).call_policies = call_policies.return_internal_reference( )
|
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
mb.member_functions( lambda x: x.name.startswith( '_' ) ).exclude() mb.variables( lambda x: x.name.startswith( '_' ) ).exclude()
|
mb.decls( lambda x: x.name.startswith( '_' ) ).exclude()
|
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
mb.class_( "ITexture" ).member_functions( lambda x: x.name in ( "GetD3DTex", ) ).exclude( )
|
mb.class_( "Cmd" ).member_function( "RegisterVar" ).use_overload_macro = True
|
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
mb.namespace( lambda x: x.name.startswith( 'xfx' ) ).include( ) mb.class_( lambda x: x.name.startswith( 'HINSTANCE' ) ).include( ) mb.class_( lambda x: x.name.startswith( 'HWND' ) ).include( )
|
mb.namespace( 'xfx' ).include( )
|
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
mb.class_( "Cmd" ).member_function( "RegisterVar" ).exclude( )
|
mb.class_( "ITexture" ).member_functions( lambda x: x.name in ( "GetD3DTex", ) ).exclude( )
|
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
mb.class_( "ShaderParams" ).member_functions( "GetValue" ).add_transformation( ft.output( "value" ) ) mb.member_functions( "ParseEnvelope" ).add_transformation( ft.inout( "env" ), ft.inout( "pos" ) )
|
mb.class_( "AABBTree" ).member_functions( "TestIntersection", arg_types = [ 'float &', None, None, None ] ).add_transformation( ft.output( "t" ), ft.output( "normal" ), alias = 'test_intersection_ray' ) mb.class_( "Texture" ).member_functions( "GetFrameTexCoords" ).add_transformation( ft.output( "u0" ), ft.output( "v0" ), ft.output( "u1" ), ft.output( "v1" ) )
|
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
mb.class_( "FileIterator_t" ).opaque = True mb.class_( "TextureInfo" ).opaque = True
|
l = ( 'Triangle', 'AABB', 'Sphere', 'Plane' ) for s in l: f = mb.namespace( "Primitives" ).free_function( name = "TestIntersection", arg_types = [ 'float &', None, ''.join( ( '::xfx::Primitives::', s, ' const &' ) ), None, None ] ) f.add_transformation( ft.output( "t" ), ft.output( "norm" ), alias = ''.join( ( f.alias, '_', camel_convert( s ) ) ) ) l = ( 'Mat4', 'Vec4' ) for s in l: f = mb.class_( "ShaderParams" ).member_function( name = "GetValue", arg_types = [ None, ''.join( ( '::xfx::', s, ' &' ) ) ] ) f.add_transformation( ft.output( "value" ), alias = ''.join( ( f.alias, '_', camel_convert( s ) ) ) ) l = ( 'int', 'float' ) for s in l: f = mb.class_( "ShaderParams" ).member_function( name = "GetValue", arg_types = [ None, ''.join( ( s, ' &' ) ) ] ) f.add_transformation( ft.output( "value" ), alias = ''.join( ( f.alias, '_', camel_convert( s ) ) ) ) f = mb.class_( "ShaderParams" ).member_function( name = "GetValue", arg_types = [ None, '::boost::shared_ptr<xfx::ITexture const> &' ] ) f.add_transformation( ft.output( "value" ), alias = ''.join( ( f.alias, '_texture' ) ) )
|
def camel_convert(name): s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).lower()
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.