def sendToConfig(flag, coefs):
    cString = ','.join(['%.5f' % num for num in coefs])
    cParser = calibrationParser("instrumentCalibration.xml")
    if flag == "-az":
        cParser.setAzimuthCalibration(cString)
    elif flag == "-al":
        cParser.setAltitudeCalibration(cString)
    elif flag == "-azup":
        cParser.setAzimuthUpCalibration(cString)
    elif flag == "-azdn":
        cParser.setAzimuthDownCalibration(cString)
    elif flag == "-alup":
        cParser.setAltitudeUpCalibration(cString)
    elif flag == "-aldn":
        cParser.setAltitudeDownCalibration(cString)
    else:
        raise ValueError("Flag %s is not recognised" % flag)
def sendToConfig(flag, coefs):
    cString = ",".join(["%.5f" % num for num in coefs])
    cParser = calibrationParser("instrumentCalibration.xml")
    if flag == "-az":
        cParser.setAzimuthCalibration(cString)
    elif flag == "-al":
        cParser.setAltitudeCalibration(cString)
    elif flag == "-azup":
        cParser.setAzimuthUpCalibration(cString)
    elif flag == "-azdn":
        cParser.setAzimuthDownCalibration(cString)
    elif flag == "-alup":
        cParser.setAltitudeUpCalibration(cString)
    elif flag == "-aldn":
        cParser.setAltitudeDownCalibration(cString)
    else:
        raise ValueError("Flag %s is not recognised" % flag)
예제 #3
0
import logging


if __name__ == '__main__':
    ## Set up logging
    logger = logging.getLogger('iTelescope')
    hdlr = logging.FileHandler('iTelescope.log')
    formatter = logging.Formatter('%(asctime)s %(levelname)s %(message)s')
    hdlr.setFormatter(formatter)
    logger.addHandler(hdlr) 
    #logger.setLevel(logging.WARNING)
    ######
    
    ## name config files
    cfgP = configParser("config.xml")
    calP = calibrationParser("instrumentCalibration.xml")
    ######
    while True:
        try:   
            ## Start the unConnected thread
            basic = unConnected(cfgP,calP,logger)
            basic.start()
            
            ## Start the bluetooth server and listen        
            theServer = blueServer(logger)
            theServer.listenForConnection()
            
            basic.endThread()## terminate the unConnected thread on connection
            ######
            
            ## On connection exchange config files and enter config mode