ts.SetPrismType(p) else: pc = -99 atr = 0 if p == 2 else 1 else: pc = GetFloat("Prism constant [mm] (-99 for none) ", pc * 1000) / 1000.0 if pc > -99: ts.SetPc(pc) #pc = -99 atr = 0 if pc == 0.00344 else 1 print(ts.GetPc()) ts.SetATR(atr) raw_input("Target on prism and press enter") if atr: res = ts.MoveRel(Angle(0), Angle(0), atr) if 'errorCode' in res or ts.measureIface.state != ts.measureIface.IF_OK: print("Cannot target on prism") ts.measureIface.state = ts.measureIface.IF_OK continue res = ts.Measure() obs = ts.GetMeasure() obs['id'] = t_id geo_wrt.WriteData(obs) coo = ts.Coords() coo['id'] = t_id if pc > -99: coo['pc'] = pc elif 'pc' in coo: del coo['pc'] coo_wrt.WriteData(coo)
print 'FATAL Cannot measure startpoint' exit(1) act = Angle(0) # actual angle from startpoint # height of startpoint above the horizontal axis height0 = math.cos(startp['v'].GetAngle()) * startp['distance'] w = True try: ts.SetRedLaser(1) except: pass while act.GetAngle() < maxa: # go around the whole circle ts.Measure() # measure distance0 if ts.measureIface.state != ts.measureIface.IF_OK: ts.measureIface.state = ts.measureIface.IF_OK ts.MoveRel(stepinterval, Angle(0)) continue nextp = ts.GetMeasure() # get observation data if ts.measureIface.state != ts.measureIface.IF_OK: ts.measureIface.state = ts.measureIface.IF_OK ts.MoveRel(stepinterval, Angle(0)) continue if not 'v' in nextp or not 'distance' in nextp or not 'hz' in nextp: ts.MoveRel(stepinterval, Angle(0)) continue height = math.cos(nextp['v'].GetAngle()) * nextp['distance'] index = 0 while abs(height - height0) > tol: # looking for right elevation w = True
planeRes = plane[0] * points[i]['east'] + \ plane[1] * points[i]['north'] + \ plane[2] * points[i]['elev'] + plane[3] logging.debug("Checking the distance for the first points: %d - %.3f", i, planeRes) # Moving back to the first point if numberOfPoints > 1: ts.Move(points[0]['hz'], points[0]['v']) act = Angle(0) # Actual angle from start point set to zero w = True while act.GetAngle() < arange: # Going around a whole circle ts.Measure() # Measuring distance if ts.measureIface.state != ts.measureIface.IF_OK: ts.measureIface.state = ts.measureIface.IF_OK ts.MoveRel(stepinterval, Angle(0)) # TODO continue nextp = ts.GetMeasure() # Get observation data if ts.measureIface.state != ts.measureIface.IF_OK or \ 'hz' not in nextp or 'v' not in nextp or \ 'distance' not in nextp: ts.measureIface.state = ts.measureIface.IF_OK ts.MoveRel(stepinterval, Angle(0)) # TODO continue # Calculating the coordinates of the next points nextp['east'] = nextp['distance'] * math.sin(nextp['v'].GetAngle()) * \ math.sin(nextp['hz'].GetAngle()) nextp['north'] = nextp['distance'] * math.sin(nextp['v'].GetAngle()) * \ math.cos(nextp['hz'].GetAngle()) nextp['elev'] = nextp['distance'] * math.cos(nextp['v'].GetAngle())
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 last_v = measurement['v'] prev_hz = measurement['hz'] # direction of last measured point prev_v = measurement['v'] moving = True limit = Angle('0-03-00',
for i in range(numberOfPoints): planeRes = plane[0] * points[i]['east'] + plane[1] * points[i][ 'north'] + plane[2] * points[i]['elev'] + plane[3] logging.debug("Checking the distance for the first points: %d - %.3f" % (i, planeRes)) # Moving back to the first point if numberOfPoints > 1: ts.Move(points[0]['hz'], points[0]['v']) act = Angle(0) # Actual angle from start point set to zero w = True while act.GetAngle() < arange: # Going around a whole circle ts.Measure() # Measuring distance if ts.measureIface.state != ts.measureIface.IF_OK: ts.measureIface.state = ts.measureIface.IF_OK ts.MoveRel(stepinterval, Angle(0)) # TODO continue nextp = ts.GetMeasure() # Get observation data if ts.measureIface.state != ts.measureIface.IF_OK or \ not 'hz' in nextp or not 'v' in nextp or \ not 'distance' in nextp: ts.measureIface.state = ts.measureIface.IF_OK ts.MoveRel(stepinterval, Angle(0)) # TODO continue # Calculating the coordinates of the next points nextp['east'] = nextp['distance'] * math.sin( nextp['v'].GetAngle()) * math.sin(nextp['hz'].GetAngle()) nextp['north'] = nextp['distance'] * math.sin( nextp['v'].GetAngle()) * math.cos(nextp['hz'].GetAngle()) nextp['elev'] = nextp['distance'] * math.cos(nextp['v'].GetAngle())