res = {'errorCode': 0} i = 1 while 'errorCode' in res and i < 3: res = ts.SetStation(coo['east'], coo['north'], coo['elev'], ih) i += 1 if 'errorCode' in res: print("Failed to upload station coordinates code: {:d}".format( res['errorCode'])) exit() geo = {} if otype == 'geo': geo['station'] = coo['id'] geo['ih'] = ih geo_wrt.WriteData(geo) atr = 1 ts.SetEDMMode('STANDARD') pc = 0.0 p = 0 if isinstance(ts.GetMeasureUnit(), LeicaTPS1200): print("Prism types:") for i in range(20): res = ts.SetPrismType(i) if 'errorCode' in res: continue res = ts.GetPc() if 'errorCode' in res: continue if 'pc' in res: print(i, res['pc'] * 1000, " mm") while 1: t_id = raw_input("Target id: ")
wrt = CsvWriter( angle='GON', dist='.3f', dt='%Y-%m-%d %H:%M:%S', filt=['id', 'hz', 'v', 'distance', 'east', 'north', 'elev'], fname=sys.argv[5], mode='a', sep=';') else: wrt = EchoWriter() ts = TotalStation("Leica", mu, iface) slopeDist = 0 if edm not in mu.edmModes: edm = 'FAST' ts.SetEDMMode(edm) # initialize instrument and variables if mode > 0: ts.SetLock(0) ts.SetATR(1) ts.MoveRel(Angle(0), Angle(0), 1) ts.Measure() measurement = ts.GetMeasure() if 'distance' in measurement: slopeDist = measurement['distance'] if mode in (3, 4, 5): ts.SetLock(1) ts.LockIn() if mode == 5: last_hz = measurement['hz'] # direction of last measured point
# set port port = 'COM5' if len(sys.argv) > 4: port = sys.argv[4] iface = SerialIface("test", port) # set output file name fn = 'measmtrx.txt' if len(sys.argv) > 5: fn = sys.argv[5] # write out measurements wrt = FileWriter(angle='DEG', dist='.3f', fname=fn) if wrt.GetState() != wrt.WR_OK: sys.exit(-1) # open error ts = TotalStation(stationtype, mu, iface, wrt) ts.SetATR(0) # turn ATR off ts.SetEDMMode('RLSTANDARD') # reflectorless distance measurement ts.SetRedLaser(1) # turn red laser on w = raw_input("Target on lower left corner and press Enter") w1 = ts.GetAngles() w = raw_input("Target on upper right corner and press Enter") w2 = ts.GetAngles() dh = (w2['hz'].GetAngle() - w1['hz'].GetAngle()) / dh_nr dv = (w2['v'].GetAngle() - w1['v'].GetAngle()) / dv_nr # measurement loops for i in range(dh_nr + 1): # horizontal loop measdir = i % 2 # check modulo hz = Angle(w1['hz'].GetAngle() + i * dh, 'RAD') for j in range(dv_nr + 1): # vertical loop if measdir == 0:
arange = float(sys.argv[7]) / 360.0 * PI2 iface = SerialIface("rs-232", port) ## eomRead='\n' wrt = CsvWriter(angle='DMS', dist='.3f', filt=['id', 'east', 'north', 'elev'], fname='section.txt', mode='w', sep=';') ts = TotalStation(stationtype, mu, iface) if isinstance(mu, Trimble5500): print("Set Trimble 550x to direct reflex (MNU 722)") raw_input() else: ts.SetATR(0) # ATR mode off ts.SetLock(0) # Lock mode off ts.SetEDMMode("RLSTANDARD") # Reflectorless distance measurement ts.SetRedLaser(1) # Direction of the points to defining the plane points = [] for i in range(numberOfPoints): raw_input("Target on %d point and press enter" % (i + 1)) ts.Measure() obs = ts.GetMeasure() if ts.measureIface.state != ts.measureIface.IF_OK or \ 'errorCode' in obs: print('Start again!') exit(1) # Calculation of the directed coordinates according to the instrument's origin obs['east'] = obs['distance'] * math.sin(obs['v'].GetAngle()) * \ math.sin(obs['hz'].GetAngle())